1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-21 12:10:05 +08:00

669 Commits

Author SHA1 Message Date
Brad King
7162630bee Merge topic 'vs-ipo'
bef80e6623 VS: Do not specify incremental linking if LTCG is enabled
567fabe88e IPO: INTERPROCEDURAL_OPTIMIZATION (LTCG) for Visual Studio

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2363
2018-09-18 11:22:41 -04:00
Vitaly Stakhovsky
f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const& 2018-09-18 11:16:46 -04:00
Brad King
bef80e6623 VS: Do not specify incremental linking if LTCG is enabled
Otherwise the linker may warn:

    LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
2018-09-17 10:53:27 -04:00
Niels Dekker
567fabe88e IPO: INTERPROCEDURAL_OPTIMIZATION (LTCG) for Visual Studio
Add IPO support for Visual Studio (which is referred to by VS as
"Link Time Code Generation" and "Whole Program Optimization"), for
VS version >= 10.  This allows CMake/VS users to enable IPO by setting
property `INTERPROCEDURAL_OPTIMIZATION`.

Fixes: #16748
2018-09-17 10:53:10 -04:00
Brad King
1b57f49586 genex: Simplify cmGeneratorExpressionInterpreter
All callers were constructing with a non-empty target name using the
target whose pointer was passed anyway.  Drop this argument.  Simplify
logic accordingly.  Re-order constructor arguments to match the
cmCompiledGeneratorExpression::Evaluate arguments.

Also remove unnecessary getters.
2018-09-07 09:23:43 -04:00
Brad King
e1ebec55d4 Merge topic 'grd-stdstring'
4d89830d71 cmMakefile: Make GetRequiredDefinition return std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2347
2018-09-06 09:54:56 -04:00
Brad King
3ecbe1987d Merge topic 'isonoff-cstr'
6f16be6a62 Remove unnecessary c_str() calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2346
2018-09-06 09:54:18 -04:00
Vitaly Stakhovsky
4d89830d71 cmMakefile: Make GetRequiredDefinition return std::string
In all cases the return value is converted to std::string anyway.

Also remove unnecessary `c_str()` calls in arguments to
`GetRequiredDefinition`.
2018-09-05 15:15:55 -04:00
Vitaly Stakhovsky
6f16be6a62 Remove unnecessary c_str() calls
Use the new IsOn(),IsOff() overloads.
2018-09-05 15:12:57 -04:00
Brad King
b6524f6f34 Merge topic 'vs-CMakeLists.txt'
0b82e68f2f VS: Restore CMakeLists.txt references in each target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2349
2018-09-05 14:35:46 -04:00
Brad King
0b82e68f2f VS: Restore CMakeLists.txt references in each target
The custom command de-duplication added by commit v3.12.0-rc1~171^2 (VS:
Generate a custom command only in the least dependent target,
2018-03-23) accidentally also applied to the `CMakeLists.txt` file
reference we put in each target.  This file reference comes with a
custom command that has no dependencies and that is safe to run
repeatedly across multiple targets (via internal stamp checking).
Therefore it should be excluded from the de-duplication so that
`CMakeLists.txt` references appear in all targets for human reference.

Fixes: #18310
2018-09-05 14:32:45 -04:00
Brad King
5a02afd920 Merge topic 'vs-winrt-default'
e78a0c8e8a VS: Add option to tell generator that platfrom is WinRT by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2315
2018-08-31 14:50:27 -04:00
Mikhail Korolev
e78a0c8e8a VS: Add option to tell generator that platfrom is WinRT by default
Create a ``CMAKE_VS_WINRT_BY_DEFAULT`` variable to indicate this.

