[CMake] order of include dirs
Brad King
brad.king at kitware.com
Thu Mar 30 09:42:44 EST 2006
Alexander Neundorf wrote:
>>Von: Brad King <brad.king at kitware.com>
>>
>>Alexander Neundorf wrote:
>>
>>>in KDE we have the problem that e.g. when compiling kdebase the
>>>headers
>>>in the source dir should be preferred over the installed ones.
>>>Usually we would do
>>>include_directories( ${KDE4_INCLUDES} ) in the toplevel
>>>CMakeLists.txt.
>>>When adding more include dirs in CMakeLists.txt in deeper
>>>directories, these directories will be appended to the list of
>>>include dirs, except when used with the BEFORE keyword.
>>>But now we cannot realistically expect that every KDE developer will
>>>always remember the BEFORE keyword.
>>>So we had two ideas:
>>>make the behaviour configurable:
>>># make prepend default:
>>>set(CMAKE_INCLUDE_DIRS_APPEND false)
>>># to force appending:
>>>include_directories(AFTER dir1 dir2)
>>>
>>>Problem here: moving cmake files around to another project where this
>>>isn't set would change the behaviour.
>>>
>>>Second idea:
>>>
>>>include_directories(LAST dir1 dir2)
>>>
>>>which would have the effect that the listed directories would always
>>>be used after all other include dirs specified without the "LAST"
>>>keyword.
>>
>>
>>I think that will create two ordered lists of include directories
>>instead of one, which will just be confusing.
>
>
> What about the first idea ?
> I think this would fit good to the include_directories() command.
I think a magic switch that can easily be accidentally inherited by
projects not expecting it will not work well. Eventually we plan to
make include directories a target-specific setting. At that point we
will design a better default ordering.
-Brad
More information about the CMake
mailing list