1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-20 03:38:05 +08:00

791 Commits

Author SHA1 Message Date
Michael Stürmer
f9042d807d remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget 2018-04-23 07:31:21 +02:00
Fujii Hironori
f59c33a763 VS: Generate a custom command only in the least dependent target
If a custom command is assigned to multiple targets, generate the build
rule only in the least-dependent `.vcxproj` file.  Otherwise MSBuild
will run the command on the first build of a dependent target even if
its dependencies already brought the command up to date (in order to
populates its build log).

Generate targets in least-to-most-dependent order, and assign a custom
command to the least dependent target.

Added cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst to call
cmVisualStudio10TargetGenerator::Generate in least-dependent order.

Moved SourcesVisited from cmVisualStudio10TargetGenerator to
cmLocalVisualStudio10Generator to avoid attaching a custom command to
multiple targets among the local generator.

Fixes: #16767
2018-04-23 13:31:28 +09:00
Brad King
fe0082875a Merge topic 'vs-sdk-dirs'
6ec3e880e7 VS: Add variables to set SDK directories in vcxproj files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1965
2018-04-20 07:52:02 -04:00
Bastien Schatt
6ec3e880e7 VS: Add variables to set SDK directories in vcxproj files
Create `CMAKE_VS_SDK_*_DIRECTORIES` variables to tell the VS generator
how to populate fields in `.vcxproj` files that specify SDK directories.

Fixes: #17908
2018-04-19 09:39:34 -04:00
Brad King
d41e767f2b Merge topic 'vs-conditional-reference-assembly'
c8e98974d8 VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1956
2018-04-17 07:32:11 -04:00
Fujii Hironori
d58d4daa6b cmVisualStudio10TargetGenerator: Use cmLocalVisualStudio10Generator
Change the type of a member variable `LocalGenerator` from
`cmLocalVisualStudio7Generator` to `cmLocalVisualStudio10Generator`.
2018-04-17 11:03:17 +09:00
Brad King
5099af044f Merge topic 'vs-cuda-pdb'
134e795fa9 VS: Add workaround for CUDA compiler PDB location

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1960
2018-04-16 09:14:05 -04:00
Bastien Schatt
c8e98974d8 VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible
Explicitly turn off `ReferenceOutputAssembly` in `ProjectReference`
elements naming other project files whose types do not produce
assemblies.  We already do this for `C#` but it makes sense for other
languages too.

Fixes: #17906
2018-04-13 13:11:09 -04:00
Brad King
134e795fa9 VS: Add workaround for CUDA compiler PDB location
The CUDA Toolkit Visual Studio Integration does not honor the
`ClCompile.ProgramDataBaseFileName` field when telling `nvcc` how to
invoke `cl`.  Work around this problem by passing `-Xcompiler=-Fd...`
ourselves through `AdditionalOptions`.

Fixes: #17647
2018-04-13 12:56:36 -04:00
Brad King
0a122393d7 Merge branch 'backport-fix-explicit-CMakeLists.txt' 2018-04-13 09:46:54 -04:00
Brad King
8480c2afc0 Restore support for explicitly referenced CMakeLists.txt sources
Since commit v3.11.0-rc1~467^2 (VS,Xcode: Add CMakeLists.txt sources
without mutating targets, 2017-10-18) we do not add `CMakeLists.txt` to
target sources but instead generate references to them directly.  This
broke projects that explicitly specify their `CMakeLists.txt` file as a
source file because the explicit entry is no longer consolidated with
the generated one.

Teach the relevant generators to avoid duplicating `CMakeLists.txt`
source references and add test cases.

