Commit Graph

12223 Commits

Author SHA1 Message Date
Brad King
0d0831e481 Merge topic 'default-extensions'
4ef6e27cb9 CompilerId: Fix default extensions check for Clang targeting MSVC ABI

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !6949
2022-02-04 08:20:23 -05:00
Brad King
cf68f52875 Merge topic 'ep-patch-USES_TERMINAL'
cbb87e0a2c ExternalProject: Add support for USES_TERMINAL_PATCH keyword

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6940
2022-02-04 08:18:13 -05:00
Brad King
56aac8cf50 Merge topic 'GoogleTest-discover-spaces-in-parameters'
fd6b8fa40e GoogleTest: Preserve spaces in test parameters

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6941
2022-02-04 08:13:07 -05:00
Brad King
4ef6e27cb9 CompilerId: Fix default extensions check for Clang targeting MSVC ABI
In commit fc3a1cbdd8 (CompilerID: Compiler extensions default detection,
2021-05-29, v3.22.0-rc1~52^2~2), extensions were assumed to be `OFF`
for Clang targeting the MSVC ABI.  However, the `clang` and `clang++`
tools both seem to have extensions enabled by default even when
targeting the MSVC ABI.

This can be observed with the `RunCMake.CompileFeatures` test.
It fails with the GNU-like `clang/clang++` front-end, but removing
the above special case makes it pass.  The test passes either way
with the MSVC-like `clang-cl` front-end.
2022-02-03 12:06:00 -05:00
Craig Scott
cbb87e0a2c ExternalProject: Add support for USES_TERMINAL_PATCH keyword
This brings the patch step into line with all the others which already
had their own `USES_TERMINAL_<step>` keyword. All steps (including
patch) already have their own `LOG_<step>` keyword too, so the lack of
`USES_TERMINAL_PATCH` was inconsistent.
2022-02-03 09:27:35 -05:00
Brad King
23b1d8f03c CheckPIESupported: Document version adding support for more languages 2022-02-03 07:53:45 -05:00
Evgeniy Shcherbina
fd6b8fa40e GoogleTest: Preserve spaces in test parameters
Before the fix the gtest_discover_tests() function would strip the
user data in test parameters (everything to the right of GetParam())
of spaces. Now the parameters aren't altered in any way.

Fixes #23058
2022-02-03 14:12:53 +03:00
Brad King
9245925810 Merge topic 'cuda_generic_arch_all'
8f64df0a7c CUDA: Generic all and all-major support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !6816
2022-02-02 08:23:19 -05:00
Brad King
1e1e04db75 Merge topic 'ep-redownload-on-SOURCE_DIR-change'
d3477eba06 ExternalProject: Rerun download on SOURCE_DIR change

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6926
2022-02-02 08:17:51 -05:00
Raul Tambre
8f64df0a7c CUDA: Generic all and all-major support
Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags,
2021-08-17) added all and all-major options to CUDA_ARCHITECTURES. These are
fairly generic and likely to see real-world use by distributors. Thus it's
desirable to support these also for Clang and older NVCC versions.

The supported architectures are dependent on the toolkit version. We determine
the toolkit version prior to compiler detection. For NVCC we get the version
from the vendor identification output, but for Clang we need to invoke NVCC
separately.

The architecture information is mostly based on the Wikipedia list with the
earliest supported version being CUDA 7.0. This could be documented and
expanded in the future to allow projects to query CUDA toolkit version and
architecture information.
For Clang we additionally constrain based on its support.

Additionally the architecture mismatch detection logic is fixed, improved and
updated for generic support:
* Commit 01428c55 (CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work
  during detection, 2020-08-29) enabled CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS
  if CMAKE_CUDA_ARCHITECTURES is specified. This results in
  CMakeDetermineCompilerID.cmake printing the compiler error and our code for
  presenting the mismatch in a user-friendly way being useless. The custom
  logic seems preferable so go back to not enabling it.
* Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags,
  2021-08-17) tried to support CMP0054 but forgot to add x to the interpolated
  result. Thus the conditions would always evaluate to false. This is fixed as
  a byproduct of removing NVIDIA specific checks, improving the error message
  and replacing architectures_mode with a simpler architectures_explicit.

Visual Studio support omits testing the flags during detection due to
complexities in determining the toolkit version when using it.
A long-term proper implementation would be #23161.

