'Cmake include header only library with -I option
I have a header only library that is contained in a "headers/" directory in the main project. When compiling from terminal I include it with #include "symbolicc++.h", but I need to pass the option -I "headers/" when compiling with g++. How can I include this in a Cmake project? (And also, in general how can I pass other option such as -pthread to Cmake?
Solution 1:[1]
Adding include directories in CMake is done by using the target_include_directories directive.
Use it this way (in your CMakeLists.txt):
target_include_directories(${TARGET_NAME} PUBLIC ${SOME_INCLUDE_DIR})
Some more info: target_include_directories
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
