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

Angeliki Chrysochou angeliki.chrysochou at gmail.com
Tue Dec 2 15:46:45 EST 2014


Glad it worked! No I don't think it is automatically an include path, only
the files in the current directory where your sources are should be by
default an include path.

On Tue, Dec 2, 2014 at 9:05 PM, Chris Johnson <cxjohnson at gmail.com> wrote:

> I'm using Make as my build tool.  Here's the failing compile line with the
> -I paths.  Indeed, they're not quite correct.  This is with the suggested
> include_directories() directive.
>
> [100%] Building CXX object prog/CMakeFiles/prog.dir/prog.cpp.o
> cd /sandbox/src/.build/prog && /usr/bin/c++    -I/sandbox/include
> -I/sandbox/src/src -I/sandbox/src/mylib    -o
> CMakeFiles/prog.dir/prog.cpp.o -c /sandbox/src/prog/prog.cpp
>
> Since the ../src/src path is wrong, I tried changing to
> include_directories(${CMAKE_SOURCE_DIR}) and that seems to work.  That
> seems to imply the top-level source is not part of the default include
> path, correct?
>
> Thanks,
> ..chris
>
>
> On Tue, Dec 2, 2014 at 1:10 PM, Bill Hoffman <bill.hoffman at kitware.com>
> wrote:
>
>> On 12/2/2014 1:04 PM, Chris Johnson wrote:
>>
>>> Adding this directive does not seem to change the results at all,
>>> actually.  Am I missing something?​
>>>
>>>
>> What build tool are you using?  Can you show a verbose compile line? Then
>> check the -I paths.  make VERBOSE=1 will do it for make.
>>
>> -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/569fa15b/attachment-0001.html>


More information about the CMake mailing list