Here's my CMakeLists.txt in the top level directory: cmake_minimum_required(VERSION 3. I've tried to take into account the solution proposed below by squareskittles. │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeDetermineCompilerABI_C.bin Second, you list the headers in your addexecutable () or addlibrary () call. Here is the tree for the overall project tree First, you use includedirectories () to tell CMake to add the directory as -I to the compilation command line. Target_link_libraries (run_tests Eigen3::Eigen stdc++fs UnitTest++) SET(CMAKE_CXX_FLAGS "$/./src/position_summary.cpp" ![]() SET(GCC_COVERAGE_COMPILE_FLAGS "-no-pie") Here's test/CMakeLists.txt: cmake_minimum_required(VERSION 3.10)įind_package (Eigen3 3.3 REQUIRED NO_MODULE) However, I get a million undefined reference errors, and it can't find things that were defined outside of this test/ directory. So this cmake file that belongs to test/ has to compile and link those guys too. cmakeminimumrequired (VERSION 3.8) project (Calculator LANGUAGES CXX) addlibrary (calclib STATIC src/calclib.cpp include /calc/lib.hpp) targetincludedirectories(calclib PUBLIC include) targetcompilefeatures(calclib PUBLIC cxxstd11) addexecutable (calc apps/calc.cpp) targetlinklibraries (calc PUBLIC calclib) 1. The unusual thing that I'm doing is all of the source files that these tests are testing are not compiled as a library, and that directory has its own CMakeLists.txt, too. ![]() I'm trying to write a CMakeLists.txt file for the test/ directory in a project I'm working on.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |