diff --git a/CMakeLists.txt b/CMakeLists.txt index 38488cb..46ef184 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,8 @@ endif() # Note: globbing sources is considered bad practice as CMake won't detect new files automatically. # Remember to always invoke cmake after changing files, or explicitly mention them here. -FILE(GLOB_RECURSE headers "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") -FILE(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp") +FILE(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") +FILE(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp") # ---- Add dependencies via CPM ---- # see https://github.com/TheLartians/CPM.cmake for more info diff --git a/standalone/CMakeLists.txt b/standalone/CMakeLists.txt index 4ae4c3b..e8ffc86 100644 --- a/standalone/CMakeLists.txt +++ b/standalone/CMakeLists.txt @@ -24,7 +24,7 @@ CPMAddPackage( # ---- Create standalone executable ---- -file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) +file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) add_executable(GreeterStandalone ${sources}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d824879..e34ca2a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,7 +37,7 @@ CPMAddPackage( # ---- Create binary ---- -file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) +file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) add_executable(GreeterTests ${sources}) target_link_libraries(GreeterTests doctest Greeter)