From 4591e41a62233feb8b0b23524459444d6ce63c50 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Apr 2002 15:28:43 -0400 Subject: [PATCH] BUG: add link directories for target link libraries and add a test for it --- Source/cmTargetLinkLibrariesCommand.cxx | 13 ++++++++++++- Tests/Simple/CMakeLists.txt | 2 ++ Tests/Simple/simple.cxx | 2 ++ Tests/Simple/simpleLib.cxx | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Tests/Simple/simpleLib.cxx diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 50396e549..e6d768990 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -49,7 +49,18 @@ bool cmTargetLinkLibrariesCommand::InitialPass(std::vector const& a m_Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(), cmTarget::GENERAL); } - } + // if this is a library that cmake knows about, and LIBRARY_OUTPUT_PATH + // is not set, then add the link directory + const char* ldir = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"); + if (cmSystemTools::IsOff(ldir)) + { + const char* dir = m_Makefile->GetDefinition(i->c_str()); + if( dir ) + { + m_Makefile->AddLinkDirectory( dir ); + } + } + } return true; } diff --git a/Tests/Simple/CMakeLists.txt b/Tests/Simple/CMakeLists.txt index cb2452b9d..d42728d93 100644 --- a/Tests/Simple/CMakeLists.txt +++ b/Tests/Simple/CMakeLists.txt @@ -1,3 +1,5 @@ # a simple test case PROJECT (simple) ADD_EXECUTABLE (simple simple.cxx) +ADD_LIBRARY(simpleLib STATIC simpleLib.cxx) +TARGET_LINK_LIBRARIES(simple simpleLib) diff --git a/Tests/Simple/simple.cxx b/Tests/Simple/simple.cxx index 1482f27e5..ef26e7984 100644 --- a/Tests/Simple/simple.cxx +++ b/Tests/Simple/simple.cxx @@ -1,4 +1,6 @@ +extern void simpleLib(); int main () { + simpleLib(); return 0; } diff --git a/Tests/Simple/simpleLib.cxx b/Tests/Simple/simpleLib.cxx new file mode 100644 index 000000000..281d8885a --- /dev/null +++ b/Tests/Simple/simpleLib.cxx @@ -0,0 +1,3 @@ +void simpleLib() +{ +}