[CMake] INCLUDE_DIRECTORIES in sub-directories doesn't work?

Sean Soria sean.soria at gmail.com
Tue Nov 25 16:09:36 EST 2008


I wouldn't expect that to work since I can see that it got the memo to
include that directory but just doesn't do it.  But I tried it out by
using INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) and I got the
same bad results.

On Tue, Nov 25, 2008 at 5:30 AM, Hugo Heden <hugoheden at gmail.com> wrote:
> 2008/11/25 Sean Soria <sean.soria at gmail.com>:
>> CMakeLists.txt:
>> INCLUDE_DIRECTORIES(.)
>> ADD_SUBDIRECTORY(foo)
>> ADD_EXECUTABLE(hello main.c foo/main.c)
>>
>
> How about an absolute path instead of a relative?
>
> INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
>
>> foo/CMakeLists.txt:
>> INCLUDE_DIRECTORIES(.)
>>
>> I would expect foo/main.c to be compiled with:
>> /usr/bin/gcc   -I/code/xbmc/XBMC/build.test/.
>> -I/code/xbmc/XBMC/build.test/foo/.   -o
>> CMakeFiles/hello.dir/foo/main.o   -c
>> /code/xbmc/XBMC/build.test/foo/main.c
>>
>> I even see the include path defined in
>> foo/CMakeFiles/CMakeDirectoryInformation.cmake:
>> SET(CMAKE_C_INCLUDE_PATH
>>  "."
>>  "foo/."
>>  )
>>
>> Unfortunately cmake seems to ignore these and I get this instead:
>> /usr/bin/gcc   -I/code/xbmc/XBMC/build.test/.   -o
>> CMakeFiles/hello.dir/foo/main.o   -c
>> /code/xbmc/XBMC/build.test/foo/main.c
>>
>> Am I missing something or is INCLUDE_DIRECTORIES broken?  I've even
>> tried set_property on the directory.
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>


More information about the CMake mailing list