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

1089 Commits

Author SHA1 Message Date
Vitaly Stakhovsky
7156911242 cmIsOn: add overload accepting const std::string* 2020-07-14 08:22:24 -04:00
Vitaly Stakhovsky
18726ad634 GetFeature(): return cmProp 2020-07-11 14:03:03 -04:00
Brad King
a4cfc7d03c Merge topic 'refactor-generator-configs'
7a969fe21d cmMakefile: Refactor API to better handle empty config values

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4957
2020-07-06 09:28:11 -04:00
Robert Maynard
7a969fe21d cmMakefile: Refactor API to better handle empty config values 2020-07-03 07:43:18 -04:00
Robert Maynard
dc94b0249e cmStandardLevelResolver: Added to handle standard level queries
Refactored out of cmMakefile
2020-07-01 07:58:58 -04:00
Rahul Gottipati
27b03281e2 configure_file: Add option to control file permissions transfer to copy
Issue: #20866
2020-06-30 11:20:41 -04:00
Brad King
e0b21ad924 Merge topic 'languageStandardRefactor'
742ff97f80 Refactor language standard computation
0892c798f7 cmMakefile: Change CompileFeatureKnown to take target name instead of target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4803
2020-06-18 09:47:41 -04:00
Justin Goshi
742ff97f80 Refactor language standard computation
Instead of mutating the configure-time cmTarget's properties at generate
time, compute and store it in a cmGeneratorTarget field.
2020-06-16 16:32:34 -07:00
Raul Tambre
fec7dd33d3 CUDA: Add issue number to Clang separable compilation error 2020-06-16 14:07:30 -04:00
Raul Tambre
0a056246a1 CUDA: Pass toolkit path to Clang
Clang isn't very good at finding the installed CUDA toolkit.
The upstream recommendation is that we should pass the toolkit explicitly.

Additionally:
* Avoids Clang having to search for the toolkit on every invocation.
* Allows the user to use a toolkit from a non-standard location by simply
  setting CUDAToolkit_ROOT. The same way as with FindCUDAToolkit.

Clang wants the directory containing the device library and version.txt as the
toolkit path.
We thus pass the newly introduced CUDAToolkit_LIBRARY_ROOT as the toolkit path.

We save CUDAToolkit_ROOT_DIR and CUDAToolkit_LIBRARY_ROOT on Clang to have them
available in try_compile() and avoid unnecessary re-searching or a possibly
different installation being found in FindCUDAToolkit.
This however means that the selected toolkit can't be changed after the initial
language enablement.

We now determine CUDA compiler ID before doing actual detection, as we don't
want to spend time finding the CUDA toolkit for NVIDIA.

Implements #20754.
2020-06-12 21:50:05 +03:00
Brad King
efac04465c Merge topic 'cuda_clang_separable_error'
b1243201e7 CUDA: Don't RunCMake generate separable compilation tests on Clang
1b4c690543 CUDA: Throw error if CUDA_SEPARABLE_COMPILATION is ON when using Clang

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4827
2020-06-05 07:56:19 -04:00
Raul Tambre
1b4c690543 CUDA: Throw error if CUDA_SEPARABLE_COMPILATION is ON when using Clang
Separable compilation isn't supported yet on Clang.
Let's throw a helpful error instead of confusing errors during the build.
2020-06-02 22:09:10 +03:00
Marc Chevrier
056489d567 add_library/add_executable: allow local alias to imported targets
Fixes: #20641
2020-06-02 17:11:47 +02:00
Brad King
a432b1075c Merge topic 'getdef-expand'
7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4819
2020-06-02 08:02:24 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Vitaly Stakhovsky
7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector
Combines cmMakefile:GetDefinition() and cmExpandList()
2020-05-30 08:59:20 -04:00
Cristian Adam
1f791eb160 Multi-Ninja: Fix reusable PCHs for MSVC
Fixes: #20721
2020-05-27 14:19:03 -04:00
Cristian Adam
8f2702005a AutoMoc: Configure AutoMoc after generated sources (PCH, Unity)
Fixes: #20119
2020-05-26 13:14:27 +02:00
Cristian Adam
f6cb1e646c Multi-Ninja: Fix PCHs for Visual C++
Fixes: #20711
2020-05-20 11:20:38 +02:00
Brad King
cee7eb8b3a Merge topic 'unity_explicit_groups'
9f4eb352fe Unity Builds: Support explicit specification of sources to groups
b00585adcc Unity: Refactor implementation to make it easier to extend

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4716
2020-05-11 10:08:12 -04:00
Robert Maynard
9f4eb352fe Unity Builds: Support explicit specification of sources to groups
Instead of having CMake determine which files should go into each
unity file, the user can now use explicitly state the mapping.
2020-05-07 11:13:34 -04:00
Andreas Schönle
605d6c65c9 PCH: Fix REUSE_FROM in multi-config generators
Since commit a55df20499 (Multi-Ninja: Add precompile headers support,
2020-01-10, v3.17.0-rc1~136^2) the re-used PCH file object is added
once for each configuration to flags used for all configurations.
Put it in the flags for only the corresponding configuration instead.

