Issue
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
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
Answered By - wohlstad Answer Checked By - David Goodson (WPSolving Volunteer)