How locate .cpp Files in a "src directory" using CMake?
cmake
Solution
If you want to locate all `.cpp` files in the `src` directory, you could do
file(GLOB SOURCES src/*.cpp)
and use `${SOURCES}` wherever you need to. For example:
add_executable(game ${SOURCES})
Problem
I am learning c++ and cmake at the moment. I have my source files in the main directory where `CMakeLists.txt` is located. I want to store all source files in a /src directory, but i have no idea how to locate them in CMake. My CMake File ``` cmake_minimum_required(VERSION 2.8) project(game) set(GAME_ALL_SOURCES main.cpp check.cpp ) add_executable(game ${GAME_ALL_SOURCES}) target_link_libraries(game sfml-graphics sfml-window sfml-system) ``` Anyone a suggestion how to handle it? best regards