Re: [cmake-developers] Fwd: cmVisualStudio10TargetGenerator should not generate a rule for an ImportLibrary for executables
On 11/28/2016 09:16 AM, Daniel Pfeifer wrote: > On Mon, Nov 28, 2016 at 2:41 PM, Lode Leroy wrote: >> 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. > Please see https://cmake.org/cmake/help/v3.7/prop_tgt/ENABLE_EXPORTS.html Correct. The `ImportLibrary` setting in a `.vcxproj` file only tells the tools where to put the `.lib` file *if* there are exports. No file will be generated unless the project code is using `dllexport` or other means to export a symbol from the executable. To prevent one from showing up, check the project code to make sure it doesn't try to export something. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Fwd: cmVisualStudio10TargetGenerator should not generate a rule for an ImportLibrary for executables
On Mon, Nov 28, 2016 at 2:41 PM, Lode Leroy wrote: > 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.0 +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, > -- > > I am no windows expert, but I think the import library is required when you want to link against the executable. Please see https://cmake.org/cmake/help/v3.7/prop_tgt/ENABLE_EXPORTS.html -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] Fwd: cmVisualStudio10TargetGenerator should not generate a rule for an ImportLibrary for executables
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.0 +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, -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers