[cmake-developers] [CMake 0013767]: Unix Makefiles + MSVC = cannot link

Mantis Bug Tracker mantis at public.kitware.com
Fri Nov 30 20:29:45 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13767 
====================================================================== 
Reported By:                Pau Garcia i Quiles
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13767
Category:                   (No Category)
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-11-30 20:29 EST
Last Modified:              2012-11-30 20:29 EST
====================================================================== 
Summary:                    Unix Makefiles + MSVC = cannot link
Description: 
A heated discussion on adopting CMake or not arised a few weeks ago in the
mingw-w64 project:

http://thread.gmane.org/gmane.comp.gnu.mingw.w64.general/6338

Most of the issues pointed there are not real issues but lack of knowledge
and/or the usual complaints ("I need CMake in order to compile a project that
uses CMake").

Today Jonathan Yong did show one real issue: trying to use Unix Makefiles with
MSVC.


Steps to Reproduce: 

This is what I have noticed:

* From the CMake GUI, even if you say "I will specify compilers" and select
cl.exe for both C and C++, CMake will not find the resource compiler (rc.exe, 
apparently CMake is not looking in the Windows SDK folder), the linker
(link.exe, apparently it's not looking for it where cl.exe is) and make.exe
(CMake should look for Cygwin's and MinGW's, although it's going to be mostly a
wild-guess)

* Even if specifying everything from the command line, linkage will not work
because the library search directories have not been specified in either
CMAKE_C_FLAGS, CMAKE_CXX_FLAGS or CMAKE_LINKER_FLAGS. What's missing is
something like "/link /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\lib /LIBPATH:C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib"
(remove the "/link" for CMAKE_LINKER_FLAGS).

Yes, I know, Unix Makefiles on Windows with MSVC!? :-)


Additional Information: 
Sample huge command line that fails:

cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER="C:/Program Files (x86)/Microsoft
Visual Studio 10.0/VC/bin/cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files
(x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe"
-DCMAKE_RC_COMPILER="C:/Program Files (x86)/Microsoft
SDKs/Windows/v7.1A/Bin/RC.Exe" -DCMAKE_LINKER="C:/Program Files (x86)/Microsoft
Visual Studio 10.0/VC/bin/link.exe"
-DCMAKE_MAKE_PROGRAM="C:/mingw32/bin/mingw32-make.exe" ../xdelta3

See attache file error.txt for the full output
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-11-30 20:29 Pau Garcia i QuilesNew Issue                                   

2012-11-30 20:29 Pau Garcia i QuilesFile Added: error.txt                       

======================================================================




More information about the cmake-developers mailing list