I want to try CMake to manage a new C++ project. However, some files are automatically generated. I have no way to know the name of the generated files. The only thing I know is that these files are all generated in the foo/ directory. Is there a way to ask CMake to include all .cpp files from foo/ ?
Thank you.
First, you use include_directories() to tell CMake to add the directory as -I to the compilation command line. Second, you list the headers in your add_executable() or add_library() call.
cmake is searched first in CMAKE_MODULE_PATH , then in the CMake module directory. There is one exception to this: if the file which calls include() is located itself in the CMake builtin module directory, then first the CMake builtin module directory is searched and CMAKE_MODULE_PATH afterwards.
Add a subdirectory to the build. Adds a subdirectory to the build. The source_dir specifies the directory in which the source CMakeLists.
You may do this with GLOB
FILE(GLOB ALL_CPP_SRCS *.cpp)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With