[CMake] include directories,

Łukasz Tasz lukasz at tasz.eu
Thu Aug 11 04:02:26 EDT 2011


Hi Michael, All

Thanks a lot for your explanation,
Now it's obvious for me why it behaves like that, include directories
is inherited from directory properties, and this will be stable after
processing cmakelists.

What I want to do is a little bit different, I would like to reset
value of INCLUDE_DIRECTORIES.
I know that man pages says that this property is read_only, but in all
cases that I need cmake is allowing me to change it this. (again I
don't know if this is misbehaviours or property is not readonly
anymore?)

In my project I have wrapper macro for adding libraries and
executables, and I need to manipulate includes a little, I wanted to
do this in wrapper macro, but it looks like I need to find some other
hook to attach in place when CMakelists will be processed.

Any ideas?

thanks a lot
Lukasz


2011/8/10 Michael Wild <themiwi at gmail.com>:
> On Wed 10 Aug 2011 04:51:36 PM CEST, Łukasz Tasz wrote:
>> Hi All,
>>
>> Can somebody please advise me with this topic, if it is expected
>> behaviour or a bug?
>>
>> thanks in advance
>> Lukasz
>>
>> 2011/8/4 Łukasz Tasz <lukasz at tasz.eu>:
>>> Hi All,
>>>
>>> I have a question according include_directories() function and
>>> INCLUDE_DIRECTORIES directory property.
>>>
>>> Is it possible that I will know set of include directories that will
>>> be used by preprocessor when I'm calling add_executable function?
>>>
>>> I notticed, that order does not matter, for example:
>>>
>>> add_library(test test.cxx)
>>> include_directories("${CMAKE_CURRENT_SOURCE_DIR}libtest")
>>> add_library(test1 test1.cxx)
>>>
>>> both targets will have the same include directories.
>>>
>>> so from CMake phase I'm not able to check what will be includes
>>> configuration, INCLUDE_DIRECTORIES property contain only current one.
>>>
>>> is this expected behaviour or this can be tuned by setting some policy?
>>>
>>> thanks in advance
>>> Lukasz Tasz
>
> It is expected behaviour. The INCLUDE_DIRECTORIES is a directory
> property, and applies to *all* targets defined in that directory. The
> targets themselves get generated *after* the processing of the full
> CMakeLists.txt file in this directory. However, the get_directory() call
> gets evaluated immediately.
>
> I suspect what you want is different include paths for some of the files
> or targets, right? Currently the only solution is to put these targets
> into different directories. If you need file-level differentiation,
> you'll need static libraries in distinct directories.
>
> I know, it is a PITA and has caused much grief for a lot of people on
> this list... ;-)
>
>
> Michael
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



-- 
Lukasz Tasz


More information about the CMake mailing list