Commit Graph

118 Commits

Author SHA1 Message Date
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
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Brad King d931ce9fe0 VS10: Generate relative source paths when possible (#12570)
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.
2012-04-27 14:14:36 -04:00
Brad King b2e7c7aef0 VS11: Do not use source path conversion workaround specific to VS 10
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.
2012-04-27 13:17:16 -04:00
Brad King 4248132e59 VS10: Convert paths normally unless forced to relative
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.
2012-04-27 11:53:40 -04:00
Brad King c2ba6ba4fc VS10: Simplify vcxproj.filter file generation
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.
2012-04-27 10:00:00 -04:00
Brad King 4f2d9d2da5 VS10: Refactor custom commands to use WriteSource
All other source file elements are already written through WriteSource.
Refactor custom command source element generation into WriteSource too.
2012-04-27 09:15:03 -04:00
Brad King 72333a4648 VS10: Avoid creating .rule files next to outputs (#13141)
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.
2012-04-18 15:54:35 -04:00
Brad King f9b758e91a Cleanup custom command .rule file internal handling
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.
2012-04-18 15:48:50 -04:00
Brad King b291d9e756 VS10: Fix external objects generated outside target (#13047)
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.
2012-03-20 09:01:02 -04:00
Brad King 328c0f65c2 Simplify cmVisualStudio10TargetGenerator source classification
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.
2012-03-19 17:13:41 -04:00
Brad King c403f27a2d Add $<TARGET_OBJECTS:...> expression to use an object library
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.
2012-03-16 10:12:15 -04:00
Brad King 3a53005f7d Build object library targets in VS
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.
2012-03-13 14:38:02 -04:00
Brad King d57047de33 Pre-compute object file names before VS project generation
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.
2012-03-09 15:16:02 -05:00
Brad King 62a841b80b Simplify cmVisualStudio10TargetGenerator using cmGeneratorTarget
Use CustomCommands and ModuleDefinitionFile computed in the latter
instead of recomputing them from the original target source files.
2012-03-09 15:16:02 -05:00
Brad King 51b67366ed Merge branch 'cleanup-object-file-names' into object-library 2012-03-09 15:15:37 -05:00
David Cole f55119e63b Merge topic 'fix-12189-support-SBCS-in-VS'
b28e7fa VS6: Avoid SBCS test on VS6 (#12189)
df19b9c VS6: Avoid _MBCS define when _SBCS is defined (#12189)
ba89e92 Visual Studio: Allow setting Single Byte Character Set (#12189)
2012-03-08 15:14:03 -05:00
Brad King 67734be8cf VS: Simplify object name computation
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.
2012-03-06 13:30:19 -05:00
Stephen Kelly 9106b564ae Extract and use the INCLUDE_DIRECTORIES target properties.
Eliminate callers of cmMakefile::GetIncludeDirectories.

All callers of GetIncludeDirectories should go through the local generator
object.

Only the local generator calls cmTarget::GetIncludeDirectories directly.
2012-02-22 06:31:50 -05:00
Aaron C. Meadows ba89e92ba6 Visual Studio: Allow setting Single Byte Character Set (#12189)
For Visual Studio using the Preprocessor Define _SBCS. This behavior
is similar to the way that _UNICODE and _MBCS work already.

Added tests to confirm this behavior.
2012-02-17 11:30:23 -05:00
Brad King a03447b3df VS: Simplify ;-separated attribute value parsing
An implementation ;-separated list parsing was added by commit a1f976ce
(VS: Add support for three new project properties, 2011-11-23) and again
by commit 9e01aefd (VS: Add support for WinRT project properties,
2012-02-03).  Refactor both instances to use ExpandListArgument.
2012-02-03 14:35:35 -05:00
Eugene Golushkov 9e01aefd24 VS: Add support for WinRT project properties (#12930)
VS_WINRT_EXTENSIONS: Boolean property that correspond to "Enable
Tailored Features" in Visual Studio 11 IDE.

VS_WINRT_REFERENCES: Semicolon-delimited list of *.winmd references to
add to the project, which creates a new <ItemGroup>.
2012-02-03 09:26:24 -05:00
Brad King 655a7dd1d4 VS10: Fix /pdb option vcxproj element name (#12328)
The compiler tool uses "ProgramDataBaseFileName" but the linker tool
uses just "ProgramDataBaseFile".  Fix the generator accordingly.
2012-01-09 14:54:45 -05:00
Aaron Ten Clay a1f976ce0e VS: Add support for three new project properties (#12586)
VS_GLOBAL_PROJECT_TYPES: A string containing UUIDs to embed in the
Visual Studio project file under <ProjectTypes>.

VS_GLOBAL_KEYWORD: Allows specification of a keyword like "ManagedCProj"
instead of the default "Win32Proj", under <Keyword>

VS_DOTNET_REFERENCES: Semicolon-delimited list of .NET references to add
to the project, which creates a new <ItemGroup>.
2011-11-28 11:44:04 -05:00
David Cole 7efd93cd72 Merge topic 'vs-version-ivar'
c92ffec Enumerate VS11 version explicitly in local generators
1be4b6f Order VS local generator Version ivar values consistently
2011-11-15 14:39:25 -05:00
David Cole f1197ff0da Merge topic 'fix-11213-vs10-mfc-support'
537020f Tests: Nudge MFC test to pass on VS 6 dashboards (#11213)
51f442e VS11: Update InstallRequiredSystemLibraries.cmake for VS11 (#11213)
d85ab7a Tests: Add environment logging to the MFC test (#11213)
011694c VS10: Use expected values for UseOfMfc (#11213)
a2e6d24 Tests: Fix MFC test to work with VS 10 and later (#11213)
2011-11-15 14:38:56 -05:00
Brad King 1be4b6f463 Order VS local generator Version ivar values consistently
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.
2011-11-14 09:47:31 -05:00
David Cole 011694c269 VS10: Use expected values for UseOfMfc (#11213)
Use expected values for the UseOfMfc xml element in
VS 10 .vcxproj files.

  CMAKE_MFC_FLAG=1 maps to "Static"
  CMAKE_MFC_FLAG=2 maps to "Dynamic"
  all other values map to "false"

Thanks to Randy Schott and McBen for their patches which
served as inspiration and motivation for getting this done.

See also http://public.kitware.com/Bug/view.php?id=11224
2011-11-04 13:29:41 -04:00
Robert Dailey b0f0b3e440 VS: Add VS_SCC_AUXPATH target property (#12549)
Maps to SccAuxPath tag in VCPROJ files.
2011-11-01 11:29:08 -04:00
David Cole eb02acb695 VS10: Avoid unnecessary rebuilds for custom commands
Thanks to James Bigler for pointing this out on the
cmake-developers mailing list...
2011-08-18 16:51:52 -04:00
David Cole a772f21a7d Merge topic 'intel_fortran_vs2010'
3c53fbb Fix custom commands in VS2010 Fortran projects using CFG_INTDIR and test.
2011-08-16 17:01:33 -04:00