summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'cuda_clang_toolkit_path' into release-3.18Brad King2020-06-151-0/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | ec59fb6c31 CUDA: Determine CUDA toolkit location for NVCC 0a056246a1 CUDA: Pass toolkit path to Clang 9c43972127 FindCUDAToolkit: Avoid unnecessary temporary variable computing binary dir 9eebb5b8b2 FindCUDAToolkit: Remove unnecessary checks around searches 8f01fe7bf1 FindCUDAToolkit: Use list(SORT) to sort in natural order 8c144fe9ad FindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searching 403f8d31e3 FindCUDAToolkit: Add CUDAToolkit_LIBRARY_ROOT 6636693134 FindCUDAToolkit: Re-unify with Internal/CUDAToolkit Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4828
| * CUDA: Pass toolkit path to ClangRaul Tambre2020-06-121-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | CUDA: Add support for disabling CUDA_ARCHITECTURESRaul Tambre2020-06-151-22/+29
|/ | | | | | | | | | The ability to disable adding architectures completely for packaging purposes and cases requiring passing the architectures flags explicitly has been requested. Support a false value for CUDA_ARCHITECTURES and CMAKE_CUDA_ARCHITECTURES for this purpose. Implements #20821.
* Merge topic 'getdef-expand'Brad King2020-06-021-45/+18
|\ | | | | | | | | | | | | 7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4819
| * cmMakefile: add GetDefExpandList() that splits value into std::vectorVitaly Stakhovsky2020-05-301-45/+18
| | | | | | | | Combines cmMakefile:GetDefinition() and cmExpandList()
* | Merge topic 'target_link_libraries-self-link-is-an-error'Brad King2020-06-021-0/+7
|\ \ | | | | | | | | | | | | | | | | | | 9436ad35df target_link_libraries: self-link through ALIAS is an error Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4826
| * | target_link_libraries: self-link through ALIAS is an errorMarc Chevrier2020-05-301-0/+7
| |/ | | | | | | Fixes: #19617
* | Merge topic 'pch-fix-bad-ClearSourcesCache'Brad King2020-06-011-2/+0
|\ \ | | | | | | | | | | | | | | | | | | | | | 902858367f Merge branch 'backport-3.16-pch-fix-bad-ClearSourcesCache' fa7b041eca PCH: Fix logic error that incorrectly clears sources during VS generation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4815
| * \ Merge branch 'backport-3.16-pch-fix-bad-ClearSourcesCache'Brad King2020-05-291-2/+0
| |\ \
| | * | PCH: Fix logic error that incorrectly clears sources during VS generationBrad King2020-05-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 729d997f10 (Precompile Headers: Add REUSE_FROM signature, 2019-08-30, v3.16.0-rc1~101^2), `GetPchFileObject` handles the case that it is called first for another target's `REUSE_FROM` by calling `AddSource` to make sure `GetObjectName` can produce the correct object name. However, `AddSource` causes `ClearSourcesCache` to be called, which since commit a9f4f58f0c (cmGeneratorTarget: Clear AllConfigSources in ClearSourcesCache, 2020-05-15, v3.16.7~2^2) now correctly erases the `AllConfigSources` structure. This is okay during `AddPchDependencies`, but there is another code path in which it is problematic. When the Visual Studio generator's `WriteAllSources` method is looping over the sources, the `cmake_pch.cxx` source is encountered first. This causes `OutputSourceSpecificFlags` to call `GetPchCreateCompileOptions`, which calls `GetPchFile`, which under MSVC with `CMAKE_LINK_PCH` calls `GetPchFileObject`. That leads to `ClearSourcesCache` erasing the structure over which `WriteAllSources` is iterating! This bug is caught by our `RunCMake.PrecompileHeaders` test when run with the VS generator as of the commit that exposed it by fixing `ClearSourcesCache`. However, that change was backported to the CMake 3.16 series after testing only with later versions versions that contain commit a55df20499 (Multi-Ninja: Add precompile headers support, 2020-01-10, v3.17.0-rc1~136^2). By adding proper multi-config support for PCH, that commit taught `cmLocalGenerator::AddPchDependencies` to call `GetPchFile` with the real set of configurations instead of just the empty string. This allows the `GetPchFile` cache of PCH sources to be populated up front so that the later calls to it in the `WriteAllSources` loop as described above do not actually call `GetPchFileObject` or `ClearSourcesCache`. That hid the problem. Fix this by re-ordering calls to `AddPchDependencies` to handle `REUSE_FROM` targets only after the targets whose PCH they re-use. Remove the now-unnecessary call to `AddSource` from `GetPchFileObject` so that `ClearSourcesCache` is never called during `WriteAllSources`. Update the PchReuseFrom test case to cover an ordering of targets that causes generators to encounter a `REUSE_FROM` target before the target whose PCH it re-uses. Fixes: #20770
* | | | Merge topic 'ninja-multi-export-all-symbols'Brad King2020-06-011-1/+2
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | 6fc4bfa11c Ninja Multi-Config: Fix bug in CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Alex Reinking <alex_reinking@berkeley.edu> Merge-request: !4825
| * | | Ninja Multi-Config: Fix bug in CMAKE_WINDOWS_EXPORT_ALL_SYMBOLSKyle Edwards2020-05-291-1/+2
| |/ / | | | | | | | | | Fixes: #20775
| * | Merge topic 'fix-ClearSourcesCache' into release-3.17Brad King2020-05-181-0/+1
| |\ \ | | |/ | | | | | | | | | | | | | | | a9f4f58f0c cmGeneratorTarget: Clear AllConfigSources in ClearSourcesCache Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4751
| * | Merge topic 'pch-file-time' into release-3.17Brad King2020-02-271-0/+13
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | 7e9b9fe918 PCH: Copy the timestamp from an absolute header file Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4400
* | | | CUDA: Factor runtime library lookup into helper methodBrad King2020-05-221-0/+19
| | | |
* | | | Multi-Ninja: Fix PCHs for Visual C++Cristian Adam2020-05-201-0/+4
| | | | | | | | | | | | | | | | Fixes: #20711
* | | | cmVisualStudio10TargetGenerator: Adopt Windows Store and Phone infrastructureBrad King2020-05-181-63/+12
| | | | | | | | | | | | | | | | | | | | Move support for Resx, Xaml, Certificate, and AppManifest file handling out of cmGeneratorTarget.
* | | | cmGeneratorTarget: Remove default config from Get* methodsBrad King2020-05-181-1/+2
| | | | | | | | | | | | | | | | Ensure all call sites pass an explicit configuration.
* | | | Merge topic 'cuda-clang'Brad King2020-05-181-0/+14
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a653ca9504 Tests: Update CUDA tests to work with Clang 5df21adf46 CUDA: Add support for Clang compiler dc2eae1f91 FindCUDAToolkit: Factor out discovery code into a separate file 70be10cbf4 CUDA: Remove toolkit include dirs from implicit include dirs only with NVIDIA Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Artem Belevich <tra@google.com> Acked-by: Robert Maynard <robert.maynard@kitware.com> Acked-by: Axel Huebl <axel.huebl@plasma.ninja> Acked-by: friendnick <ikoval67@gmail.com> Acked-by: Patrik Huber <patrikhuber@gmail.com> Merge-request: !4442
| * | | | CUDA: Add support for Clang compilerRaul Tambre2020-05-151-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When crosscompiling we pass the sysroot. We need to try various architecture flags. Clang doesn't automatically select one that works. First try the ones that are more likely to work for modern installations: * <=sm_50 is deprecated since CUDA 10.2, try sm_52 first for future compatibility. * <=sm_20 is removed since CUDA 9.0, try sm_30. Otherwise fallback to Clang's current default. Currently that's `sm_20`, the lowest it supports. Separable compilation isn't supported yet. Fixes: #16586
* | | | | Merge topic 'fix-ClearSourcesCache'Brad King2020-05-181-0/+1
|\ \ \ \ \ | |/ / / / |/| | | / | | |_|/ | |/| | | | | | | | | | a9f4f58f0c cmGeneratorTarget: Clear AllConfigSources in ClearSourcesCache Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4751
| * | | cmGeneratorTarget: Clear AllConfigSources in ClearSourcesCacheBrad King2020-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 40aa6c059c (cmGeneratorTarget: Add method to collect all sources for all configs, 2017-04-10, v3.9.0-rc1~268^2~5) we forgot to update `ClearSourcesCache` to also clear `AllConfigSources`. This leads to subtle cases where code paths like PCH handling that add sources during generation break depending on ordering. Suggested-by: Christian Fersch Fixes: #20712, #20702
* | | | INTERFACE_SOURCES: Fix per-config link libs on multi-config generatorsBrad King2020-05-121-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In multi-config generators we memoize the computed set of source files for a target to avoid repeating the computation when the set does not depend on the configuration. We already track whether generator expressions in `SOURCES` or `INTERFACE_SOURCES` reference the configuration (`$<CONFIG:...>`). However, we previously forgot to track whether the set of libraries whose `INTERFACE_SOURCES` are considered depends on the configuration. This caused multi-config generators to use the first configuration's set of sources for all configurations in cases such as target_link_libraries(tgt PRIVATE $<$<CONFIG:Debug>:iface_debug>) where the `iface_debug` target has `INTERFACE_SOURCES`. Fix this by also tracking config-dependence of the list of libraries for evaluation of the list of source files. Fixes: #20683
* | | | cmGeneratorTarget: Factor evaluated target prop entries into structBrad King2020-05-121-57/+54
| | | | | | | | | | | | | | | | This will allow storing more than just the list of entries itself.
* | | | cmGeneratorTarget: Track when the set of link libs is config-dependentBrad King2020-05-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Report in `cmLinkImplementationLibraries` and `cmLinkInterfaceLibraries` whether the list of libraries depends on a genex referencing the configuration. We already track whether a genex references the head target.
* | | | Merge topic 'stdstring-getsafeprop'Brad King2020-05-011-5/+8
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 53675adbcf GetSafeProperty: return std::string const& Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4683
| * | | | GetSafeProperty: return std::string const&Vitaly Stakhovsky2020-04-301-5/+8
| | | | |
* | | | | Merge topic 'stl-support'Brad King2020-05-011-2/+1
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | 8d4a9ee398 Refactoring: rename "cm_static_string_view.hxx" as <cmext/string_view> Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4689
| * | | | Refactoring: rename "cm_static_string_view.hxx" as <cmext/string_view>Marc Chevrier2020-04-301-2/+1
| | | | |
* | | | | cmGeneratorTarget::GetProperty: return cmPropVitaly Stakhovsky2020-04-291-194/+193
|/ / / /
* | | | CUDA: Device linking use now link optionsMarc Chevrier2020-04-191-62/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Genex: Add generator expressions $<DEVICE_LINK> and $<HOST_LINK>Marc Chevrier2020-04-191-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | These generator expressions can only be used in link options properties. These expressions return the arguments respectively for device and host link step, otherwise return an empty string.
* | | | Refactoring: add cm::contains to <cmext/algorithm>Marc Chevrier2020-04-171-16/+18
| | | |
* | | | Merge topic 'cuda_architectures'Brad King2020-04-161-0/+89
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | | CUDA: Add CUDA_ARCHITECTURES target propertyRaul Tambre2020-04-151-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | cmSourceFile::GetProperty: return cmPropVitaly Stakhovsky2020-04-141-6/+6
|/ / / /
* | | | clang-tidy: address bugprone-branch-clone lintsBen Boeckel2020-04-131-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge topic 'pch-ios-multi-arch'Brad King2020-04-031-27/+41
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f593b354da PCH: Add support for multi architecture iOS projects Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4561
| * | | | PCH: Add support for multi architecture iOS projectsCristian Adam2020-04-021-27/+41
| | | | | | | | | | | | | | | | | | | | Fixes: #20497
* | | | | cmTarget::GetProperty: return cmPropVitaly Stakhovsky2020-03-301-6/+7
|/ / / /
* | | | Merge topic 'pch-warn-invalid'Brad King2020-03-271-2/+16
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2ce08e5489 PCH: add an option to disable `-Winvalid-pch` Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4499
| * | | | PCH: add an option to disable `-Winvalid-pch`Cristian Adam2020-03-261-2/+16
| | | | | | | | | | | | | | | | | | | | Fixes: #20295
* | | | | replace "std::string::find(x) == 0" with cmHasPrefix()Rolf Eike Beer2020-03-231-2/+2
| | | | |
* | | | | cmTarget: minor code improvementsVitaly Stakhovsky2020-03-171-1/+1
|/ / / /
* | | | cmTargetPropertyComputer::GetProperty: return cmPropVitaly Stakhovsky2020-03-161-4/+4
| | | |
* | | | Swift: Propagate Swift_MODULE_DIRECTORY as include directorySaleem Abdulrasool2020-03-121-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach include directory computation for Swift to implicitly propagate the `Swift_MODULE_DIRECTORY` of all linked targets as include directories. This is required to ensure that the swiftmodule of a linked target is accessible to the compiler of the current target. Fixes: #19272
* | | | Add support for FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>Alexandru Croitor2020-03-041-4/+40
| | | |
* | | | Merge topic 'Genex-LINK_LANGUAGE'Brad King2020-02-271-34/+130
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 461efa7b51 Genex: Add $<LINK_LANGUAGE:...> and $<LINK_LANG_AND_ID:...> Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4244
| * | | | Genex: Add $<LINK_LANGUAGE:...> and $<LINK_LANG_AND_ID:...>Marc Chevrier2020-02-261-34/+130
| | |/ / | |/| | | | | | | | | | | | | | | | | | This MR may help to solve issues #19757 and #18008 Fixes: #19965
* | | | Merge topic 'pch-file-time'Brad King2020-02-271-0/+13
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | 7e9b9fe918 PCH: Copy the timestamp from an absolute header file Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4400