Currently it only adds the contents of the COMPILE_FLAGS target
property, but it can be extended to handle a new COMPILE_OPTIONS
generator expression enabled property.
Generate the default AssemblerListingLocation through the flag map so
that it can be overridden by a user /Fa flag. Also teach the VS 7-9
generators to map /Fa to AssemblerListingLocation.
While at it, fix the AssemblerListingLocation default value to have a
trailing slash after the configuration name. This ensures it will be
treated as a directory and not a file name.
Add support to maintain designer functionality for Visual Studio C++
Windows Forms projects. Also add a test project showing how to use
the CMakeLists.txt file and, when successfully configured, will allow
use of the designer for the included form.
The MS tools create two types of PDB files as explained here:
http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.71%29.aspxhttp://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.80%29.aspxhttp://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.90%29.aspxhttp://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.100%29.aspx
One is created by the compiler (/Fd) and the other by the linker (/pdb).
The two options should not specify the same file. Split them up.
In the VS IDE generators, simply drop ProgramDataBaseFileName to
take the VS default "/Fd$(IntDir)vc$(PlatformToolsetVersion).pdb".
In the Makefile generators, set "/Fd" on the compile line to be
the directory containing object files (with a trailing slash the
compiler will add the "vc$(PlatformToolsetVersion).pdb" filename
automatically). Drop the /Fd option from the exe link command
line and add "/pdb" instead (already done for dll linking).
Update these rules for both MSVC and Intel tools.
Drop support for PDB_OUTPUT_DIRECTORY and PDB_NAME in STATIC
libraries because the generated .pdb files are only from /Fd
and not real linker-generated .pdb files. Update documentation to
clarify that the PDB_* properties are only for linker .pdb files.
This regresses the PDBDirectoryAndName test for STATIC libraries.
Since it is not clear at this time what should be done for STATIC
library .pdb files, comment out the relevant portion of the test
and leave a TODO comment.
The API for retrieving per-config COMPILE_DEFINITIONS has long
existed because of the COMPILE_DEFINITIONS_<CONFIG> style
properties. Ensure that the provided configuration being generated
is also used to evaluate the generator expressions
in cmTarget::GetCompileDefinitions.
Both the generic COMPILE_DEFINITIONS and the config-specific
variant need to be evaluated with the requested configuration. This
has the side-effect that the COMPILE_DEFINITIONS does not need to
be additionally evaluated with no configuration, so the callers can
be cleaned up a bit too.
Use the /STACK: flag to pass the value through flag parsing so that the
generator converts it to the StackReserveSize project file option. The
option was accidentally left out by commit 7491f529 (first pass at VS
10, 2009-06-25).
Suggested-by: goatboy160@yahoo.com
Since commit 9a6ff950 (Fix for bug where VS2010 did not use .obj files as
part of the build, 2011-04-01) and commit b291d9e7 (VS10: Fix external
objects generated outside target, 2012-03-19) we try to detect whether an
external object file is also a custom command output in the same target.
This is because VS10 includes .obj custom command outputs on the link line
by default.
VS 11 supports a "<LinkObjects ...>false</LinkObjects>" setting in custom
command rules to tell VS not to link the outputs. From the VS help:
Specify whether the Inputs and output files with specific extensions (.obj,
.lib, .res, .rsc) are passed to the linker.
Treat all external object files the same and add "<Object>" settings for them.
This is not ambiguous to the compiler, but it may seem ambiguous to
the reader.
From reading 3a53005f (Build object library targets in VS), 5484550a
(Detect and set Unicode character set in VS 10), and 9e01aefd (VS:
Add support for WinRT project properties (#12930)), this appears to
be the intentional semantic.
Fix the VS 10 link flag map to name the project file entries correctly.
The VS 11 link flag map already has the correct names. Generate the
entries in the <PropertyGroup> along with incremental linking options.
Drop them from the <Link> element because VS does not use them.
Avoid collecting the link options twice. Collect them once in a
LinkOptions member and use it from both places. We already do this for
compiler options with the ClOptions member.
Commit 08cb4fa4 (Process generator expressions in the
INCLUDE_DIRECTORIES property, 2012-09-18) contained an incorrect
assumption that CMAKE_BUILD_TYPE was set on the makefile for each
generated configuration in multi-config generators. Fix that by making
the GetIncludeDirectories API depend on the config.
2ccca05 Run PDBDirectoryAndName test on MSVC and Intel
efc83b3 Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6
b294457 Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test
3f60dbf Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
This enables changing the name and output folder of the debug symbol
files produced by MS compilers.
Inspired-by: Thomas Bernard <thomas.bernard@ipetronik.com>
Run cmparseMSBuildXML.py on cl.xml, lib.xml, and link.xml to generate
our flag tables:
python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/V110/1033/cl.xml" > cmVS11CLFlagTable.h
python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/V110/1033/lib.xml" > cmVS11LibFlagTable.h
python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/V110/1033/link.xml" > cmVS11LinkFlagTable.h
Fix up the declaration names at the top of each file. Finally, teach
cmVisualStudio10TargetGenerator to select the version of the table
matching the version of VS.
In VS 11 the WindowsAppContainer element enabled by the
VS_WINRT_EXTENSIONS property activates precompiled header support
automatically if no PrecompiledHeader setting is specified. For VS 10 and
11 set PrecompiledHeader to "NotUsing" explicitly by default unless
overridden by a project-specified flag.
Suggested-by: Eugene Golushkov <eugene_gff@ukr.net>
Since commit 9e01aefd (VS: Add support for WinRT project properties,
2012-02-03) CMake generates for VS 11 projects the 'Immersive' element
for the VS_WINRT_EXTENSIONS target property. That was based on the VS
11 preview version. The final version renamed the element to
'WindowsAppContainer', so generate that instead.
Suggested-by: Eugene Golushkov <eugene_gff@ukr.net>
Since commit ed0075bd (Use relative paths for custom command inputs,
2011-06-22) CMake generates full paths to source files in VS 10 project
files to avoid trouble with deep source/build tree paths. However, the VS
10 IDE will not populate the source file property dialog for a file
referenced by full path. Instead use a relative path when possible. When
not possible produce a detailed warning explaining the problem and
suggesting use of shorter directory paths.
CMake <= 2.8.4 generated VS 10 project files with a relative path to
source files. Then commit ed0075bd (Use relative paths for custom command
inputs, 2011-06-22) switched to using relative paths only for source files
holding custom commands and full paths for other sources. This behavior
was inhereted by the VS 11 generator but is not needed so use the
workaround only for exactly VS 10. Explain the behavior in comments.
Most CMake generators produce relative paths within the build tree and
full paths to files outside the build tree. Make VS 10 and VS 11
project files consistent with this approach except for paths forced to
be relative to work around a VS 10 bug.
Remove the duplicate source file classification logic used to generate
the filter files. Instead record during the main vcxproj file
generation the source files generated for each tool. Also record
whether or not each source file is converted to a relative path. Use
the recorded result during filter generation to ensure consistency
between the project file and filter file.
Hide custom command .rule files inside the CMakeFiles directory. Ensure
a short, deterministic, and unique name by using a hash of the directory
path containing the output file. Preserve the file name so the entry in
the IDE is human-readable. Clarify the comment that explains why the
rule file must be created on disk.
Teach cmMakefile::AddCustomCommandToOutput to return the cmSourceFile
instance to which the custom command is attached. Use the return value
instead of separately adding a .rule extension and searching for the
source. Mark CMake-generated .rule files explicitly with a property
instead of trusting the file extension.
Commit 9a6ff950 (Fix for bug where VS2010 did not use .obj files,
2011-04-01) assumed that if an external object is GENERATED that it is
the output of a custom command in the current target. If it is
generated by another target then VS will not automatically include the
external object in the current target. This bug was preserved by the
refactoring in the parent commit.
Instead use <None> for external objects generated by a custom command in
the current target and <Object> for all other external objects. Update
the ExternalOBJ test to cover this case.
Combine WriteCLSources and WriteObjSources into a single method. Use
the cmGeneratorTarget source classification to simplify tool selection
for each source file. Extend the classification to handle .idl files.
For now do not allow an OBJECT library to reference other object
libraries. Teach cmTarget::ComputeLinkImplementation to include the
languages of object libraries used by a target.
Treat OBJECT libraries as STATIC libraries. The VS project file format
provides no way to avoid running the librarian so hide the resulting
.lib away next to the object files as it should never be referenced.
The object files will be left behind for reference by other targets
later.
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.