[cmake-developers] Fwd: cmVisualStudio10TargetGenerator should not generate a rule for an ImportLibrary for executables

Lode Leroy lode.leroy at gmail.com
Mon Nov 28 08:41:08 EST 2016


Please consider the following patch for inclusion in cmake.

The problem is that when a project contains a FOO.DLL and a FOO.EXE,
the cmake generator tries to build FOO.LIB for both.
The FOO.EXE does not need a FOO.LIB.

$ diff -urp CMake-3.7.0-orig/ CMake-3.7.0
Only in CMake-3.7.0: build
diff -urp CMake-3.7.0-orig/Source/cmVisualStudio10TargetGenerator.cxx
CMake-3.7.0/Source/cmVisualStudio10TargetGenerator.cxx
--- CMake-3.7.0-orig/Source/cmVisualStudio10TargetGenerator.cxx
2016-11-11 15:24:18.000000000 +0100
+++ CMake-3.7.0/Source/cmVisualStudio10TargetGenerator.cxx
2016-11-28 14:28:26.344898900 +0100
@@ -2310,7 +2310,9 @@ bool cmVisualStudio10TargetGenerator::Co
     imLib += "/";
     imLib += targetNameImport;

-    linkOptions.AddFlag("ImportLibrary", imLib.c_str());
+    if (this->GeneratorTarget->GetType() != cmState::EXECUTABLE) {
+        linkOptions.AddFlag("ImportLibrary", imLib.c_str());
+    }
     linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());

     // A Windows Runtime component uses internal .NET metadata,


More information about the cmake-developers mailing list