Fixes: #20680
2020-05-07 09:58:44 -04:00
Robert Maynard
b00585adcc Unity: Refactor implementation to make it easier to extend 2020-05-06 15:56:16 -04:00
Vitaly Stakhovsky
53675adbcf GetSafeProperty: return std::string const& 2020-04-30 10:27:16 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Brad King
5a57cec2f4 Merge topic 'apple-merge-same-sysroot'
3a7d1e9592 Apple: Merge per-arch sysroot parameters if all are the same

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4647
2020-04-22 08:32:02 -04:00
Gregor Jasny
3a7d1e9592 Apple: Merge per-arch sysroot parameters if all are the same
Since commit a9b41195d2 (Handle multi-arch sysroots on Apple platforms,
2019-07-26, v3.17.0-rc1~287^2), CMake supports "fat" builds with
different sysroots. Those are passed to the compiler with the
`-Xarch_<xyz>` parameter.

Unfortunately this breaks the Compiler Cache (ccache) because
it does not support those compiler flags:

    https://github.com/ccache/ccache/blob/v3.7.9/src/ccache.c#L2700-L2705

Restore the caching ability for certain "fat" build configurations (e.g.
`arm64` and `armv7`) where the sysroot is the same for all selected
architectures and thus a plain `-isysroot` parameter could be used.
2020-04-21 11:18:12 -04:00
Marc Chevrier
4248bb452a CUDA: Device linking use now link options
properties LINK_OPTIONS and INTERFACE_LINK_OPTIONS are propagated
to the device link step.

To control which options are selected for normal link and device link steps,
the $<DEVICE_LINK> and $<HOST_LINK> generator expressions can be used.

Fixes: #18265
2020-04-19 15:53:11 +02:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Brad King
7e8df1bb24 Merge topic 'cuda_architectures'
21131ca60c CUDA: Add CudaOnly.CompileFlags test
f0931b0790 CUDA: Convert tests to use CUDA_ARCHITECTURES
e98588aaba CUDA: Add CUDA_ARCHITECTURES target property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Patrick Stotko <stotko@cs.uni-bonn.de>
Merge-request: !4568
2020-04-16 11:11:33 -04:00
Raul Tambre
e98588aaba CUDA: Add CUDA_ARCHITECTURES target property
Simplifies CUDA target architecture handling.

Required for Clang support as Clang doesn't automatically select a supported architecture.
We detect a supported architecture during compiler identification and set CMAKE_CUDA_ARCHITECTURES to it.

Introduces CMP0104 for backwards compatibility with manually setting code generation flags with NVCC.

Implements #17963.
2020-04-15 17:55:41 +03:00
Brad King
156196938c Merge topic 'cmprop-source'
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp
fc223f9860 cmGlobalXCodeGenerator: Fix genex interpreter overloads

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4603
2020-04-15 09:49:46 -04:00
Brad King
a67565751f Merge topic 'msbuildUtf8Support'
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4587
2020-04-15 09:44:48 -04:00
Vitaly Stakhovsky
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp 2020-04-14 10:57:17 -04:00
Justin Goshi
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding
Adds a flag to indicate that pipe output from a custom command should be
interpreted as UTF-8 encoded. This change does not introduce a public
way to set the flag, but generators that create internally-generated
commands know if they are calling cmake, which uses UTF-8 pipes.

MSBuild added support for interpreting output of PreBuildEvent,
PreLinkEvent, PostBuildEvent, and CustomBuildStep as UTF-8. This change
will appear in Visual Studio 16.6 Preview 3. It is opt-in, and you need
to add the StdOutEncoding tag. MSBuild treats these as property bags so
if we emit the tag for earlier versions of Visual Studio it would be
safely ignored. This change emits the StdOutEncoding tag and sets it to
UTF-8 whenever the custom command UTF-8 pipe flag is set. This fixes
globalization issues when the output from cmake contained characters
that required MSBuild to interpret as UTF-8 before displaying them.
2020-04-13 12:54:47 -07:00
Ben Boeckel
f2a33107be clang-tidy: address bugprone-branch-clone lints
Arguably, many of these are bugs in `clang-tidy`. An if/else tree with
other conditionals between cloned blocks may be relying on the
intermediate logic to fall out of the case and inverting this logic may
be non-trivial.