Implements #22860.
2022-02-01 18:25:20 +02:00
Brad King
6bbbd42e19 Merge topic 'FindHDF5-imported-per-config'
db9d911db0 FindHDF5: Set config-specific locations for imported targets
d28e5263fe FindHDF5: Drop IMPORTED_IMPLIB property from imported UNKNOWN libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6931
2022-02-01 10:35:32 -05:00
Brad King
9d439dfd1b Merge topic 'feature/findruby-3x'
6b6bc7791d FindRuby: evict non-matching binaries and keep scanning.
42d99a248e FindRuby: add support for versions up to 3.1.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6925
2022-02-01 10:31:39 -05:00
Brad King
e7e5ebd0e3 Merge topic 'cpack_nsis_no_description'
b56e0f4689 CPack/NSIS: Fix description not displayed for components

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6920
2022-02-01 10:30:55 -05:00
Craig Scott
d3477eba06 ExternalProject: Rerun download on SOURCE_DIR change
Fixes: #21748
2022-02-01 22:31:29 +11:00
Brad King
db9d911db0 FindHDF5: Set config-specific locations for imported targets
Update the imported target locations added by commit a8e0a6b3e4
(FindHDF5: Port changes from VTK, 2020-06-10, v3.19.0-rc1~312^2~1) to
use config-specific locations.

Issue: #21637
2022-01-31 17:42:39 -05:00
Brad King
d28e5263fe FindHDF5: Drop IMPORTED_IMPLIB property from imported UNKNOWN libraries
The imported targets added by commit a8e0a6b3e4 (FindHDF5: Port changes
from VTK, 2020-06-10, v3.19.0-rc1~312^2~1) to use config-specific
locations set the `IMPORTED_IMPLIB` target property.  That property has
no meaning for an imported library with type `UNKNOWN`.  Drop it to
avoid confusion.
2022-01-31 17:16:37 -05:00
Brad King
8035784967 Merge topic 'iar_cmp0057'
cc4da8d13a IAR/CXX: Fix compatibility with CMP0057 OLD

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6921
2022-01-31 10:31:31 -05:00
Mihai Moldovan
6b6bc7791d FindRuby: evict non-matching binaries and keep scanning.
The possible executable names list always starts with a plain "ruby"
binary, which is scanned for first. If that does exist (which satisfies
find_program), but doesn't match the requested version, the executable
will be dismissed by _RUBY_VALIDATE_INTERPRETER (which is sane), but
searching also stops.

Fix that by keeping the search going, removing items from the list as we
go, until find_program returns a path that _RUBY_VALIDATE_INTERPRETER is
happy with or the list is empty.
2022-01-31 05:57:42 +01:00
Mihai Moldovan
42d99a248e FindRuby: add support for versions up to 3.1. 2022-01-31 05:51:36 +01:00
Raul Tambre
cc4da8d13a IAR/CXX: Fix compatibility with CMP0057 OLD
Commit a9073db7 (IAR: update language specification detection, 2021-09-23)
added usage of the if() IN_LIST operation and forgot to account for it not
being available in CMP0057 OLD mode.
Push and temporarily enable the policy. Also avoid the unnecessary temporary
variable for the list.

Fixes #23147.
2022-01-29 22:55:24 +02:00
Johnny Jazeix
b56e0f4689 CPack/NSIS: Fix description not displayed for components
Fixes: #23151
2022-01-29 18:02:46 +01:00
Brad King
55b4e3318d Merge topic 'FindOpenSSL-wince'
b5a21b0d84 FindOpenSSL: Fix ws2 reference on WinCE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6914
2022-01-29 06:51:45 -05:00
Brad King
07e2eb50f0 IBMClang: Do not use -fvisibility on AIX
Use of `-fvisibility=hidden` fails:

  unsupported option '-fvisibility=hidden' for target 'powerpc-ibm-aix7.2.0.0'

Apply the change from commit 4feba34d02 (GNU: Do not use -fvisibility on
AIX or HP-UX, 2016-09-03, v3.7.0-rc1~173^2~2) to IBMClang also.

