I use scons to output a MSVS project, using the (trimmed down) example below:
applicationProgramRelease = envRelease.Program(source = releaseObjs, target = "build/release.exe")
applicationProgramDebug = envDebug.Program(source = debugObjs, target = "build/debug.exe")
# generate msvs project
project = env.MSVSProject(target = 'application' + env['MSVSPROJECTSUFFIX'],
srcs = (Glob('source/*.cpp', strings=True)),
incs = (Glob('include/*.hpp', strings=True)),
buildtarget = applicationProgramDebug + applicationProgramRelease,
variant = ['debug', 'release'])
This generates a project, with both a debug and release build target. However it seems to ignore the multiple build targets inside the .vcxproj.
Inside visual studio I can build for both debug and release, which seems to work just fine, apart from the fact that in both in debug and release it launches the release.exe. Taking a close look at the .vcxproj I discovered that the NMakeOutput tag is containing the wrong executable
Below is the NMakeOutput tag for the release build target:
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">C:\OfflineProjects\scons\scons3_multipletargets\build\release.exe</NMakeOutput>
Which is correct as the release target should lauch release.exe. This is the tag for the debug build target:
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">C:\OfflineProjects\scons\scons3_multipletargets\build\release.exe</NMakeOutput>
As you can see; the debug target launches release.exe which is wrong! Is this problem related to my Scons syntax, or is this an actual error inside the framework?
It's a problem with your SCons/Builder syntax. You want to specify the "runfile" parameter as well, for your two separate variants "Debug" and "Release". See also the description of the MSVSProject Builder in the Appendix B of the UserGuide http://www.scons.org/doc/production/HTML/scons-user.html .