Commit Graph

148 Commits

Author SHA1 Message Date
Stephen Kelly fe732264e9 Add the INTERFACE_LIBRARY target type.
This target type only contains INTERFACE_* properties, so it can be
used as a structural node. The target-specific commands enforce
that they may only be used with the INTERFACE keyword when used
with INTERFACE_LIBRARY targets. The old-style target properties
matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for
this target type.

The name of the INTERFACE_LIBRARY must match a validity generator
expression. The validity is similar to that of an ALIAS target,
but with the additional restriction that it may not contain
double colons. Double colons will carry the meaning of IMPORTED
or ALIAS targets in CMake 2.8.13.

An ALIAS target may be created for an INTERFACE library.

At this point it can not be exported and does not appear in the
buildsystem and project files are not created for them. That may
be added as a feature in a later commit.

The generators need some changes to handle the INTERFACE_LIBRARY
targets returned by cmComputeLinkInterface::GetItems. The Ninja
generator does not use that API, so it doesn't require changes
related to that.
2013-10-07 19:56:31 -04:00
Robert Maynard 3064f80d25 VS: Generate ToolsVersion matching each VS version
The MSBuild version for each Visual Studio generator isn't 4.0.  With
Visual Studo 2013 the ToolsVersion moved from being tied to the .NET
framework and now has its own version number.
2013-08-26 10:21:16 -04:00
Patrick Gansterer 28e770cf6e VS10: Add support for assembler code (#11536)
Use the masm BuildCustomizations, which are part of the Visual
Studio installation to allow compilation of asm files.
2013-08-05 16:34:10 +02:00
Brad King e7bcdf856e VS10: Escape include paths in XML project files (#14331)
Fix generation of the AdditionalIncludeDirectories element content to
escape for XML syntax.  We already escape content of other elements,
this one was simply missing by accident.
2013-08-01 15:00:28 -04:00
Brad King b64e8f22a4 VS10: Honor user-specified /SUBSYSTEM: flag (#14326)
Use the WIN32_EXECUTABLE target property only to set the SubSystem build
attribute default.  When user-specified flags are later parsed they may
then override it.
2013-07-31 10:17:17 -04:00
Patrick Gansterer 14bbf8340a Unify the way the flags of a static library are read
Introduce cmLocalGenerator::GetStaticLibraryFlags() to have a central
function for getting the linker flags for a given target.
2013-07-31 08:41:07 -04:00
Stephen Kelly 184121538c Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
Refactor to create AddCompileDefinitions.
2013-07-11 08:23:56 +02:00
Brad King 8a08ab051a Merge topic 'vs12-generator'
9a76d83 VS12: Find proper MSBuild for VSProjectInSubdir test
4e5cb39 Merge branch 'master' into vs12-generator
78fdbbc FindBoost: Add -vc120 mangling for VS 12
e99d7b1 VS12: Generate flag tables from MSBuild v120 tool files
77ac9b8 VS12: Add Visual Studio 12 generator (#14251)
2013-07-01 09:27:33 -04:00
Brad King be9a80a088 Merge topic 'vs-windows-forms'
6c9712c VS: Add Resx configuration to the vcxproj file
2013-07-01 09:18:06 -04:00
Brad King 4e5cb398ae Merge branch 'master' into vs12-generator
Resolve conflicts in Tests/Preprocess/CMakeLists.txt by keeping
the side from 'master'.
2013-06-28 18:29:54 -04:00
Brad King e99d7b1c1f VS12: Generate flag tables from MSBuild v120 tool files
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/v120/1033/cl.xml" > cmVS12CLFlagTable.h
 python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/v120/1033/lib.xml" > cmVS12LibFlagTable.h
 python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/v120/1033/link.xml" > cmVS12LinkFlagTable.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.
2013-06-28 18:13:59 -04:00
Jonas Andersen 6c9712c47b VS: Add Resx configuration to the vcxproj file
In my project group we are using CMake to generate c++/cli winform
projects and I noticed the work done in commit 79ec7868 (VS: Add Windows
Forms Support, 2013-04-29) was in the right direction for solving some
of the problems we were facing.

The changes as submitted was breaking some functionality in our
projects, so I made some changes that fixes our problems and I believe
that it will also work for others.

* Resx files did not link correctly with the winform h-file so I added
  the Resx configuration to the vcxproj file.

* I removed the functionality for setting <CLRSupport> true for the
  project based on if an resx-file is pressent.  This is preventing
  us from using native cpp code.  Also this do not address that some
  projects will need to set other options like clr:pure, clr:safe.
  This could be implemented as a cmake option, so it is possible to
  specify exactly what is needed.  Existing VSWindowsFormsResx Test
  project is updated so it will be working with my changes.
2013-06-28 09:23:41 -04:00
Brad King d221eac812 Refactor target COMPILE_OPTIONS and COMPILE_FLAGS handling
Replace the cmLocalGenerator GetCompileOptions method with an
AddCompileOptions method since all call sites of the former simply
append the result to a flags string anyway.

Add a "lang" argument to AddCompileOptions and move the
CMAKE_<LANG>_FLAGS_REGEX filter into it.  Move the call sites in each
generator to a location that has both the language and configuration
available.  In the Makefile generator this also moves the flags from
build.make to flags.make where they belong.
2013-06-27 12:57:32 -04:00
Brad King 059be4ba3b Merge topic 'add-whitespace'
2331b57 Add whitespace after colons in error messages.
2013-06-24 08:38:12 -04:00
Stephen Kelly 2331b57bec Add whitespace after colons in error messages. 2013-06-21 16:21:44 +02:00
Christian Maaser cfe6300a41 VS: Add support for .NET target framework version
Teach CMake to generate the TargetFrameworkVersion XML node as
documented at

 http://msdn.microsoft.com/en-us/library/vstudio/ff770576.aspx

from target property VS_DOTNET_TARGET_FRAMEWORK_VERSION.
2013-06-14 08:09:00 -04:00
Brad King e57b6a2521 Merge topic 'target-COMPILE_OPTIONS'
24466f2 Add target_compile_options command.
80ca9c4 Add COMPILE_OPTIONS target property.
7cb2308 cmTarget: Rename LinkInterfaceIncludeDirectoriesEntries
47f80d9 cmTarget: Rename struct to be more re-usable.
1319a14 Add <LANG>_COMPILER_ID generator expressions.
3549676 Add cmLocalGenerator::GetCompileOptions.
f3ad863 VS6: Rename some variables to correspond to config values.
2013-06-03 09:57:44 -04:00
Brad King 90441b289d Merge topic 'vs-RootNamespace'
cca955a VS: Add VS_GLOBAL_ROOTNAMESPACE target property
2013-06-03 09:57:32 -04:00
Stephen Kelly 35496761a5 Add cmLocalGenerator::GetCompileOptions.
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.
2013-06-02 11:56:36 +02:00
John Farrier cca955a27c VS: Add VS_GLOBAL_ROOTNAMESPACE target property
Add a setting for Visual Studio projects for the root namespace in the
"Globals" PropertyGroup section of the project file.
2013-05-31 09:15:30 -04:00
Brad King bdb0bab8ee Merge topic 'vs-asm-listing-location'
7e0c45e VS: Allow /Fa to set AssemblerListingLocation (#14153)
2013-05-21 15:14:19 -04:00
Brad King f292ffb62c Merge topic 'vs-windows-forms'
79ec786 VS: Add Windows Forms Support
2013-05-21 15:12:48 -04:00
Brad King 7e0c45e9cf VS: Allow /Fa to set AssemblerListingLocation (#14153)
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.
2013-05-20 08:40:09 -04:00
Brad King 0dc0e7d885 Merge topic 'doc-improvements'
7cc2805 Docs: Clarify wording "flag used" => "flag (to|will) be used"
2378a69 Docs: Clarify that CMAKE_*_(PREFIX|SUFFIX) affect filenames
56ca34d Docs: Update description of CMAKE_(BUILD_TYPE|CONFIGURATION_TYPES)
2bab472 VS10: add detailed comment about MIDL processing
e619111 Explain distribution of Win9x binary on all Windows versions.
5ca4336 FindwxWidgets: add DOC strings with usual style
f57800d Fix spelling and typos (product names)
bf019d7 Fix spelling and typos (non-binary)
ddac8d3 Fix spelling and typos (affecting binary data / module messages)
86832ce Fix spelling and typos (affecting users)
2013-05-16 14:38:07 -04:00
John Farrier 79ec7868d0 VS: Add Windows Forms Support
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.
2013-05-16 13:06:44 -04:00
Andreas Mohr 2bab472ecb VS10: add detailed comment about MIDL processing 2013-05-07 08:42:20 -04:00
Brad King 42ba1b08f3 VS: Separate compiler and linker PDB files (#11899, #14062)
The MS tools create two types of PDB files as explained here:

 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.71%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.80%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.90%29.aspx
 http://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.
2013-04-05 11:25:09 -04:00
Stephen Kelly a6286e92c9 Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
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.
2013-03-25 10:49:22 -04:00
Brad King 308c5a2670 VS 10: Fix CMAKE_<LANG>_STACK_SIZE implementation (#13968)
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
2013-03-04 08:18:28 -05:00
Stephen Kelly 0e10782ba7 Move GetCompileDefinitions to cmTarget. 2013-01-29 14:11:49 -05:00
Brad King b684b39581 VS11: Simplify external object file handling (#13831)
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.
2013-01-07 11:42:53 -05:00
Stephen Kelly 0bbae6f95f Revert "Move GetLinkInformation to cmGeneratorTarget"
As we can't move all linking related code from cmTarget, it makes
sense to reverse the move in some cases.

This reverts commit 4f5384e75c.
2012-11-21 15:49:37 +01:00
Stephen Kelly 21e8a08bcf Resolve ambiguity warning regarding use of && and ||.
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.
2012-11-13 13:26:10 -05:00
Stephen Kelly 9f16d428a1 Resolve warnings about used enum values in switch blocks. 2012-11-13 13:26:10 -05:00
Stephen Kelly bd8bdb6fdd Resolve warnings about unused variables. 2012-11-07 13:45:30 +01:00
Brad King 035e7bd04e VS10: Honor /DELAYSIGN and /KEYFILE flags (#13601)
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.
2012-10-26 11:02:42 -04:00
Brad King c65a2ea6a8 VS10: Refactor link options collection
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.
2012-10-26 10:16:45 -04:00
Stephen Kelly 2a6bd96c13 Fix config-specific INCLUDE_DIRECTORIES in multi-config generators
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.
2012-10-17 16:24:14 -04:00
Brad King 7dce31f3d0 Merge topic 'vs-pdb-output'
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)
2012-10-01 14:05:11 -04:00
Yuchen Deng 3f60dbf148 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>
2012-09-25 15:23:35 -04:00
Stephen Kelly 2c2b25b203 Return a std::string from GetCompileDefinitions. 2012-09-21 13:28:54 +02:00
Stephen Kelly 0ff4e3f0b8 Port remaining code to GetCompileDefinitions(). 2012-09-21 13:28:53 +02:00
Stephen Kelly 290e92ada8 Move GetIncludeDirectories to cmGeneratorTarget. 2012-09-19 15:32:09 +02:00
Stephen Kelly 4f5384e75c Move GetLinkInformation to cmGeneratorTarget 2012-09-19 15:30:57 +02:00
David Cole 4ac85d0776 Merge topic 'vs11-flag-table'
9b2dda5 VS11: Generate flag tables from MSBuild V110 tool files
4cb99b1 cmparseMSBuildXML: Include DisplayName in the output
2012-08-24 14:25:12 -04:00
David Cole 38876a3903 Merge topic 'VS10-PrecompiledHeader-default'
f0ae381 VS: Disable precompiled headers unless enabled by project (#12930)
2012-08-24 14:24:58 -04:00
David Cole a9a3b3b897 Merge topic 'VS11-WinRT-project-issue-12930'
4c9ae47 VS11: Rename 'Immersive' to 'WindowsAppContainer' (#12930)
2012-08-24 14:24:46 -04:00
Brad King 9b2dda5db5 VS11: Generate flag tables from MSBuild V110 tool files
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.
2012-08-22 11:12:32 -04:00
Brad King f0ae381c73 VS: Disable precompiled headers unless enabled by project (#12930)
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>
2012-08-22 08:57:10 -04:00
Brad King 4c9ae472ec VS11: Rename 'Immersive' to 'WindowsAppContainer' (#12930)
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>
2012-08-21 13:02:39 -04:00