|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0008884||CMake||Modules||public||2009-04-14 05:50||2016-06-10 14:30|
|Assigned To||Bill Hoffman|
|Platform||Visual Studio 2008||OS||OS Version|
|Target Version||Fixed in Version|
|Summary||0008884: Set Visual Studio project "custom environment variables" setting with CMake|
In Visual Studio, you can add custom environment variables that will
exist if you run your application from visual studio. They are at
Setting these is especially useful to add the correct (Debug/Release) include paths to your project.
My project needs to have a debug version of ITKCommon.dll in its PATH
when running in Debug mode and a Release version of the DLL in Release
mode respectively. Otherwise it will crash with a
Manually setting the project environment setting to
"PATH=%ITK_DIR%\bin\$(OutType);%PATH%" allows me to automatically use
the correct path, as is suggested in the VTK FAQ
KWidget_using_Visual_Studio>). But the next CMake run will overwrite this setting. Therefore, a posibility to set this with CMake would be really useful. Other use cases exist too. For example, it can be used to set other environment variables as well, that could be read by the application.
|Tags||No tags attached.|
Bill Hoffman (manager)
|I am not sure if this is possible. I think those env vars are stored globally maybe in some registry entry, not sure, but I don't think they are in the project files.|
Mateusz Loskot (reporter)
I believe it is possible and it should be fairly straightforward.
This setting is stored in user-specific configuration file: PROJECT.vcproj.DOMAINNAME.USER.user
(I'm not sure but this form should work as well: PROJECT.vcproj.user)
Here is explantion of .user file template for CMake:
Mateusz Loskot (reporter)
There is related bug report in CMake database:
It is definitely possible to store custom environment variables per project in the project files.
They are stored in a file with the following naming scheme at the same folder as the .vcproj file: [project name].vcproj.[user domain].[user name].user
To set them with the VS GUI:
They will become active when the project is executed.
Mateusz Loskot (reporter)
|@jneuhaus I know well that it's possible to configure environment for Visual Studio projects using GUI of the IDE. What I'm interested in is exactly what is requested in this feature request: Set Visual Studio project "custom environment variables" setting with CMake.|
Patrick Moseley (reporter)
We have the case of using CMake in a cross platform environment and would like to have this functionality not only for Visual Studio, but for Eclipse and XCode as well.
Rather than coming up with something for each of the different generators for the different platforms, it would be nice to have a CMake command that would allow you to set locations of additional "shared libraries" needed to execute the application built with CMake inside the various IDEs supported as generator targets. So on Windows (Visual Studio) it would add the directories to the PATH environment variable, on Unix (Eclipse) it would set the LD_LIBRARY_PATH, and on Mac (XCode) it would set the DYLD_LIBRARY_PATH environment variable.
Our project needs the correct Debug/Release version of multiple DLLs.
VS allows to use the keyword '$(OutType)' in the custom PATH setting. It will be replaced by Debug/Release when the executable is started by Visual Studio. Therefore, we can simply switch between Debug/Release configuration in Visual Studio and it will find the correct DLLs.
Another use case is that we want to set certain environment variables with different values for different executable projects in the same solution.
It would be nice, if CMake would allow to set the custom environment variables, so that we do not have to re-set them after cmake re-generates the project.
Andrew Hill (reporter)
Relates to (or duplicates) 2582 if following Patrick Moseley's suggestion
Kitware Robot (administrator)
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.
|2009-04-14 05:50||jneuhaus||New Issue|
|2009-09-14 14:06||Bill Hoffman||Status||new => assigned|
|2009-09-14 14:06||Bill Hoffman||Assigned To||=> Bill Hoffman|
|2009-09-14 14:07||Bill Hoffman||Note Added: 0017457|
|2009-09-29 06:21||Mateusz Loskot||Note Added: 0017814|
|2009-09-29 06:24||Mateusz Loskot||Note Added: 0017815|
|2009-10-08 08:35||jneuhaus||Note Added: 0018025|
|2009-10-08 14:40||Mateusz Loskot||Note Added: 0018040|
|2009-10-09 15:19||Patrick Moseley||Note Added: 0018053|
|2009-10-12 04:23||jneuhaus||Note Added: 0018057|
|2012-02-01 23:15||Andrew Hill||Note Added: 0028444|
|2012-02-01 23:16||Andrew Hill||Note Edited: 0028444|
|2012-02-01 23:19||Andrew Hill||Note Deleted: 0028444|
|2012-02-01 23:22||Andrew Hill||Note Added: 0028445|
|2016-06-10 14:27||Kitware Robot||Note Added: 0041542|
|2016-06-10 14:27||Kitware Robot||Status||assigned => resolved|
|2016-06-10 14:27||Kitware Robot||Resolution||open => moved|
|2016-06-10 14:30||Kitware Robot||Status||resolved => closed|
|Copyright © 2000 - 2018 MantisBT Team|