[CMake] Building a Windows project in both 32- and 64-bit mode using the nmake generator.

Nils Gladitz nilsgladitz at gmail.com
Thu May 1 10:27:22 EDT 2014


On 01.05.2014 15:54, Rick McGuire wrote:
>
> Is it possible to get cmake to check the actual compile/link commands 
> when they are issued?  I'd love to compare the cmake versions to our 
> existing build to see if things are ending up the same.

To a degree (response files on window limit the output in some cases); 
see below.

> Creating a minimal self-contained test case would not be easy.  This 
> is an open source project though, if you're willing to try checking it 
> out.  The svn url is svn http://svn.code.sf.net/p/oorexx/code-0/main/trunk
>

I was able to build the project with these steps:
     - Open the "VS2013 x64 Cross Tools Command Prompt"
     - Add  target_link_libraries(rexxapi ws2_32) to the end of 
CMakeLists.txt
     - Create a "build" directory in the source directory
     - Run "cmake -G NMake Makefiles .." from the build directory
     - Run nmake VERBOSE=1

The command for the link this generates on my system is:
C:\PROGRA~2\MICROS~2.0\VC\bin\X86_AM~1\link.exe /nologo 
@CMakeFiles\rexxapi.dir\objects1.rsp /out:..\CMakeFiles\bin\rexxapi.dll 
/implib:..\CMakeFiles\bin\rexxapi.lib 
/pdb:C:\Users\ngladitz\src\main\CMakeFiles\bin\rexxapi.pdb /dll 
/version:0.0 /machine:x64 /debug /INCREMENTAL ws2_32.lib kernel32.lib 
user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib 
uuid.lib comdlg32.lib advapi32.lib /MANIFEST 
/MANIFESTFILE:..\CMakeFiles\bin\rexxapi.dll.intermediate.manifest 
..\CMakeFiles\bin\rexxapi.dll.embed.manifest.res

The link is successful.

Some of the project's setup looks unorthodox.
Specifically:
     - outputting binaries in the sources directory rather than the 
build directory (this might break parallel build directories or being 
able to purge build directories since they would not contain all artifacts)
     - using a directory called CMakeFiles for the output (which in in 
source-tree builds would belong to cmake and should not be used by the 
project)
     - The two platform dependent add_library() calls could be merged 
into a single call that uses a list variable for the platform specific 
sources. The redundant listing looks error prone.

Nils


More information about the CMake mailing list