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

Angeliki Chrysochou angeliki.chrysochou at gmail.com
Tue Dec 2 14:44:01 EST 2014


Hi Bill,

He wrote

"Note also that prog.cpp includes this header via #include "myfunc.h"."

in his first email, so I thought he wants to include it directly.

Cheers!
Angeliki



On Tue, Dec 2, 2014 at 8:09 PM, Bill Hoffman <bill.hoffman at kitware.com>
wrote:

> 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
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141202/13f84ebf/attachment.html>


More information about the CMake mailing list