1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-07-23 00:01:11 +08:00

675 Commits

Author SHA1 Message Date
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
Robert Maynard
dcc606ad47 CUDA: Allow -G to control device debuging on MSVC.
Fixes #17551
2018-01-11 13:33:00 -05:00
Vitaly Stakhovsky
d09af94619 VS: Modernize 'for' loops in cmVisualStudio10TargetGenerator to C++11
'auto' used for complex types
2017-12-21 14:55:30 -05:00
Brad King
4bc5c08476 Merge topic 'per-source-COMPILE_LANGUAGE-genex-support'
10f58b27 Genex: Per-source $<COMPILE_LANGUAGE:...> support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1575
2017-12-14 08:21:52 -05:00
Marc Chevrier
10f58b27ac Genex: Per-source $<COMPILE_LANGUAGE:...> support
Fixes: #17542
2017-12-13 16:35:22 +01:00
Vitaly Stakhovsky
c62ffdcd4f cmIDEOptions: use std::string instead of const char*
Revise method signatures to save a few c_str() conversions.
2017-12-08 22:30:16 -05:00
Marc Chevrier
9432f686e6 Add generator expression support to per-source COMPILE_DEFINITIONS
This allows users to specify different genex-based compile definitions for each file in a target.

Fixes: #17508
2017-12-05 14:47:39 +01:00
Brad King
729dda5420 Merge topic 'src-genex-refactoring'
6bffc13e Refactor per-source generator expression evaluation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1550
2017-12-05 08:15:40 -05:00
Brad King
21541bb5cc Use CM_FALLTHROUGH in Windows-specific code
Some cases were missed by earlier sweeps due to not compiling
Windows-specific code.
2017-12-04 10:58:15 -05:00
Marc Chevrier
6bffc13ef1 Refactor per-source generator expression evaluation
Prepare to add generator expression support to more source properties.
Factor out some duplicated code into a helper to avoid further
duplication.
2017-12-04 09:10:09 -05:00
Michael Stürmer
8e654a3785 VS: Enable generation of CSharp projects without initial .cs files
fixes #17388
2017-11-29 18:06:08 +01:00
Brad King
f26009dde6 VS: Order .vcxproj.filters files deterministically
Sort source groups by name rather than arbitrary pointer values.

Fixes: #17446
2017-11-15 10:52:33 -05:00
Brad King
c871446abc cmSourceGroup: Return strings from GetName and GetFullName 2017-11-15 10:47:07 -05:00
Yoshinori Tahara
15892aa3c0 VS: Fix warnings in generated references to '.settings' files
According to MSDN docs [1], LastGenOutput is just a file name.

[1] https://msdn.microsoft.com/en-us/library/bb629388.aspx
2017-11-09 11:48:38 -05:00
Jeremiah van Oosten
025221df2a VS: Add source file property to set hlsl debug and optimization flags
Add `VS_SHADER_DISABLE_OPTIMIZATIONS` and `VS_SHADER_ENABLE_DEBUG`
source file properties to control these settings on `.hlsl` files in the
VS generator.

Fixes: #17406
2017-10-30 09:52:10 -04:00
Matthias Maennich
57132765e0 Replace cmArray{Begin,End,Size} by their standard counterparts
std::{begin,end} are part of C++11, std::{cbegin,cend} are part of C++14
and an standard compliant implementation has been introduced within the
'cm' namespace: cm::{cbegin,cend}.

std::size is only part of C++17, hence exposing a compliant implementation
within namespace cm (cm::size).

where possible, the standard implementations are reused.
2017-10-23 17:51:35 +02:00
Brad King
344d149ae4 VS,Xcode: Add CMakeLists.txt sources without mutating targets
Rather than injecting `CMakeLists.txt` files into each target's
`SOURCES`, teach the generators to add them during generation using
dedicated code.  This avoids mutating the original targets, and avoids
polluting `$<TARGET_PROPERTY:foo,SOURCES>` with generator-specific
content.

This also avoids listing the `CMakeLists.txt` sources in the results of
`CMAKE_DEBUG_TARGET_PROPERTIES==SOURCES` so the `RunCMake.TargetSources`
test no longer needs a separate case for IDEs.
2017-10-18 14:24:07 -04:00