소스 검색

BUG: fix a problem where it tried to link .dll.lib files

Bill Hoffman 19 년 전
부모
커밋
46f8ed0648
6개의 변경된 파일41개의 추가작업 그리고 2개의 파일을 삭제
  1. 12 0
      Source/CMakeLists.txt
  2. 7 2
      Source/cmOrderLinkDirectories.cxx
  3. 7 0
      Tests/LibName/CMakeLists.txt
  4. 3 0
      Tests/LibName/bar.c
  5. 5 0
      Tests/LibName/foo.c
  6. 7 0
      Tests/LibName/foobar.c

+ 12 - 0
Source/CMakeLists.txt

@@ -403,6 +403,18 @@ IF(BUILD_TESTING)
     ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
     ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
     ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
     ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
 
 
+  ADD_TEST(LibName ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMake_SOURCE_DIR}/Tests/LibName"
+    "${CMake_BINARY_DIR}/Tests/LibName"
+    --build-two-config
+    --build-generator ${CMAKE_TEST_GENERATOR}
+    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+    --build-project LibName 
+    --build-run-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
+    --test-command foobar
+    )
+
   ADD_TEST(CustomCommand  ${CMAKE_CTEST_COMMAND}
   ADD_TEST(CustomCommand  ${CMAKE_CTEST_COMMAND}
     --build-and-test
     --build-and-test
     "${CMake_SOURCE_DIR}/Tests/CustomCommand"
     "${CMake_SOURCE_DIR}/Tests/CustomCommand"

+ 7 - 2
Source/cmOrderLinkDirectories.cxx

@@ -463,7 +463,10 @@ bool cmOrderLinkDirectories::DetermineLibraryPathOrder()
 #ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
 #ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
     fprintf(stderr, "Raw link item [%s]\n", this->RawLinkItems[i].c_str());
     fprintf(stderr, "Raw link item [%s]\n", this->RawLinkItems[i].c_str());
 #endif
 #endif
-    if(cmSystemTools::FileIsFullPath(this->RawLinkItems[i].c_str()))
+    // check to see if the file is a full path or just contains 
+    // a / in it and is a path to something
+    if(cmSystemTools::FileIsFullPath(this->RawLinkItems[i].c_str())
+      || this->RawLinkItems[i].find("/") != cmStdString.npos)
       {
       {
       if(cmSystemTools::FileIsDirectory(this->RawLinkItems[i].c_str()))
       if(cmSystemTools::FileIsDirectory(this->RawLinkItems[i].c_str()))
         {
         {
@@ -486,6 +489,8 @@ bool cmOrderLinkDirectories::DetermineLibraryPathOrder()
           }
           }
         else
         else
           {
           {
+          // A full path to a directory was found as a link item
+          // warn user 
           std::string message = 
           std::string message = 
             "Warning: Ignoring path found in link libraries for target: ";
             "Warning: Ignoring path found in link libraries for target: ";
           message += this->TargetName;
           message += this->TargetName;
@@ -496,7 +501,7 @@ bool cmOrderLinkDirectories::DetermineLibraryPathOrder()
           cmSystemTools::Message(message.c_str());
           cmSystemTools::Message(message.c_str());
           continue;
           continue;
           }
           }
-        }
+        } // is it a directory
       if(!framework)
       if(!framework)
         {
         {
         dir = cmSystemTools::GetFilenamePath(this->RawLinkItems[i]);
         dir = cmSystemTools::GetFilenamePath(this->RawLinkItems[i]);

+ 7 - 0
Tests/LibName/CMakeLists.txt

@@ -0,0 +1,7 @@
+project(LibName)
+set(LIBRARY_OUTPUT_PATH lib)
+add_library(bar SHARED bar.c)
+add_library(foo SHARED foo.c)
+target_link_libraries(foo bar)
+add_executable(foobar foobar.c)
+target_link_libraries(foobar foo)

+ 3 - 0
Tests/LibName/bar.c

@@ -0,0 +1,3 @@
+__declspec(dllexport) void foo()
+{
+}

+ 5 - 0
Tests/LibName/foo.c

@@ -0,0 +1,5 @@
+__declspec(dllimport) void foo();
+__declspec(dllexport)  void bar()
+{
+  foo();
+}

+ 7 - 0
Tests/LibName/foobar.c

@@ -0,0 +1,7 @@
+__declspec(dllimport) void bar();
+
+int main(int ac, char** av)
+{
+  bar();
+  return 0;
+}