clvova.blogg.se

Cmake include directories from another project
Cmake include directories from another project











cmake include directories from another project

Also allow to perform even a subtle configuration and append one of the following markers for this command. It allows to append a directory for a specific project/target without (maybe) unnecessary inheritance or clashing of various include directories.

cmake include directories from another project

Sometimes people say that such approach is legacy.Ī more elegant way is with target_include_directories.

Cmake include directories from another project series#

But there are two ways to do it.Ĭrude include_directories will append a directory to the current project and all other descendant projects which you will append via a series of add_subdirectory commands. There are no such thing like a " proper way" if looking in various opensource projects how people include directories. It is not very cool like Python, but still. Target_link_libraries(cpp_test evolution)ĬMake is more like a script language if comparing it with other ways to create Makefile (e.g. They are all similar in structure src/evolution/CMakeLists.txt contains the following: add_library(evolution "")ĥ.The unit tests are registered in tests/CMakeLists.txt add_executable(cpp_test test.cpp) # contains an "external" library we will link toĢ.Targets and sources are defined in src/CMakeLists.txt (except the conversion target) add_executable(automata main.cpp)ģ.The conversion library is defined in external/CMakeLists.txt add_library(conversion "")Ĥ.The src/CMakeLists.txt file adds further subdirectories, which in turn contain CMakeLists.txt files. First add the directory to be included: target_include_directories(test PRIVATE $)













Cmake include directories from another project