Fixes: #18286
2018-08-30 12:46:57 -04:00
Vitaly Stakhovsky
95084a313d cmVisualStudio10TargetGenerator: clean up c_str()s 2018-08-28 14:41:19 -04:00
Brad King
9da844d8cb Merge topic 'lg-directory'
50fbfee3a0 cmLocalGenerator: return directories as const std::string&

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2309
2018-08-28 13:43:48 -04:00
Brad King
6f7c96fb17 Merge topic 'mk-directory'
c8fd23ec6f cmMakefile: return directories as const std::string&

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2311
2018-08-28 13:42:43 -04:00
Vitaly Stakhovsky
50fbfee3a0 cmLocalGenerator: return directories as const std::string& 2018-08-27 15:48:57 -04:00
Vitaly Stakhovsky
c8fd23ec6f cmMakefile: return directories as const std::string& 2018-08-27 14:07:43 -04:00
Brad King
ce153cacc7 Merge topic 'static-lib-options'
974de0e199 static library: add property STATIC_LIBRARY_OPTIONS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2290
2018-08-27 14:04:22 -04:00
Brad King
fa2ecf7fce Merge topic 'ProjectReference'
e4ba1f5a94 VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2285
2018-08-27 14:01:01 -04:00
Brad King
1bd768174a VS: Avoid VS 2017 toolset default use of /FC flag
VS 2017 toolsets now use this flag by default if `UseFullPaths` is
not explicitly set to `false` in the .vcxproj file.  Since there is
no negative form of this flag there is no way for projects to turn
it off through our flag map.  Also, the Makefile and Ninja generators
do not add this flag unless it is explicitly specified by the project.

Teach our generator to set `UseFullPaths` to `false` in VS 2017
unless the project or use has explicitly specified `/FC`.

Fixes: #18261
2018-08-23 14:05:00 -04:00
Marc Chevrier
974de0e199 static library: add property STATIC_LIBRARY_OPTIONS
issue: #18251
2018-08-15 15:20:18 +02:00
Vitaly Stakhovsky
6ce56028d5 cmVisualStudioGeneratorOptions::Parse(): const std::string& argument 2018-08-13 18:22:11 -04:00
Bastien Schatt
e4ba1f5a94 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-08-12 16:06:56 +02:00
Vitaly Stakhovsky
c530e2f74f cmCompiledGeneratorExpression::Evaluate(): return const std::string& 2018-08-09 14:50:17 -04:00
Brad King
ed75309344 Merge topic 'csharp-link-file'
8a6107650e VS: Only link cs files when they're not in binary dir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Michael Stürmer <michael.stuermer@schaeffler.com>
Merge-request: !2177
2018-07-09 07:33:35 -04:00
Robert Dailey
8a6107650e VS: Only link cs files when they're not in binary dir
When `*.cs` files are provided, do not generate a `<Link>` element in
the `.csproj` project if those files are descendants of
`CMAKE_CURRENT_BINARY_DIR`. This comparison happens for each file.
2018-07-06 09:45:15 -04:00
Brad King
1a21b4695a Merge topic 'vs_debugger'
797de7a6f6 VS10Project: Expand VS_DEBUGGER_* capabilities

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2150
2018-06-22 09:45:19 -04:00
Brad King
6a55c8c603 Merge topic 'vs-cuda-no-host-includes'
543b6826ee VS: Avoid duplication of CUDA include directories

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2158
2018-06-20 09:46:58 -04:00
Brad King
543b6826ee VS: Avoid duplication of CUDA include directories
We already place all include directories for CUDA inside `CudaCompile`
so we do not need to use any from `ClCompile`.  Tell `CudaCompile`
not to use the host compiler's include directory settings.

Fixes: #18101
2018-06-20 09:44:18 -04:00
Jon Chronopoulos
797de7a6f6 VS10Project: Expand VS_DEBUGGER_* capabilities
This adds VS_DEBUGGER_COMMAND_ARGUMENTS and VS_DEBUGGER_ENVIRONMENT as
well as allowing VS_DEBUGGER_* to use generator expressions.
2018-06-17 17:55:27 +10:00
Marc Chevrier
c1f5a44b28 LINK_OPTIONS: Add new family of properties
This family enable to manage link flags

Three new properties:
* directory property: LINK_OPTIONS
* target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS

Two new commands
* add_link_options(): to populate directory property
* target_link_options(): to populate target properties

Fixes: #16543
2018-06-06 17:22:39 +02:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2018-06-01 09:53:42 -04:00
Basil Fierz
5f13168419 VS: Add option to select the version of the toolset used by VS 2017
Add new `version=` parameter in the toolset setting to select the
version.  Add variable `CMAKE_VS_PLATFORM_TOOLSET_VERSION` to hold the
version, if one is set (blank indicates default).

