Skip to content

Commit a6da287

Browse files
ChrisThrashereXpl0it3r
authored andcommitted
Don't glob source files
This is a notorious CMake debate but I come down on the side of strict correctness and avoid globbing. For a template project like this where users are prone to be adding new source files regularly, I worry that even with CONFIGURE_DEPENDS they may still have issues with CMake not reconfiguring and not picking up the new .cpp file they added. I'd prefer to leave globbing to experienced CMake users who are likely not the audience of this template project.
1 parent edd6156 commit a6da287

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ cmake_minimum_required(VERSION 3.15)
22

33
project(CMakeSFMLProject LANGUAGES CXX)
44

5-
# Find all source files
6-
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/src/*.hpp)
7-
85
# Tell CMake to build a executable
9-
add_executable(CMakeSFMLProject ${SOURCE_FILES})
6+
add_executable(CMakeSFMLProject src/main.cpp)
107

118
# CMake SFML Project uses C++17 features
129
target_compile_features(CMakeSFMLProject PRIVATE cxx_std_17)

0 commit comments

Comments
 (0)