[CMake] position of INCLUDE_DIRECTORIES() significant ?
Alexander Neundorf
a.neundorf-work at gmx.net
Sun Feb 12 13:55:07 EST 2006
> --- Ursprüngliche Nachricht ---
> Von: "William A. Hoffman" <billlist at nycap.rr.com>
>
> At 01:08 PM 2/12/2006, Alexander Neundorf wrote:
> >Hi,
> >
> >does it matter whether I write
> >
> >include_directories( /usr/include/foo )
> >add_executable(test test.c)
> >
> >or
> >
> >add_executable(test test.c)
> >include_directories( /usr/include/foo )
> >
> >in the CMakeLists.txt ?
> >For me with the Makefile generator both work. Is this also the case
> >for the other generators ?
> >
>
> 1 is the preferred way to do it, and at some point in the future it
> might make a difference. Right now the include directory is a
> directory property, but really it should be a target property.
So, if I understand correctly:
right now the following works (while not preferred/recommended):
add_executable (test main.cpp)
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
target_link_libraries(test ${ZLIB_LIBRARY})
endif (ZLIB_FOUND)
in the case that something might be done anywhen in the future, will it
look something like this:
add_executable (test main.cpp)
if (ZLIB_FOUND)
target_include_directories(test ${ZLIB_INCLUDE_DIR})
target_link_libraries(test ${ZLIB_LIBRARY})
endif (ZLIB_FOUND)
?
I.e. can the behaviour of include_directories() as it is now be kept and
the additional per-target settings just be added without changing the
current behaviour ?
Bye
Alex
--
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
More information about the CMake
mailing list