[CMake] INCLUDE_DIRECTORIES and relative path

Bill Hoffman bill.hoffman at kitware.com
Mon Nov 2 09:11:07 EST 2009


jago jagoc wrote:
>>> jago jagoc wrote:
>>> Hi,
>>> I am some problem using INCLUDE_DIRECTORIES macro, i am using Cmake
>>> 2.6 - path 0 and Visual studio 2005.
>>> In my Cmakelist.txt
>>>
>>> ...
>>> SET(MYINCLUDE_DIR "../3rdParty/include" CACHE STRING "My include dir
>>> You may add additional search paths here. Use ; to separate multiple
>>> paths.")
>>>
>>>
>>> INCLUDE_DIRECTORIES( ${MYINCLUDE_DIR } )
>>> ...
> 
>> You need to remove the extra space...
> 
>> INCLUDE_DIRECTORIES( ${MYINCLUDE_DIR} )
> 
>> -Bill
> 
> Hi Bill,
> thank you for your answer, i tried without the space but the result is
> the same, e.x.
> if i write in cmakelists.txt
> ...
> 
> INCLUDE_DIRECTORIES( "../../include" )
> or
> SET(MYINCLUDE_DIR "../3rdParty/include" CACHE STRING "My include dir
> You may add additional search paths here. Use ; to separate multiple
>  paths.")
> 
> INCLUDE_DIRECTORIES( ${MYINCLUDE_DIR} )
> ...
> in the solution i find( c++ propierties):
> 
> F:/Develop/nameofproject/../3rdParty/include;F:/Develop/nameofproject/../../include;
> 

Use this:

${CMAKE_CURRENT_SOURCE_DIR}/../../include

-Bill


More information about the CMake mailing list