target_link_libraries: Allow repeated use of LINK_{PRIVATE,PUBLIC} keywords.

This has not been allowed since they were introduced in
commit 91438222 (target_link_libraries: Add LINK_(PUBLIC|PRIVATE)
options, 2011-10-07), but allowing this form makes it more compatible
with the newer PUBLIC and PRIVATE keywords.
This commit is contained in:
Stephen Kelly 2013-10-17 17:34:39 +02:00
parent 8f2b0c3307
commit dede273193
2 changed files with 7 additions and 5 deletions

View File

@ -151,7 +151,8 @@ bool cmTargetLinkLibrariesCommand
else if(args[i] == "LINK_PUBLIC")
{
if(i != 1
&& this->CurrentProcessingState != ProcessingPlainPrivateInterface)
&& this->CurrentProcessingState != ProcessingPlainPrivateInterface
&& this->CurrentProcessingState != ProcessingPlainPublicInterface)
{
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
@ -181,7 +182,8 @@ bool cmTargetLinkLibrariesCommand
else if(args[i] == "LINK_PRIVATE")
{
if(i != 1
&& this->CurrentProcessingState != ProcessingPlainPublicInterface)
&& this->CurrentProcessingState != ProcessingPlainPublicInterface
&& this->CurrentProcessingState != ProcessingPlainPrivateInterface)
{
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,

View File

@ -32,7 +32,7 @@ generate_export_header(depA)
add_library(depB SHARED depB.cpp)
generate_export_header(depB)
target_link_libraries(depB LINK_PRIVATE depA)
target_link_libraries(depB LINK_PRIVATE depA LINK_PRIVATE depA)
add_library(libgenex SHARED libgenex.cpp)
generate_export_header(libgenex)
@ -44,11 +44,11 @@ set_property(TARGET depB APPEND PROPERTY
add_library(depC SHARED depC.cpp)
generate_export_header(depC)
target_link_libraries(depC LINK_PUBLIC depA)
target_link_libraries(depC LINK_PUBLIC depA LINK_PUBLIC depA)
assert_property(depA LINK_INTERFACE_LIBRARIES "")
assert_property(depB LINK_INTERFACE_LIBRARIES "")
assert_property(depC LINK_INTERFACE_LIBRARIES "depA")
assert_property(depC LINK_INTERFACE_LIBRARIES "depA;depA")
add_executable(targetA targetA.cpp)