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

Sean Soria sean.soria at gmail.com
Tue Nov 25 17:00:05 EST 2008


I had them switched originally and just double checked.  This also doesn't work:
CMakeLists.txt:
ADD_SUBDIRECTORY(foo)
ADD_EXECUTABLE(hello main.c foo/main.c)

foo/CMakeLists.txt:
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

On Tue, Nov 25, 2008 at 1:54 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> Sean Soria wrote:
>>
>> CMakeLists.txt:
>> ADD_EXECUTABLE(hello main.c foo/main.c)
>> ADD_SUBDIRECTORY(foo)
>>
>> foo/CMakeLists.txt:
>> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
>>
>
> It is order dependent.
>
> So, the include_directory will not affect the hello target because it comes
> after it.
>
>
> -Bill
>


More information about the CMake mailing list