[CMake] how to use CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH?

Clark J. Wang dearvoid at gmail.com
Wed Jul 18 23:40:45 EDT 2007


On 7/19/07, cjacker <jzhuang at redflag-linux.com> wrote:
>
> cmake-2.4.6.
>
> I had search it anywhere.
> somebody said these are environment variable
> in some CMakeLists.txt
> I also find something like this:
> set(CMAKE_INCLUDE_PATH /include)
> This seems like a cmake variable not a environment variable.
>
> Also, I did not find this variable in kdebase of KDE4.
>
> Anyboy can help to explain how to use CMAKE_INCLUDE_PATH?


According to CMake's manual this var is used by FIND_PATH and FIND_FILE.

I search the CMAKE Sourcecode, it seems only useful in FIND_PATH command.
>
> but how to use it?
>
> I do it in bash like this:
> export CMAKE_INCLUDE_PATH=/usr/include/hello
>
> FIND_PATH(myPath hello.h ${CMAKE_INCLUDE_PATH})
>
> it just did not works.


It works fine for me. And the paths defined in CMAKE_INCLUDE_PATH are
searched by default so you needn't pass it to FIND_PATH explicitly.

if we use it like $ENV{CMAKE_INCLUDE_PATH}, it is a normal environment
> variable.


By default FIND_PATH use both CMake var CMAKE_INCLUDE_PATH and the env var
CMAKE_INCLUDE_PATH to search files.

We can define anyname like this.
>
>
> also, if we must explicitly use this variable in CMakeLists.txt, how can
> we handle things like --extra-include-dir?
>
> I already search the maillist of cmake, please do not redirect me to
> other post here. It did not works.
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070719/ee8229ec/attachment.htm


More information about the CMake mailing list