[cmake-developers] Why does this work - linking against a library before it has been defined ?

Brad King brad.king at kitware.com
Mon Jul 15 08:38:35 EDT 2013


On 07/11/2013 03:52 PM, Alexander Neundorf wrote:
> 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.

This has always been the case.  Link analysis has always
been done at generate time.

-Brad



More information about the cmake-developers mailing list