[cmake-developers] Why does this work - linking against a library before it has been defined ?
Alexander Neundorf
neundorf at kde.org
Thu Jul 11 15:52:03 EDT 2013
Hi,
I was surprised today, something worked which I expected to fail:
add_executable(kf5-config kde-config.cpp )
target_link_libraries(kf5-config ${KDE4_KDECORE_LIBS} kde4support)
add_subdirectory(lib)
The thing is, the library "kde4support" is built inside the "lib"
subdirectory, which is added after using "kde4support" in
target_link_libraries().
I think in previous version of cmake the "kde4support" in the tll() call would
have been recognized as the name of a library and added to the link command
using "-lkde4support".
Now it seems to be recognized as the name of a target.
Is this correct ?
Is this because more stuff happens now at generate time, when all targets are
known ?
Alex
More information about the cmake-developers
mailing list