[CMake] INCLUDE_DIRECTORIES in sub-directories doesn't work?
Bill Hoffman
bill.hoffman at kitware.com
Wed Nov 26 09:59:10 EST 2008
Bill Hoffman wrote:
> Sean Soria wrote:
>> No, this doesn't work either:
>> CMakeLists.txt:
>> ADD_SUBDIRECTORY(foo)
>> ADD_EXECUTABLE(hello main.c foo/main.c)
>>
>> foo/CMakeLists.txt:
>> SET_PROPERTY(SOURCE main.c PROPERTY INCLUDE_DIRECTORIES
>> ${CMAKE_CURRENT_SOURCE_DIR})
>>
>
> I might be missing something but why not:
>
> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/foo)
> ADD_EXECUTABLE(hello main.c foo/main.c)
>
OK, so I think I just figured out what you are trying to do....
You want two source files in the same target to have different -I flags.
There is not really a good way to do that in CMake right now.
You could use the source file property COMPILE_FLAGS, but it might not
be that portable. I find it odd that you would need to do something
like this... Also, the example seems to have two main.c in one
executable which is also odd...
-Bill
More information about the CMake
mailing list