MantisBT - CMake
View Issue Details
0013767CMake(No Category)public2012-11-30 20:292016-06-10 14:31
Pau Garcia i Quiles 
Kitware Robot 
normalmajoralways
closedmoved 
Unix MakefilesWindowsAll
CMake 2.8.10.1 
 
0013767: Unix Makefiles + MSVC = cannot link
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.

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!? :-)
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
No tags attached.
txt error.txt (3,156) 2012-11-30 20:29
https://public.kitware.com/Bug/file/4578/error.txt
Issue History
2012-11-30 20:29Pau Garcia i QuilesNew Issue
2012-11-30 20:29Pau Garcia i QuilesFile Added: error.txt
2016-06-10 14:28Kitware RobotNote Added: 0042165
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042165)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.