[cmake-developers] Debug through config/gen inside Visual Studio

csiga.biga at aol.com csiga.biga at aol.com
Thu Sep 15 10:33:14 EDT 2016


Some very interesting things are happening. I am walking through the code with F11, F10, Shift+F10 and trying to understand what’s happening. What really makes this process hard is that occasionally it succeeds generating the Makefile and the exit code is 0. Ultimately if I try to run the generated makefile it terminates with a linker error:

PS C:\Users\Matty> Import-VisualEnvironment -Version 14 -Architecture Win64
PS C:\Users\Matty> cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]
PS C:\Users\Matty> cd .\Build\CMake_Example\NMake\
PS C:\Users\Matty\Build\CMake_Example\NMake> nmake clean

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

PS C:\Users\Matty\Build\CMake_Example\NMake> nmake

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

[ 20%] Building CXX object phys/CMakeFiles/Phys.dir/src/stuff.cpp.obj
stuff.cpp
[ 40%] Building CXX object phys/CMakeFiles/Phys.dir/src/more.cpp.obj
more.cpp
[ 60%] Linking CXX static library Phys.lib
[ 60%] Built target Phys
[ 80%] Building CXX object app/CMakeFiles/Application.dir/src/main.cpp.obj
main.cpp
[100%] Linking CXX executable Application.exe
[100%] Built target Application

Import-VisualEnvironment is a PowerShell Commandlet made by me which essentially calls vcvarsall.bat.

The extra info I gained through the VERBOSE=1 env var is this:

Linking C executable cmTC_14330.exe

        C:\Users\Matty\Build\CMake\VS14\bin\Debug\cmake.exe -E vs_link_exe
  --intdir=CMakeFiles\cmTC_14330.dir --manifests --
  C:\Kellekek\MICROS~1\VISUAL~1\14.0\VC\bin\amd64\link.exe /nologo
  @CMakeFiles\cmTC_14330.dir\objects1.rsp
  @C:\Users\Matty\AppData\Local\Temp\nm32CF.tmp

  Visual Studio Incremental Link with embedded manifests

  Create CMakeFiles\cmTC_14330.dir/manifest.rc

  Create empty: CMakeFiles\cmTC_14330.dir/embed.manifest

  RC Pass 1:

   /foCMakeFiles\cmTC_14330.dir/manifest.res CMakeFiles\cmTC_14330.dir/manifest.rc

  RC Pass 1 failed to run.

However, this part I do not understand. I believe something is not quite consistent within the generation process, sometimes succeeding and somethimes not. Any ideas?


Thanks Brad for the tips thus far,
Máté


Feladó: Brad King
Elküldve: 2016. szeptember 15., csütörtök 15:11
Címzett: csiga.biga at aol.com
Másolatot kap: cmake-developers at cmake.org
Tárgy: Re: [cmake-developers] Debug through config/gen inside Visual Studio

On 09/15/2016 09:04 AM, csiga.biga at aol.com wrote:
> That is exactly what I’m doing. I am generating a VS solution, and
> inside that I setup the debugging environment, but the process I want
> to debug is not the VS solution generation, but the NMake Makefile
> generation process.

Okay, misread your original message.  I've never actually tried that.

> What should I put inside the Environment dialog to make things work?
> Even when it’s empty, it finds cl.exe, but cmake fails trying to use it.

Add "VERBOSE=1" to the environment to get a little more output about
the "RC Pass 1 failed to run" failure.

-Brad


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160915/412aad40/attachment.html>


More information about the cmake-developers mailing list