[CMake] Some issues with visual studio

Michael Stürmer m.stuermer at pmdtec.com
Mon Jan 9 05:51:00 EST 2012


------------------------------

Message: 2
Date: Sun, 8 Jan 2012 21:52:05 -0700
From: James Bigler <jamesbigler at gmail.com>
Subject: Re: [CMake] Some issues with visual studio
To: Renato Utsch <renatoutsch at gmail.com>
Cc: cmake at cmake.org
Message-ID:
	<CA+77nZDtv4G9kgzFsCyUu=FPSxhe-T3GrxHec3wR6DW5n6YipQ at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Sun, Jan 8, 2012 at 7:29 AM, Renato Utsch <renatoutsch at gmail.com> wrote:

> Hello, I have been experimenting some issue with visual studio and
> couldn't fix them, even when searching in google for help :O
>
> So, I have 2 main issues:
>
> 1. When CMake creates the visual studio solution, it configures to the
> "Debug win32" mode, but I wanted to be able to choose from "Release"
> to "Debug".
> Changing the CMAKE_BUILD_TYPE to "Release" didn't seem to help...
>
>
>
This can't be configured by CMake, because the current configuration is
stored in a binary format file along side the solution file.  This file
contains all sorts of things such as all the arguments for the Debugger
panel.  I don't remember what the name of the file is offhand, because I'm
not at my windows machine at the moment.  This file is created after you
first open the solution file.  What this means, though is there really
isn't a good way for CMake to change what the default build configuration
is.

As far as I can tell VS just picks the first configuration.  I don't know
if it's simply an alphabetical choice or the first configuration in the
projects.  Some simple experiments with hand modifying the project files
could yield the answer.  If it's based on the order in the project files,
CMake could be able to write the files differently, but if VS is being
clever and simply sorting them in ASCII order then it's game over.

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120108/796b9e47/attachment-0001.htm>

------------------------------

I had quite a fight to convince Visual Studio to set the execution folders to the folders where I put the binaries. I found some configuration files and managed to change the defaults. Maybe your problem can be solved by editing the same or similar files. In the folder

C:\Users\<USERNAME>\AppData\Local\Microsoft\MSBuild\v4.0

I found the files 

Microsoft.Cpp.Win32.user.props
Microsoft.Cpp.x64.user.props

Which contain all the default configurations for newly created projects. By creating some content like

  <PropertyGroup>
    <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
  </PropertyGroup>

I managed that the debugger working directory will always be the directory where the binary resides. Originally this would always be corresponding project dir, but if you collect all binaries in a common dir by using CMAKE_RUNTIME_OUTPUT_DIRECTORY you have to change the working dir.

I don't have the documentation for the props-files at hand right now, but it shouldn't be a problem for you to find it on the msdn pages.




More information about the CMake mailing list