Browse Source

BUG: add link directories for target link libraries and add a test for it

Bill Hoffman 23 years ago
parent
commit
4591e41a62

+ 12 - 1
Source/cmTargetLinkLibrariesCommand.cxx

@@ -49,7 +49,18 @@ bool cmTargetLinkLibrariesCommand::InitialPass(std::vector<std::string> const& a
       m_Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),
       m_Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),
                                           cmTarget::GENERAL);  
                                           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;
   return true;
 }
 }
 
 

+ 2 - 0
Tests/Simple/CMakeLists.txt

@@ -1,3 +1,5 @@
 # a simple test case
 # a simple test case
 PROJECT (simple)
 PROJECT (simple)
 ADD_EXECUTABLE (simple simple.cxx)
 ADD_EXECUTABLE (simple simple.cxx)
+ADD_LIBRARY(simpleLib STATIC simpleLib.cxx)
+TARGET_LINK_LIBRARIES(simple simpleLib)

+ 2 - 0
Tests/Simple/simple.cxx

@@ -1,4 +1,6 @@
+extern void simpleLib();
 int main ()
 int main ()
 {
 {
+  simpleLib();
   return 0;
   return 0;
 }
 }

+ 3 - 0
Tests/Simple/simpleLib.cxx

@@ -0,0 +1,3 @@
+void simpleLib()
+{
+}