Fixes: #17828
2018-04-13 09:41:06 -04:00
Brad King
498be66fd7 Merge topic 'add_support_for_clr_targets'
312527de47 document COMMON_LANGUAGE_RUNTIME target properties
4b7a82b4ed cmVisualStudio10TargetGenerator: set /clr compiler flag from property
20e31fb4c9 cmExportFileGenerator: add target property for managed targets
411a22706a cmGeneratorTarget: add handling of managed assemblies to HasImportLibrary()
fb433ff283 cmGeneratorTarget: Make import library checks config-aware
4c1f33961f cmGeneratorTarget: add GetManagedType() and CheckManagedType() methods
6c517a9f8d cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1916
2018-04-12 11:36:28 -04:00
Brad King
aa5bedc52b Merge topic 'attr-escape'
ff18dce5ed cmVisualStudio10TargetGenerator: Properly escape attributes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1937
2018-04-12 11:29:24 -04:00
Brad King
607b0ac2f3 Merge topic 'minor-cleanups'
acda926a04 Replace some uses of sprintf with std::to_string
418541035f cmCTestCurl: Fix UploadFile declared parameter names
1519628e60 cmVisualStudio10TargetGenerator: Make NsightTegraVersion unsigned
2f87d00803 cmMacroCommand: Fix format string to match type of argument
b0676cc5d4 Add in-class initialization of some members
966dba5b68 cmAlgorithms: Remove unnecessary typename keyword
12a145534a gitignore: Ignore a .vs directory in the source tree

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1932
2018-04-06 10:29:38 -04:00
Vitaly Stakhovsky
ff18dce5ed cmVisualStudio10TargetGenerator: Properly escape attributes
In addition to common XML escape characters, attributes require escaping
the double quote character. A new function, cmVS10EscapeAttr is added and
used where appropriate.
2018-04-05 21:20:16 -04:00
jrp2014
1519628e60 cmVisualStudio10TargetGenerator: Make NsightTegraVersion unsigned
It's used in unsigned contexts, such as with format strings.
2018-04-05 13:42:49 -04:00
Michael Stürmer
4b7a82b4ed cmVisualStudio10TargetGenerator: set /clr compiler flag from property 2018-04-05 06:36:53 +02:00
Vitaly Stakhovsky
30bbb4f2ac cmVisualStudio10TargetGenerator: extend DOM-like generation
The local Elem class is extended with more XML-generating functions.
WriteGroups() is rewritten to use these new functions,
avoiding BuildFileStream.
2018-03-30 22:55:30 -04:00
Vitaly Stakhovsky
80767dd50e VS: Simplify XML code
Get rid of suffix arguments
2018-03-27 17:39:19 -04:00
Vitaly Stakhovsky
a0d9429bd7 cmVisualStudioGeneratorOptions: Move XML code to subclasses 2018-03-26 09:35:58 -04:00
Vitaly Stakhovsky
b82ad18fe0 cmVisualStudio10TargetGenerator: fix indentation
Added printing empty string to get the right indentation.
2018-03-19 09:56:44 -04:00
Brad King
60299bc6f0 Merge topic 'vs-debugger-command'
5a7113d8fb VS: Add target property VS_DEBUGGER_COMMAND

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1842
2018-03-19 08:26:33 -04:00
Vitaly Stakhovsky
a74d5a5c8b cmVisualStudio10TargetGenerator: improved XML nesting
Introduce an `Elem` helper class to track XML element state.  This
simplifies code in a few places, particularly OutputSourceSpecificFlags.
2018-03-16 08:50:19 -04:00
Hannes Mezger
5a7113d8fb VS: Add target property VS_DEBUGGER_COMMAND
Fixes: #17819
2018-03-14 13:27:15 -04:00
Vitaly Stakhovsky
59d8cfb85e cmVisualStudio10TargetGenerator: Use helpers for XML tags
Make the XML generating code smaller, more structured, and less
error-prone.  This is a step towards future XML refactoring.
2018-03-07 08:51:30 -05:00
Vitaly Stakhovsky
8182ebca32 cmIDEOptions: use std::string 2018-02-26 11:24:45 -05:00
Brad King
1f7ad8ab5c Merge topic 'project-references-csharp-17678'
076a356c VS: Support C# project references

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1752
2018-02-26 08:57:25 -05:00
Robert Dailey
076a356cd1 VS: Support C# project references
When specifying a pure C# target in the `target_link_libraries()` call to
another C++ target, a `<ProjectReference>` was setup for it (we wanted this)
but also a corresponding `.lib` was added under `<AdditionalDependencies>`
(we didn't want this).

This change introduces a check that prevents `.lib` linker options from
being used when the corresponding target for that library is a C# target.

Fixes: #17678
2018-02-23 08:53:17 -06:00
Vitaly Stakhovsky
b723fe3d7d VS: Convert loops to C++11, other C++ improvements 2018-02-21 21:18:59 -05:00
Vitaly Stakhovsky
b721b9a381 cmVisualStudio10TargetGenerator: Make some data members const; simplify 2018-02-05 19:50:54 -05:00
Vitaly Stakhovsky
6d148d6d53 cmVisualStudio10TargetGenerator: Limit scope of ConvertToWindowsSlash()
It is no longer used outside this class, so its scope can be limited to file.
2018-02-01 19:09:34 -05:00
Brad King
4499cc8bb6 Merge topic 'msvc_cuda_files_use_consistent_obj_names'
fa583869 CUDA: Use MSVC default pattern for naming object files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1722
2018-01-31 08:36:24 -05:00
Brad King
0a37b515af Merge topic 'vs-restore-order'
1fe66c46 VS: Restore the order of the AdditionalIncludeDirectories tag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1719
2018-01-31 08:33:00 -05:00
Robert Maynard
fa583869f7 CUDA: Use MSVC default pattern for naming object files
The default that CUDA uses causes failures when you try to embed
CUDA obj's into another target.
2018-01-30 09:14:02 -05:00
Vitaly Stakhovsky
1fe66c462b VS: Restore the order of the AdditionalIncludeDirectories tag
Move the `AdditionalIncludeDirectories` tag back to the VS-preferred
location in `.vcxproj` files.

Fixes: #17691
2018-01-30 08:53:04 -05:00
Robert Dailey
b07b1aa416 VS: Use newline for empty DebugInformationFormat tags
Previously, code wrote out empty tags for `<DebugInformationFormat>`
like so:

    <DebugInformationFormat></DebugInformationFormat>

This gets corrected by Visual Studio 2017 when saving the solution. The
correction appears as:

    <DebugInformationFormat>
    </DebugInformationFormat>

In the spirit of keeping the XML structure as close to what Visual
Studio expects as possible, a newline is inserted after the opening tag
in the empty case.
2018-01-26 09:52:59 -06:00
Brad King
76f5a87cf1 Merge topic 'sourceFile-new-properties'
04483111 sourceFile properties: add property INCLUDE_DIRECTORIES
3073bd1f VisualStudio generators: refactoring
78b1c2e0 sourceFile properties: add property COMPILE_OPTIONS
3f935e69 LocalGenerator: refactoring

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1596
2018-01-25 08:33:35 -05:00
Brad King
e46ca12acf Merge topic 'stdstring'
25243014 cmMakefile: use std::string in more methods; cleanup c_str()s

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1685
2018-01-25 07:59:08 -05:00
Marc Chevrier
0448311179 sourceFile properties: add property INCLUDE_DIRECTORIES 2018-01-24 15:10:10 +01:00
Vitaly Stakhovsky
25243014e5 cmMakefile: use std::string in more methods; cleanup c_str()s
Follow up commit 969c1f94ae (cmSourceGroup: code improvements; use
std::string and C++11 loops, 2017-01-10).
2018-01-23 11:10:04 -05:00
Marc Chevrier
3073bd1f3d VisualStudio generators: refactoring
Uniformize include directories handling.
Fix memory leaks in class cmVisualStudio10TargetGenerator:
OptionsMap uses now std::unique_ptr.
2018-01-23 10:25:03 +01:00
Marc Chevrier
78b1c2e09e sourceFile properties: add property COMPILE_OPTIONS
Add the support of per-source property COMPILE_OPTIONS,
including generator expressions support.

Related: #17507
2018-01-23 10:24:56 +01:00
Vitaly Stakhovsky
da1a500cee cmVisualStudio10TargetGenerator: remove redundant space char in some tags
Many source tags become identical to those created by MSVC
2018-01-22 19:34:40 -05:00
Brad King
bffdc2e2e1 Merge topic 'msvc_cuda_8_explicitly_specify_cuda_language'
46abfedb CUDA: MSVC will now state files are cuda files when needed

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1658
2018-01-18 09:41:01 -05:00
Brad King
b4dfe1d816 Merge topic 'extend-compile-language-genex'
506fda1c Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and Xcode
c2f79c98 Genex: Enable COMPILE_LANGUAGE for COMPILE_DEFINITIONS with VS and Xcode
0795d25b cmVisualStudio10TargetGenerator: Factor out include dir computation
1ab4d186 cmLocalVisualStudio7Generator: Clarify variable name of compiled language
07e1a743 cmLocalVisualStudio7Generator: Clarify condition for target that compiles

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1657
2018-01-16 09:33:23 -05:00
Robert Maynard
46abfedb83 CUDA: MSVC will now state files are cuda files when needed
The MSVC CUDA build customizations before CUDA 9 would not explicitly
add the -x cu option when building. This caused .cpp and .c files
invoked with CudaCompile to be compiled as host code and not
cuda. Now when we detect CUDA < 9 we will explicitly add this
option to correct this bug.
2018-01-12 15:17:03 -05:00
Brad King
506fda1cf0 Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based
on the linker language.  By default this is always the C++ flags if any
C++ sources appear in the target, and otherwise the C flags.  Therefore
we can define the `COMPILE_LANGUAGE` generator expression in
`INCLUDE_DIRECTORIES` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
and Xcode can do.  It is also sufficient for many use cases since the
set of include directories for C and C++ is frequently similar but may
be distinct from those for other languages like CUDA.

Fixes: #17435
2018-01-12 14:27:37 -05:00
Brad King
c2f79c9867 Genex: Enable COMPILE_LANGUAGE for COMPILE_DEFINITIONS with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based
on the linker language.  By default this is always the C++ flags if any
C++ sources appear in the target, and otherwise the C flags.  Therefore
we can define the `COMPILE_LANGUAGE` generator expression in
`COMPILE_DEFINITIONS` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
and Xcode can do.  It is also sufficient for many use cases since the
set of definitions for C and C++ is frequently similar but may be
distinct from those for other languages like CUDA.

Issue: #17435
2018-01-12 14:27:37 -05:00
Brad King
46ad721597 Merge topic 'cuda_allow_G_to_device_debugging_on_msvc'
dcc606ad CUDA: Allow -G to control device debuging on MSVC.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1619
2018-01-12 09:51:42 -05:00
Brad King
0795d25b78 cmVisualStudio10TargetGenerator: Factor out include dir computation 2018-01-11 15:03:02 -05:00