diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e390faea..e5b5603a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -35,18 +35,18 @@ function(UseGitOrCloneImpl remote use_custom_branch custom_branch) else() if(NOT use_custom_branch) message(STATUS "Cloning `${dep}` from `${remote}` using the default branch ...") - execute_process(OUTPUT_QUIET ERROR_QUIET COMMAND git clone --depth 1 ${remote}) + execute_process(OUTPUT_QUIET ERROR_QUIET COMMAND git clone --depth 1 ${remote} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") else() message(STATUS "Cloning `${dep}` from `${remote}:${branch}` ...") - execute_process(OUTPUT_QUIET ERROR_QUIET COMMAND git clone --depth 1 -b ${custom_branch} ${remote}) + execute_process(OUTPUT_QUIET ERROR_QUIET COMMAND git clone --depth 1 -b ${custom_branch} ${remote} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") endif() - add_subdirectory("${CMAKE_SOURCE_DIR}/${dep}" ${dep}) + add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${dep}" ${dep}) message(STATUS "Cloning `${dep}` from `${remote}`: Configured.") if("${C5T_PROJECT_ROOT}" STREQUAL "") file(TOUCH .gitignore) file(APPEND .gitignore "${dep}/\n") # NOTE(dkorolev): This may add extra `.gitignore` lines, ignore for now. endif() - set("C5T_DEP_DIR_${dep}" "${CMAKE_SOURCE_DIR}/${dep}" CACHE INTERNAL "") + set("C5T_DEP_DIR_${dep}" "${CMAKE_CURRENT_SOURCE_DIR}/${dep}" CACHE INTERNAL "") endif() # If the added repository contains the `.c5t_cmake_dependency` file, # then add this repo's C5T library name to all targets built by this `CMakeLists.txt`.