summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx25
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h6
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt3
3 files changed, 22 insertions, 12 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 21acf80..0bccd27 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -64,15 +64,22 @@ bool cmTargetLinkLibrariesCommand
// add libraries, nothe that there is an optional prefix
// of debug and optimized than can be used
- std::vector<std::string>::const_iterator i = args.begin();
-
- for(++i; i != args.end(); ++i)
+ for(unsigned int i=1; i < args.size(); ++i)
{
- if(*i == "INTERFACE")
+ if(args[i] == "LINK_INTERFACE_LIBRARIES")
{
this->DoingInterface = true;
+ if(i != 1)
+ {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "The LINK_INTERFACE_LIBRARIES option must appear as the second "
+ "argument, just after the target name."
+ );
+ return true;
+ }
}
- else if(*i == "debug")
+ else if(args[i] == "debug")
{
if(haveLLT)
{
@@ -81,7 +88,7 @@ bool cmTargetLinkLibrariesCommand
llt = cmTarget::DEBUG;
haveLLT = true;
}
- else if(*i == "optimized")
+ else if(args[i] == "optimized")
{
if(haveLLT)
{
@@ -90,7 +97,7 @@ bool cmTargetLinkLibrariesCommand
llt = cmTarget::OPTIMIZED;
haveLLT = true;
}
- else if(*i == "general")
+ else if(args[i] == "general")
{
if(haveLLT)
{
@@ -103,7 +110,7 @@ bool cmTargetLinkLibrariesCommand
{
// The link type was specified by the previous argument.
haveLLT = false;
- this->HandleLibrary(i->c_str(), llt);
+ this->HandleLibrary(args[i].c_str(), llt);
}
else
{
@@ -129,7 +136,7 @@ bool cmTargetLinkLibrariesCommand
llt = cmTarget::OPTIMIZED;
}
}
- this->HandleLibrary(i->c_str(), llt);
+ this->HandleLibrary(args[i].c_str(), llt);
}
}
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 6a9c0f4..cc37608 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -64,7 +64,7 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " target_link_libraries(<target> [INTERFACE]\n"
+ " target_link_libraries(<target> [lib1 [lib2 [...]]]\n"
" [[debug|optimized|general] <lib>] ...)\n"
"Specify a list of libraries to be linked into the specified target. "
"If any library name matches that of a target in the current project "
@@ -90,7 +90,9 @@ public:
"See the LINK_INTERFACE_LIBRARIES target property to override the "
"set of transitive link dependencies for a target."
"\n"
- "The INTERFACE option tells the command to append the libraries "
+ " target_link_libraries(<target> LINK_INTERFACE_LIBRARIES\n"
+ " [[debug|optimized|general] <lib>] ...)\n"
+ "The LINK_INTERFACE_LIBRARIES mode appends the libraries "
"to the LINK_INTERFACE_LIBRARIES and LINK_INTERFACE_LIBRARIES_DEBUG "
"target properties instead of using them for linking. "
"Libraries specified as \"debug\" are appended to the "
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index f0c9017..5955307 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -54,7 +54,8 @@ add_library(testLib4libopt STATIC testLib4libdbg.c testLib4libopt${VS6}.c)
set_property(TARGET testLib4libdbg PROPERTY COMPILE_DEFINITIONS LIB_DBG)
set_property(TARGET testLib4libopt PROPERTY COMPILE_DEFINITIONS LIB_OPT)
target_link_libraries(testLib4
- INTERFACE testLib4lib debug testLib4libdbg optimized testLib4libopt
+ LINK_INTERFACE_LIBRARIES
+ testLib4lib debug testLib4libdbg optimized testLib4libopt
)
add_executable(testExe3 testExe3.c)