Issue: #23157
2022-01-28 15:43:21 -05:00
leha-bot
b5a21b0d84 FindOpenSSL: Fix ws2 reference on WinCE
Fixes: #23070
2022-01-28 11:21:52 -05:00
Brad King
6108352f0a Merge topic 'ibmclang-compiler'
8c1731546c Help: Add release note for IBM Open XL C/C++ compiler support
24da80b70a Utilities: Suppress warnings in third-party code with IBMClang
6da99e671c IBMClang: Add support for IBM Open XL C/C++

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6785
2022-01-28 09:50:15 -05:00
Raul Tambre
daf372c4d6 CUDA: Fix issuing error if default architecture detection fails
We require CUDA_ARCHITECTURES to be set for targets (see CMP0104). If not set
anything after compiler detection such as ABI detection will fail to generate.
This means we need to error if CMAKE_CUDA_ARCHITECTURES is not set to a valid
value as a result of compiler detection.

Currently we fail to issue the error if compiler detection failed and the ID is
unset. In such a case we won't define detected_architecture making the code
responsible for the error unreachable.

Simplify the detection of architectures used during compiler detection by
always detecting all of them, which enables us to simply the check in the
"default to compiler" path if CMAKE_CUDA_ARCHITECTURES is empty.
As a result we need to move the error checking and CMAKE_CUDA_ARCHITECTURES=OFF
handling fully into the default path thus simplifying the code and unifying the
code paths for NVCC and CUDA.
This also happens to fix:
1. CMAKE_CUDA_ARCHITECTURES=OFF on Clang.
2. A theoretical issue of a compiler defaulting to multiple architectures.

I've additionally added printing of the compiler output along the error to
better reveal possible underlying compiler/system configuration issues.

Fixes #23010.
2022-01-27 22:11:13 +02:00
Raul Tambre
7a0d098352 CUDA: Error on empty/invalid CMAKE_CUDA_ARCHITECTURES set by user
If empty we otherwise treat it the same as unset in most places, but still end
up failing eventually with a confusing "Failed to find a working CUDA
architecture".

This also detects some other basic invalid ones (e.g. "al").
2022-01-27 22:11:13 +02:00
Raul Tambre
5f667d783a CUDA: Actually use reverse architecture deprecation order for Clang
The code now matches what the comment describes.
This mistake seems to have been present since the initial introduction in
commit 5df21adf (CUDA: Add support for Clang compiler, 2020-05-07).
2022-01-27 21:43:22 +02:00
Brad King
6a037fd9f4 Merge topic 'FindThreads-libc-pthread-flag' into release-3.22
5efb6fb516 FindThreads: Honor THREADS_PREFER_PTHREAD_FLAG when pthread is found in libc

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6906
2022-01-27 11:04:06 -05:00
Aaron Liu
6da99e671c IBMClang: Add support for IBM Open XL C/C++
Fixes: #22929
2022-01-27 09:38:01 -05:00
David Berard
f590ea506a FindCUDA: Make version extraction robust to empty output
I found that `NVCC_OUT` was sometimes empty when I was building.
2022-01-26 14:07:17 -05:00
Mattias Ellert
5efb6fb516 FindThreads: Honor THREADS_PREFER_PTHREAD_FLAG when pthread is found in libc
The `-pthread` flag tells the compiler/linker to link to additional
libraries needed for thread support (e.g. libatomic on riscv64). The
flag therefore should be used if requested using
`THREADS_PREFER_PTHREAD_FLAG` also when the pthread functions are
found in libc.
2022-01-26 08:50:16 -05:00
Brad King
6d778ea6db Merge topic 'FindMPI-static-first'
036d0cbbde FindMPI: Place static first in mpi test source

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6900
2022-01-26 08:04:15 -05:00
Brad King
e2035fb0f9 Merge topic 'FindXercesC-NAMES_PER_DIR'
47cbc08594 FindXercesC: Use NAMES_PER_DIR

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6898
2022-01-26 08:03:16 -05:00
Brad King
036d0cbbde FindMPI: Place static first in mpi test source
Move the `static` added by commit 8cce0ad32f (FindMPI: Fix missing
static warning in the mpi test source, 2021-06-30, v3.22.0-rc1~502^2) to
the beginning of the line.

Fixes: #23141
2022-01-25 09:53:24 -05:00
jpfeuffer
47cbc08594 FindXercesC: Use NAMES_PER_DIR
This was missing for us for Xerces.