See: https://bugs.llvm.org/show_bug.cgi?id=44165
2020-04-13 11:26:02 -04:00
Brad King
da25220d83 Merge branch 'backport-3.17-apple-arch-sysroots' into apple-arch-sysroots 2020-04-08 13:44:42 -04:00
Brad King
84a1e67380 Apple: Fix mapping CMAKE_APPLE_ARCH_SYSROOTS to custom OSX_ARCHITECTURES
The `CMAKE_OSX_ARCHITECTURES` value is not used directly by generators.
It is used to initialize a per-target `OSX_ARCHITECTURES` property, but
that property can also be set explicitly by project code to a subset of
the full list of architectures.  In order to handle this case, construct
a mapping from each `CMAKE_OSX_ARCHITECTURES` entry to the corresponding
`CMAKE_APPLE_ARCH_SYSROOTS` entry by name.  Use the mapping to find the
sysroot for each entry in `OSX_ARCHITECTURES` for a given target.

If `CMAKE_APPLE_ARCH_SYSROOTS` does not have the same length as
`CMAKE_OSX_ARCHITECTURES`, error out early rather than risking a crash
or assertion failure.

Fixes: #20534
2020-04-08 13:40:09 -04:00
Brad King
45fa9b32ca Apple: Improve handling of missing SDKs in CMAKE_APPLE_ARCH_SYSROOTS
Use `<arch>-SDK-NOTFOUND` instead of an empty string as a placeholder in
`CMAKE_APPLE_ARCH_SYSROOTS` for architectures whose SDK is not found.
This ensures the length of `CMAKE_APPLE_ARCH_SYSROOTS` matches the
length of `CMAKE_OSX_ARCHITECTURES`.  It also makes the missing SDKs
more visible in the value.

Issue: #20534
2020-04-08 11:51:02 -04:00
Brad King
b8b804e2ed Merge topic 'file-GetRuntimeDependencies_support_cross_compilation'
f867423aa2 file: GetRuntimeDependencies use CMAKE_OBJDUMP when applicable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4538
2020-04-07 08:03:50 -04:00
Robert Maynard
f867423aa2 file: GetRuntimeDependencies use CMAKE_OBJDUMP when applicable
On machines where the gnu bin utils are prefixed, or suffixed
the file(GET_RUNTIME_DEPENDENCIES ) command would fail without
explicitly setting the location of objdump.

Now we pre-populate the variables used to find objdump based
on the gnu bin utils, so that these use cases are better supported
2020-04-06 12:12:14 -04:00
Brad King
2b9e3abcb5 Merge topic 'ctest-resource-file-cache'
060d2ce269 CTest: Add CTEST_RESOURCE_SPEC_FILE variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4564
2020-04-06 08:26:40 -04:00
Brad King
f4e4b41a19 Merge topic 'pch-ios-multi-arch'
f593b354da PCH: Add support for multi architecture iOS projects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4561
2020-04-03 07:05:11 -04:00
Kyle Edwards
060d2ce269 CTest: Add CTEST_RESOURCE_SPEC_FILE variable 2020-04-02 16:29:50 -04:00
Cristian Adam
f593b354da PCH: Add support for multi architecture iOS projects
Fixes: #20497
2020-04-02 11:51:19 -04:00
Brad King
e95d274f30 Merge topic 'cmprop-makefile'
aba23c747b cmMakefile::GetProperty: return cmProp

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4559
2020-04-02 11:20:46 -04:00
Vitaly Stakhovsky
aba23c747b cmMakefile::GetProperty: return cmProp 2020-04-01 10:56:34 -04:00
Brad King
ff02a592bc cmLocalGenerator: Avoid using upper-case config when not necessary
Calls to `GetLinkerLanguage`, `GetSourceFiles`, etc. can accept
the original-case config name.
2020-04-01 10:56:00 -04:00
Brad King
a4b76c237d cmLocalGenerator: Clarify local variable name in GetTargetFlags 2020-04-01 10:55:59 -04:00
Brad King
25a920e827 cmLocalGenerator: Convert GetStaticLibraryFlags to take original-case config
Move upper-case conversion of the configuration into the implementation.
2020-04-01 10:55:59 -04:00