[CMake] INCLUDE_DIRECTORIES in sub-directories doesn't work?
Hugo Heden
hugoheden at gmail.com
Tue Nov 25 08:30:29 EST 2008
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