Copy cmGlobalVisualStudio11Generator to cmGlobalVisualStudio12Generator
and update version numbers accordingly. Add the VS12 enumeration value.
Add module CMakeVS12FindMake to find MSBuild. Look for MSBuild in its
now-dedicated Windows Registry entry. Teach the platform module
Windows-MSVC to set MSVC12 and document the variable. Teach module
InstallRequiredSystemLibraries to look for the VS 12 runtime libraries.
Teach tests CheckCompilerRelatedVariables, Preprocess, VSExternalInclude,
and RunCMake.GeneratorToolset to treat VS 12 as they do VS 10 and 11.
Inspired-by: Minmin Gong <minmin.gong@gmail.com>
Since commit 328c0f65 (Simplify cmVisualStudio10TargetGenerator source
classification, 2012-03-19) the VS 10 generator uses the
cmGeneratorTarget source classification instead of directly getting the
list of source files from the target. This accidentally dropped the
CMakeLists.txt files from generated projects because they are added too
late for cmGeneratorTarget.
All generator-specific source files must be added to targets prior to
cmGeneratorTarget construction. Refactor addition of the CMakeLists.txt
files with CMake re-run custom commands to take place before normal
generation begins, and therefore early enough to be included in the
cmGeneratorTarget classification.
Implement cmGlobalGenerator::ComputeTargetObjects in the VS generator
to pre-compute all the object file names. Use the results during
generation instead of re-computing it later.
Simplify cmLocalVisualStudioGenerator::ComputeObjectNameRequirements to
loop over the original vector of source files instead of recursively
traversing source groups just to find the same files. Drop from
cmVisualStudio10TargetGenerator::ComputeObjectNames temporary source
group calculation now that it is not needed for computing object names.
Since the parent commit the local generator Version ivar may be
compared for ordering. Convert comparisons:
"==VS10" becomes ">=VS10"
"!=VS10" becomes "< VS10"
to support an explicit enumeration value for VS11 with no change
in behavior.
Move the Version member to the top cmLocalVisualStudioGenerator class
and set it consistently for instances created by all the global
generator versions. Use an enumeration type with values scaled by a
factor of 10 so we can handle VS 7.1 without out-of-order numbers.
VS 7.1 support for SuppressStartupBanner was broken by commit 25116a3c
(Fix CMAKE_VERBOSE_MAKEFILE for VS10 vcxproj files, 2011-10-11) because
it assumed comparison of VS version numbers works. Now it does.
The setlocal/endlocal and errorlevel pattern added by commit 06fcbc47
(VS10: Fix working directory of consecutive custom commands, 2011-04-08)
does not work well in VS 7.1. Restore the original behavior for VS
versions that do not need the new behavior.
The VS 10 msbuild tool uses a single command shell to invoke all the
custom command scripts in a project. Isolate the environment and
working directory of custom commands using setlocal/endlocal. The
form of each command is
set errlev=
setlocal
cd c:\work\dir
if %errorlevel% neq 0 goto :cmEnd
c:
if %errorlevel% neq 0 goto :cmEnd
command1 ...
if %errorlevel% neq 0 goto :cmEnd
...
commandN ...
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & set errlev=%errorlevel%
if %errlev% neq 0 goto :VCEnd
so that all changes to the environment and working directory are
isolated within the script and the return code is preserved.
The Intel Fortran plugin forgets to create the output directory into
which it will write a DLL's import library. Utilize the fix added by
commit f4b3bdc6 (Create an exe's implib output dir for VS, 2009-06-15)
and generalized by commit 764ac980 (Generalize exe implib dir creation
for VS, 2009-06-16). Create a pre-link rule to make the directory.
In VS9 and previous versions, :VCReportError is the goto label
to jump to after a failed custom command. It stops the build
before it tries to go any further.
In VS10, :VCEnd is the correct label to use.
Create a method in the VS generators to provide the correct
line of script to use for each version of Visual Studio.
For more internal details, search for VCEnd in the
C:\Program Files\MSBuild directory.
This converts the CMake license to a pure 3-clause OSI-approved BSD
License. We drop the previous license clause requiring modified
versions to be plainly marked. We also update the CMake copyright to
cover the full development time range.
Until now the VS 10 generator did no Windows command-line escaping and
just did XML escapes. This commit teaches the generator to use the same
command-line escape addition code used by other generators. The script
construction method cmLocalVisualStudioGenerator::ConstructScript need
not do XML escapes. Each VS generator version adds the XML escapes
necessary for that version.
In VS 7,8,9 executable targets we generate a build event to create the
output directory for the import library in case the executable marks
symbols with dllexport (VS forgets to create this directory). This
generalizes computation of the custom command line to support future use
with other VS versions.
add_custom_target() as COMMAND, and cmake will recognize them and replace
them with the actual output path of these executables. Also the dependency
will be added automatically. Test included.
ENH: moved TraceVSDependencies() to the end of GlobalGenerator::Configure(),
so it is done now in one central place
Alex