[cmake-developers] Documentation or parse bug

Brad King brad.king at kitware.com
Thu Oct 17 11:19:12 EDT 2013


On 10/16/2013 02:40 PM, James Bigler wrote:
> The documentation for target_link_libraries has this description:
> 
>   target_link_libraries(<target>
>                         <LINK_PRIVATE|LINK_PUBLIC>
>                           [[debug|optimized|general] <lib>] ...
>                         [<LINK_PRIVATE|LINK_PUBLIC>
>                           [[debug|optimized|general] <lib>] ...])
> 
> From my understanding I should be able to do this:
> 
> target_link_libraries(target LINK_PRIVATE lib1 LINK_PRIVATE lib2)
> 
> however CMake 2.8.11.2 returns:
> 
> CMake Error at prime/CMakeLists.txt:128 (target_link_libraries):
>   The LINK_PUBLIC or LINK_PRIVATE option must appear as the second argument,
>   just after the target name.

Steve, I think this is a parsing problem here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmTargetLinkLibrariesCommand.cxx;hb=v2.8.12#l151
 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmTargetLinkLibrariesCommand.cxx;hb=v2.8.12#l181

It should allow LINK_PUBLIC to occur after another LINK_PUBLIC,
and LINK_PRIVATE to occur after another LINK_PRIVATE.  Currently
it requires that they alternate.  Thew newer PUBLIC/PRIVATE/INTERFACE
options allow any order and repeats.

Thanks,
-Brad



More information about the cmake-developers mailing list