Set ( CPPMP_REPOSITORY https://git.bergmann89.de/cpp/cppmp.git ) Set ( CPPMP_COMMIT master ) Set ( CPPMP_CHECKOUT_DIR ${CMAKE_BINARY_DIR}/sources/cppmp ) # Clone Repository If ( NOT EXISTS ${CPPMP_CHECKOUT_DIR} ) Execute_Process ( COMMAND git clone ${CPPMP_REPOSITORY} ${CPPMP_CHECKOUT_DIR} RESULT_VARIABLE CLONE_RET ) If ( NOT ${CLONE_RET} EQUAL 0 ) Return ( ) EndIf ( ) EndIf ( ) # Checkout Specific Commit Execute_Process ( COMMAND git -C ${CPPMP_CHECKOUT_DIR} -c advice.detachedHead=false checkout origin/${CPPMP_COMMIT} COMMAND git -C ${CPPMP_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 ( cppmp ${CPPMP_CHECKOUT_DIR} ) # Create Alias Targets If ( NOT TARGET cppmp::cppmp ) Add_Library ( cppmp::cppmp ALIAS cppmp ) EndIf ( )