Fixes: #17549
2018-05-29 10:12:59 -04:00
Vitaly Stakhovsky
e7e25c6cb6 cmVisualStudio10TargetGenerator: Remove empty Elem::EndElement()
The method no longer does anything.  Remove it and remove calls to it.
2018-05-25 13:04:56 -04:00
Vitaly Stakhovsky
726c090297 cmVisualStudio10TargetGenerator: close XML tag in Elem destructor
RAII actually implemented; EndElement() still kept to avoid major reformatting
2018-05-25 09:28:54 -04:00
Vitaly Stakhovsky
45c4a75d27 cmVisualStudio10TargetGenerator: make sure each Elem has right scope
Prepare for future RAII
2018-05-22 11:28:11 -04:00
Vitaly Stakhovsky
790fc415b1 cmVisualStudio10TargetGenerator: remove BuildFileStream member
Stream object is now local to `Generate()`
2018-05-16 12:59:00 -04:00
Brad King
c8c07c24dd Merge topic 'dotnet_target_fw_init'
71a033616a added CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2032
2018-05-16 10:02:48 -04:00
Brad King
d32ceffb1e Merge topic 'vs-nitpicks'
b88e138369 cmVisualStudio10TargetGenerator: minor code cleanup

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2063
2018-05-16 10:01:57 -04:00
Michael Stürmer
71a033616a added CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION variable
Fixes: #17955
2018-05-15 09:00:31 +02:00
Brad King
5a227ce805 Merge topic 'cuda-vs-cuda-device-runtime'
a170a59a58 VS: Link CUDA binaries with the device runtime library 'cudadevrt'

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2062
2018-05-14 09:42:00 -04:00
Vitaly Stakhovsky
b88e138369 cmVisualStudio10TargetGenerator: minor code cleanup 2018-05-11 10:05:51 -04:00
Brad King
c9e995c9ef Merge topic 'vs-refactor'
a2b5acec3b cmVisualStudio10TargetGenerator: refactor

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2054
2018-05-11 09:23:13 -04:00
Brad King
1dda570edc Merge topic 'vs-fix-csharp-recompile'
91754b4e60 VS: When not referencing output assembly do not try to copy it either

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2037
2018-05-11 09:20:49 -04:00
Brad King
a170a59a58 VS: Link CUDA binaries with the device runtime library 'cudadevrt'
According to https://docs.nvidia.com/cuda/nvrtc/index.html there are
some cases where a CUDA binary "...must be linked against the CUDA
device runtime (cudadevrt) library".  When `nvcc` drives linking it
automatically links to runtime libraries as follows:

* -cudart=none: None
* -cudart=shared: -lcudadevrt -lcudart
* -cudart=static: -lcudadevrt -lcudart_static

The `cudadevrt` library is the cuda device runtime library.  It is
always static so passing it to the linker when not necessary does
not hurt anything.

With Ninja and Makefile generators, we detect `cudadevrt` and either
`cudart` or `cudart_static` libraries implied by `nvcc` and then add
them to link lines driven by a host compiler.  However, this does not
work with the VS generator because the CUDA Toolkit Visual Studio
integration does not use `nvcc` to link binaries and instead uses
`link.exe` directly.

Visual Studio project files (`.vcxproj`) for CUDA are expected to
explicitly list the needed runtime libraries.  Our VS generator already
adds `cudart.lib` or `cudart_static.lib` based on the `-cudart=` flag.
Update it to also add `cudadevrt.lib` as nvcc does.

Fixes: #17988
2018-05-11 08:49:10 -04:00
Andreas Schönle
91754b4e60 VS: When not referencing output assembly do not try to copy it either
When generating a `ProjectReference` with `ReferenceOutputAssembly` set
to `false`, also set `CopyToOutputDirectory` to `Never`.  Otherwise
MSBuild might report a diagnostic like

    Project '<name>' is not up to date.
    CopyLocal reference '...\ZERO_CHECK' is missing from output location.

and rebuild the referencing project unnecessarily.
2018-05-09 08:17:42 -04:00
Vitaly Stakhovsky
a2b5acec3b cmVisualStudio10TargetGenerator: refactor
`WritePlatformConfigTag` moved to local `Elem` class; other improvements
2018-05-09 08:04:34 -04:00
Brad King
d3292d2d10 Merge topic 'vs-refactor-xml'
0bd1d1fcc4 VS: Fix regression in XML generation for CUDA

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2053
2018-05-09 07:44:28 -04:00
Brad King
0bd1d1fcc4 VS: Fix regression in XML generation for CUDA
Refactoring in commit 3f315dc128 (cmVisualStudio10TargetGenerator: XML
refactoring, 2018-05-02) accidentally left the `<Import>` element for
the CUDA build customizations unclosed.
2018-05-08 10:29:22 -04:00