[CMake] Debug vs Release "install" area

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri May 13 22:02:58 EDT 2016


On 2016-05-12 20:07-0000 Scott Aron Bloom wrote:

> Looking for some advice.
>
> In order to make our Visual Studio debugging environment, as self-contained (and easy to use for the developers) as possible, we use developers must run an install.  We also use the resulting release based Install for our packaging into our installer.
>
> We change the prefix variable CMAKE_INSTALL_PREFIX, to  ${CMAKE_BINARY_DIR}/Install, as well as having a each application call a function that places a .user.vcxproj that sets the PATH appropriately.
>
> It really works great, except there is one caveat.  VC++ has libraries that are debug vs release dependent, so if your debug build happens to pick up a release DLL (or vice versa) you can (will) be in trouble in random ways.
>
> Typically, when I change over, I simply delete the install, and re-install.
>
> Ideally, I would like to know is there any way to set the CMAKE_INSTALL_PREFIX variable separately for debug vs release? If so how?
>
> A second option, which I thought of...
>
> Is to generate a file "DEBUG.BUILD.TXT" and then at the START of the installation process, run a script for debug builds, that says if the file doesn't exist, delete everything and carry on.  If running for a release install, if it DOES exist delete and carry on.
>
>
> Any thoughts on this?

Can't help you with a Visual studio environment, but for the "Unix
Makefiles" generator (and presumably also for the "NMake Makefiles"
generator) you typically set CMAKE_INSTALL_PREFIX to an initially
empty install tree when you invoke the cmake command from an intially
empty build tree.  So you have complete control over the names you
pick for both the build-tree and install-tree, and you typically
choose unique names of those for each different build configuration
(such as release or debug).  I suspect it is also trivial to have
separate sets of the combination of build tree + install tree name for
each different type of build in a Visual Studios environment, but I
cannot give you specific advice about how to find that "trivial"
answer.  :-)

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list