Issue: #20882
2022-01-25 08:30:21 -05:00
Brad King
fccdf99c39 Merge topic 'FindCUDAToolkit-doc'
5067b6b6ee FindCUDAToolkit: Remove duplicated targets in docs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6892
2022-01-25 08:26:13 -05:00
Guo
5067b6b6ee FindCUDAToolkit: Remove duplicated targets in docs
Also remove an unfinished sentence.
2022-01-24 14:02:58 -05:00
Brad King
d5e3b1ca1e Merge topic 'cmp0128_cuda'
ee1396e29e CMP0128: Add flag in OLD mode even when standard matches the default
b2c25de8e0 CMP0128: Avoid test code duplication
3a089cd256 CMP0128: Prefix test names with mode
e13dd52535 XL: Detect default extensions mode for legacy compiler

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6890
2022-01-24 12:37:52 -05:00
Raul Tambre
e13dd52535 XL: Detect default extensions mode for legacy compiler
The legacy non-Clang variant seems to support a GNU-like extensions mode, which
is the default. Enable detection for it.
2022-01-23 23:10:28 +02:00
Craig Scott
5fbac2bb24 ExternalProject: Move inline scripts to separate files
This makes the scripts easier to work on, since the separate files
don't require the extra level of escaping that the inlined code did.
This also means the scripts can be rendered with appropriate
syntax highlighting in IDEs, etc.
2022-01-22 23:00:26 +11:00
Craig Scott
8feaa41ee9 ExternalProject: Ensure _ep_set_directories records cmake paths 2022-01-22 17:36:39 +11:00
Craig Scott
036517fe0b ExternalProject: Move existing step scripts to separate subdirectory
This is in preparation for moving more inline content to separate
scripts as well. Having them in a separate subdirectory is consistent
with other modules and will make them easier to find and work with.
2022-01-22 16:24:16 +11:00
Brad King
74eb6c5316 Merge topic 'CheckPIESUpported-supports-SYSROOT'
219dde4ea8 CheckPIESupported: now uses any SYSROOT settings
4fa105d34e Check{Compiler,Linker}Flag: Add possibility to retrieve check outputs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6877
2022-01-20 12:01:14 -05:00
Brad King
79589f7dfe Merge topic 'FortranCInterface-gcc-12-lto'
6a0ce19ce1 FortranCInterface: Fix compatibility with GCC gfortran 12 LTO

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6879
2022-01-20 11:58:05 -05:00
Björn Esser
6a0ce19ce1 FortranCInterface: Fix compatibility with GCC gfortran 12 LTO
Since version 12.0 the GCC Fortran compiler has implemented "WG5/N1942",
which causes, if link-time opmization is enabled, obfuscation of hard-coded
string values in the compiler objects and its resulting ELF-binaries.

This causes the CMake-internal detection of the mangling scheme for the
naming of subroutines to fail.  Thus we must ensure to have any link-time
optimization features to be disabled on the executable file we perform the
detection on.

The static libraries, however, must be build with LTO and non-LTO objects,
as that will ensure the verify step will operate on IPO objects, if building
those is requested by the system compiler flags.

Fixes: #23123

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
2022-01-19 20:47:38 +01:00
Marc Chevrier
219dde4ea8 CheckPIESupported: now uses any SYSROOT settings
Fixes: 23053
2022-01-19 10:49:23 +01:00
Marc Chevrier
4fa105d34e Check{Compiler,Linker}Flag: Add possibility to retrieve check outputs 2022-01-19 10:49:23 +01:00
Brad King
9e38bfa915 CPack/DMG: Add explicit option to use CPACK_RESOURCE_FILE_LICENSE for SLA
Since macOS 12.0, the ``hdiutil udifrez`` and ``hdiutil udifderez``
commands to embed and extract resources in a disk image are deprecated.
The CPack DragNDrop Generator uses these to attach the SLA specified by
the `CPACK_RESOURCE_FILE_LICENSE` option.  Since that option is shared
by multiple CPack generators, we cannot deprecate it.  Instead, add an
explicit option to control the behavior.  This will give projects a way
to package on future macOS versions that remove the commands.

In order to provide a long-term transition away from attaching SLAs to
disk images, update `cpack` to default this behavior to OFF.  To retain
compatibility for CMake projects, teach the CPack module to default the
option to ON.  Later a policy can be added to change the default.

Issue: #22978
2022-01-18 15:39:51 -05:00
Brad King
a2e42a577b Merge topic 'cuda_host_env'
70f5d9eb49 CUDA: Fix CMAKE_CUDA_COMPILER_ARG1 cache description
ad6cd1074b Help: Correct CUDAHOSTCXX and CUDAARCHS as having higher precedence

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6872
2022-01-18 12:12:09 -05:00