[CMake] link_libraries vs target_link_libraries

Hendrik Sattler post at hendrik-sattler.de
Wed Nov 12 10:40:24 EST 2008


Fernando Cacciola schrieb:
> Hendrik Sattler wrote:
>> Bill Hoffman schrieb:
>>>> OTOH, it could make sense to do the following:
>>>>
>>>>  find_packge( CGAL REQUIRED <components> )
>>>>
>>>>  include( ${CGAL_USE_FILE} )
>>>>
>>>>  ....
>>>>  add_executable( program ... )
>>>>
>>>>  use_CGAL( program )
>>>>
>>>> so it works now with 2.4, and eventually "upgrade" it to use target
>>>> properties instead.
>>> That sounds like a good way to go, and is similar to what the boost
>>> folks are doing.
>>
>> But it is not backwards-compatible and will fail to link on the new
>> version while it worked fine on the old version.
> 
> Why??

Because if the ${FOO_USE_FILE} doesn't do what it always does (globally
adding this stuff), you _have_ to insert the new macro call to make it
compile again. OTOH, this macro call will fail on the old version
because it doesn't exist.
(Assumed that FindFoo.cmake and ${FOO_USE_FILE} are shipped with cmake)

HS


More information about the CMake mailing list