[CMake] How to set path to library header files?

Bill Hoffman bill.hoffman at kitware.com
Tue Dec 2 14:09:49 EST 2014


On 12/2/2014 1:33 PM, Angeliki Chrysochou wrote:
>
> you should add in ./src/prog/CMakeLists.txt in include_directories the
> correct path to myfunc.h. Assuming CMAKE_SOURCE_DIR is "." (this is
> where your top level CMakeLists.txt is located):
>
> include_directories(${CMAKE_SOURCE_DIR}/src/mylib)
I don't think that will work.  Two reasons:

CMAKE_SOURCE_DIR is the top level source directory for the project, not 
the current one.  Also, he wants to include the file like this:

#include "mylib/myfunc.h"

So, the include needs to go to src  and not src/mylib.

-Bill



More information about the CMake mailing list