Set ( CPPCORE_REPOSITORY https://git.bergmann89.de/cpp/cppcore.git ) Set ( CPPCORE_COMMIT master ) Set ( CPPCORE_CHECKOUT_DIR ${CMAKE_BINARY_DIR}/sources/cppcore ) # Clone Repository If ( NOT EXISTS ${CPPCORE_CHECKOUT_DIR} ) Execute_Process ( COMMAND git clone ${CPPCORE_REPOSITORY} ${CPPCORE_CHECKOUT_DIR} RESULT_VARIABLE CLONE_RET ) If ( NOT ${CLONE_RET} EQUAL 0 ) Return ( ) EndIf ( ) EndIf ( ) # Checkout Specific Commit Execute_Process ( COMMAND git -C ${CPPCORE_CHECKOUT_DIR} -c advice.detachedHead=false checkout origin/${CPPCORE_COMMIT} COMMAND git -C ${CPPCORE_CHECKOUT_DIR} submodule update --init --recursive RESULT_VARIABLE CHECKOUT_RET ) If ( NOT ${CHECKOUT_RET} EQUAL 0 ) Return ( ) EndIf ( ) # Include Cloned Repository Include ( ${CMAKE_CURRENT_LIST_DIR}/modules/cmake/find_local_module.cmake ) FindLocalModule ( cppcore ${CPPCORE_CHECKOUT_DIR} ) # Create Alias Targets If ( NOT TARGET cppcore::cppcore ) Add_Library ( cppcore::cppcore ALIAS cppcore ) EndIf ( )