Commit Graph

11429 Commits

Author SHA1 Message Date
Raul Tambre
05f8c8178d GNU: C++17 default version
Changed in GCC commit 0801f419440c14f6772b28f763ad7d40f7f7a580, released in 11.1.
2021-05-10 10:19:13 -04:00
Brad King
b2f1345aaf Merge topic 'FindBoost-1.76' into release-3.20
79be37b94e FindBoost: Add support for Boost 1.76

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6100
2021-05-10 10:06:52 -04:00
Craig Scott
5e941a545b ExternalProject: Ensure git fetch if updating to hash we don't have yet
In ac6a4d4884 (ExternalProject: Improve robustness of update step,
2020-10-17), the method used to check whether we already have a
commit or not was changed from using git rev-list to git rev-parse.
The new logic assumed rev-parse would output nothing if given a commit
hash it didn't know about, but it simply prints the hash again without
raising an error in this scenario. Amend that logic by adding ^{commit} to
the ref to ensure we do get an error if that ref is not currently known.

Fixes: #22166
2021-05-09 12:33:16 +10:00
Brad King
fdbb5a599f Merge topic 'improve_cuda_toolkit_extraction_regex' into release-3.20
5e931c5a97 CUDA: improve regex for CUDA Toolkit root from nvcc verbose output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !6094
2021-05-07 09:12:08 -04:00
Brad King
79be37b94e FindBoost: Add support for Boost 1.76
Update the list of known versions.

Run the command

    cmake -DBOOST_DIR=/path/to/boost_1_76_0 \
      -P Utilities/Scripts/BoostScanDeps.cmake

to extract dependencies from the 1.76.0 source tree.
They are the same as 1.75's dependencies, so just update
the version check for warning about newer versions.

Fixes: #22167
2021-05-07 08:57:43 -04:00
Robert Maynard
5e931c5a97 CUDA: improve regex for CUDA Toolkit root from nvcc verbose output
The original regular expression was greedy and would match any
environment variable ending with `TOP` (like `DESKTOP`). This is an
issue on windows where `nvcc -v` would output all environment variables
before the compiler's verbose output.

To resolve this issue we use a tighter match algorithm that looks
for `#$ TOP=` instead of `TOP=`.

Fixes: #22158
2021-05-06 12:08:24 -04:00
Brad King
c33fb2e664 BinUtils: Use more-private temporary variable names
Since commit 4d786dfcfa (BinUtils: Avoid clobbering a variable named
without a private prefix, 2021-04-06, v3.20.1~4^2) we use variables
named `_tool` and `_name`, but these may still be common enough to
affect project code.  Use `_CMAKE_TOOL` and `_CMAKE_TOOL_NAME` instead,
and unset them when finished.

Fixes: #22140
2021-05-04 12:44:14 -04:00
Brad King
9c479c7c40 IntelLLVM: Add special case for ifx 2021.1 version extraction
The ifx beta versions forgot to define `__INTEL_LLVM_COMPILER`, and
instead define `__INTEL_COMPILER == 201900`.  Add a special case.

Issue: #22120
2021-04-28 10:21:27 -04:00
Brad King
b7193ab18f Intel: Update Classic compiler version detection for 2021
The value of the `__INTEL_COMPILER` macro changed convention starting
in version 2021.

Fixes: #22120
2021-04-28 10:20:59 -04:00
Brad King
1f4ec3f4a7 Help: Do not recommend WCDH in cmake-compile-features(7)
Since commit da7ad7997e (WriteCompilerDetectionHeader: Add policy to
remove module, 2020-12-04, v3.20.0-rc1~350^2), the WCDH module is
deprecated.  Update the `cmake-compile-features(7)` manual section that
previously recommended WCDH to make such detection the project's
responsibility instead.  Move the old content of the section over to the
WCDH module to preserve it.
2021-04-23 10:44:53 -04:00
Lihua Zhao
4c741d945a BinUtils: Restore toolchain prefix detection from compiler name 'c++'
Since commit b12aec6c8d (BinUtils: prefer bin utils matching the
compiler version extension, 2020-12-11, v3.20.0-rc1~171^2) we recognize
`clangg++` and `g++` but not `c++`.  Restore `[gc]` in place of `g`
in the regex, as we had before that change.

Fixes: #22069
2021-04-16 09:20:16 -04:00
Brad King
9be8441c20 Merge topic 'flags-with-backslash' into release-3.20
3953dfcb31 Restore support for backslashes in initial language-wide flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5995
2021-04-08 07:47:08 -04:00
Brad King
6d27dd3d98 Merge topic 'cuda-depfile-ccbin' into release-3.20
8e38985db7 Makefiles: Fix dependency extraction with CUDA < 10.2 and host compiler

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !5992
2021-04-08 07:46:14 -04:00
Brad King
3953dfcb31 Restore support for backslashes in initial language-wide flags
Refactoring in commit bdc40742bd (CMakeDetermineCompilerId: Test without
COMPILER_ID_FLAGS if REQUIRE_SUCCESS, 2021-02-27, v3.20.0-rc3~6^2) added
an extra macro layer through which flag strings are passed.  That caused
an extra level of argument re-parsing, and broke flags with backslashes.
Pass flags to the helper macro through variable names instead.

Fixes: #22041
2021-04-07 13:53:22 -04:00
Brad King
9ef82d95d8 FindBLAS: Fix detection of OpenMP as dependency of BLA_STATIC
Update the change from commit f7f3d8987a (FindBLAS: Add dependency of
OpenBLAS on OpenMP for BLA_STATIC, 2020-11-10, v3.20.0-rc1~492^2):

* If C is not enabled, find CXX OpenMP libraries instead.

* Do not use BLA_STATIC's custom CMAKE_FIND_LIBRARY_SUFFIXES for OpenMP.
  It can break projects that already call `find_package(OpenMP)` and
  expect a shared library.  Whether OpenMP is static is orthogonal to
  whether BLAS is static.

Fixes: #22039
Issue: #16221
2021-04-07 11:26:07 -04:00
Brad King
8e38985db7 Makefiles: Fix dependency extraction with CUDA < 10.2 and host compiler
Since commit 2c71d051fa (Makefiles Generators: use compiler for
dependencies generation, 2020-10-18, v3.20.0-rc1~392^2) we invoke `nvcc`
for CUDA < 10.2 a second time in order to generate a depfile.  When
`CMAKE_CUDA_HOST_COMPILER` is set, the second invocation is missing its
`-ccbin=` option, even after refactoring in commit 8981e3e7cc
(NVIDIA-CUDA: rely on new capabilities for deps generation, 2020-12-02,
v3.20.0-rc1~362^2).

Ideally we should move the `-ccbin=` flag into `Compiler/NVIDIA-CUDA`,
but that will add `CMAKE_CUDA_HOST_COMPILER` support on Windows in
command-line generators but not the Visual Studio generators.
For now, add the flag to the depfile command specifically.

Fixes: #22037
2021-04-07 10:54:27 -04:00
Brad King
f8af94a212 Merge topic 'binutils-var-private' into release-3.20
4d786dfcfa BinUtils: Avoid clobbering a variable named without a private prefix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5986
2021-04-07 10:08:08 -04:00
Brad King
196376a33e Merge topic 'ios-rpath-linker-flag' into release-3.20
4aed96e230 Apple: Set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG on non-macOS too

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5980
2021-04-07 10:06:55 -04:00
Brad King
4d786dfcfa BinUtils: Avoid clobbering a variable named without a private prefix
Refactoring in commit b12aec6c8d (BinUtils: prefer bin utils matching
the compiler version extension, 2020-12-11, v3.20.0-rc1~171^2)
accidentally leaked a `TOOL` variable.  Name temporary variables with a
private prefix.

Fixes: #22035
2021-04-07 08:43:45 -04:00
Brad King
e061a201b6 Merge topic 'nvhpc-lib-arch' into release-3.20
764606e256 CMakeDetermineCompilerABI: Extract lib arch from implicit object file paths
5d44d73bbe CMakeDetermineCompilerABI: Revert "Parse library arch from versioned paths"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5984
2021-04-06 08:32:34 -04:00
Brad King
2d6a3fd626 Merge topic 'UseSWIG-policies' into release-3.20
c3d0b25514 UseSWIG: Transform swig depfile to match Ninja generator paths
8c525d7e16 UseSWIG: Run using policy settings from includer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5983
2021-04-06 08:31:40 -04:00
Craig Scott
4aed96e230 Apple: Set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG on non-macOS too
Since CMake 3.19, we no longer support macOS SDKs older than 10.5,
which corresponds to Xcode 3. Supporting older Xcode versions for
device platforms is also not realistic. We therefore expect the -rpath
linker option should always be supported now.

When targeting iOS, tvOS or watchOS, the previous disabling of -rpath
support meant that the install_name_dir of shared libraries and
frameworks was unable to use @rpath. This resulted in embedding
absolute paths for their install_name. When they were embedded in an
app bundle, this would cause the app to fail at runtime. By enabling the
-rpath linker option, the default install_name_dir is now @rpath for these platforms, which results in binaries that do work at runtime.

Fixes: #20036
2021-04-06 11:46:56 +10:00
Robert Maynard
764606e256 CMakeDetermineCompilerABI: Extract lib arch from implicit object file paths
The NVHPC compiler does not have any implicit link directories that can
be used to detect `CMAKE_LIBRARY_ARCHITECTURE`, but it does have
implicit object files.  Extract implicit object file paths from link
lines and check them for the `CMAKE_LIBRARY_ARCHITECTURE` pattern.

Issue: #22024
2021-04-05 17:41:10 -04:00
Robert Maynard
5d44d73bbe CMakeDetermineCompilerABI: Revert "Parse library arch from versioned paths"
The change in commit 657fc3a9a7 (CMakeDetermineCompilerABI: Parse
library arch from versioned paths, 2021-02-03, v3.20.0-rc1~40^2) caused
`CMAKE_LIBRARY_ARCHITECTURE` to be populated on non-multiarch platforms
if their compilers happen to use `$arch/$version` library directories.
Revert the use of versioned library paths.

Fixes: #22024
2021-04-05 16:40:43 -04:00
Brad King
c3d0b25514 UseSWIG: Transform swig depfile to match Ninja generator paths
Since commit 89b01b04fa (UseSWIG: use swig tool to generate
dependencies, 2021-01-12, v3.20.0-rc1~120^2) we use a tool-provided
depfile to extract dependencies under the Ninja generator.  Enable
`CMP0116` to ensure depfile paths are translated to match what the Ninja
generator writes to the build manfiest.

Fixes: #22029
2021-04-05 14:36:34 -04:00
Marc Chevrier
8c525d7e16 UseSWIG: Run using policy settings from includer
Backport commit de7f0aa6c0 (UseSWIG: avoid spurious policy warnings,
2021-02-11) to the 3.20 release branch.  Projects need to be able to
control policies.

Issue: #22029
2021-04-05 14:00:03 -04:00
Ben Boeckel
ff84a80b46 FindHDF5: search for the new Fortran HL library name
HDF5 1.10.6 renamed this library to match the other language binding
library names.

Fixes: #20205
2021-04-05 11:56:50 -04:00
Marc Chevrier
666f689e48 FindMPI: avoid host link options to be propagated to device link step
Fixes: #21887
2021-04-01 16:23:08 +02:00
Justin LaPolla
258faaeef6 Cray: Detect Fortran compiler version patch level if available
Fixes: #21969
2021-03-31 09:30:48 -04:00
Haibo Huang
61e6fc26bc Android: Fix search for binutils
Set `CMAKE_SYSTEM_PROGRAM_PATH` in `Platform/Android-Initialize` instead
of `Platform/Android` so it can be used in `CMakeFindBinUtils`.

Also add the names `llvm-strip` and `llvm-ranlib` for the corresponding
tools.
2021-03-30 10:06:02 -04:00
Brad King
16b4d5fc84 Merge topic 'GNUInstallDirs-doc' into release-3.20
06171fd7aa GNUInstallDirs: Clarify that CMAKE_INSTALL_<dir> may be absolute

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5947
2021-03-30 09:52:07 -04:00
Brad King
06171fd7aa GNUInstallDirs: Clarify that CMAKE_INSTALL_<dir> may be absolute
Fixes: #21991
2021-03-29 09:45:27 -04:00
Brad King
e34d64c04d FindIntl: Fix detection of intl built in to C library
Since commit c30d06b7e6 (FindIntl: Add imported target, 2020-10-06,
v3.20.0-rc1~687^2) we use `check_symbol_exists` to check whether the
`intl` library is built in to the C library.  On some platforms the
tested symbols are provided as macros so the check passes without
linking any symbol.  Instead, check whether a sample source file both
compiles and links.

Fixes: #21979
2021-03-26 11:01:34 -04:00
Sibi Siddharthan
cb0d1a49e6 FindIntl: Improve documentation formatting
Backport from commit a9b11a06f5 (FindIntl: Add version support, 2021-02-23).
2021-03-26 10:38:53 -04:00
Brad King
d6acaa7bbd Merge topic 'FindPkgConfig-NAMES_PER_DIR' into release-3.20
c7bd2d0d97 FindPkgConfig: Restore preference for first pkg-config in PATH

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5914
2021-03-17 09:38:47 -04:00
Brad King
75aa444fd8 Merge topic 'FindOpenMP-IntelLLVM-Windows' into release-3.20
6fd014a4b6 FindOpenMP: Use -Qiopenmp instead of -fiopenmp for IntelLLVM on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5904
2021-03-17 09:15:54 -04:00
Brad King
c7bd2d0d97 FindPkgConfig: Restore preference for first pkg-config in PATH
Since commit ab8bd48352 (FindPkgConfig: Search for pkg-config.bat file
on a Windows host, 2020-09-25, v3.19.0-rc1~98^2) we prefer
`pkg-config.bat` over `pkg-config` regardless of the order they appear
in the `PATH`.  Tell `find_program` to consider all names in each
directory so that the first one in `PATH` of any name wins.

Issue: #21239
2021-03-16 09:04:56 -04:00
William R. Dieter
6fd014a4b6 FindOpenMP: Use -Qiopenmp instead of -fiopenmp for IntelLLVM on Windows
The Windows driver does not like the `-f` form of this option.

Note that we prefer `-Qiopenmp/-fiopenmp` over `-Qopenmp/-fopenmp` in
order to generate LLVM IR with parallelization information, which the
backend uses to generate parallelized code.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2021-03-15 14:43:23 -04:00
Michael Hirsch
427f5f2fa9 FindMatlab: R2021a version map 2021-03-15 09:10:07 -04:00
Brad King
f59a3e2148 Merge topic 'cray-compiler-wrapper-detection' into release-3.20
13144e82cd Cray: Enable Cray compiler wrapper detection on all platforms

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5897
2021-03-11 08:09:32 -05:00
Justin LaPolla
13144e82cd Cray: Enable Cray compiler wrapper detection on all platforms
Previously were checking for the `__CRAYXC` and `__CRAYXE` predefined
macros.  These macros reflect the platform that the compiler wrapper is
running on, i.e. Cray XC and Cray XE machines.  They are not defined on
other platforms such as Apollo80.

Switch to the `__CRAYXT_COMPUTE_LINUX_TARGET` macro. The Cray cc/CC/ftn
wrappers always define this macro on the command line. This macro has
been in use for many years, and is believed to be a reliable way to
detect current and older Cray compiler wrappers.

Fixes: #21904
2021-03-10 12:13:17 -05:00
Brad King
ccfa0852c0 Merge topic 'ep-fc-revert-refactoring' into release-3.20
57d442e182 Revert ExternalProject and FetchContent refactoring

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5898
2021-03-10 11:37:15 -05:00
Craig Scott
57d442e182 Revert ExternalProject and FetchContent refactoring
Refactoring of the ExternalProject and FetchContent modules moved
the commands into CMake scripts. This broke custom commands that
used shell redirection or special build tool variables of the form
$(MakeVar). Undo the sequence of commits that performed this
refactoring and follow-up fixes associated with it.

The following commits are reverted by this change:

4f3d1abbb4 (ExternalProject: Refactor pre-configure steps to support
no-target uses, 2021-02-05)

17e5516e60 (FetchContent: Invoke steps directly and avoid a separate
sub-build, 2021-01-29)

bd876f3849 (FetchContent: Restore patch command support,
2021-02-18)

404cddb7bb (ExternalProject: Fix misuse of IS_NEWER_THAN in
timestamp checks, 2021-02-21)

b0da671243 (FetchContent: Don't update timestamps if files don't
change, 2021-02-18)

Fixes: #21892
2021-03-10 09:07:44 +11:00
Silvio Traversaro
5ba1f4b6ee FindMatlab: Fix Matlab_LIBRARIES for MCR
In commit bda5e2ac8f (FindMatlab: Only include engine and dataarray
libraries if they are found, 2020-12-11, v3.20.0-rc1~297^2~1) we fixed
the imported target to contain optional libraries only if they are
found.  Do the same for `Matlab_LIBRARIES`.
2021-03-09 12:56:08 -05:00
Brad King
22909e0def Merge topic 'CrayPrgEnv-detection' into release-3.20
23b101de60 Revert "Cray: Fix Cray compiler detection on new platforms"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5889
2021-03-09 09:15:43 -05:00
Brad King
23b101de60 Revert "Cray: Fix Cray compiler detection on new platforms"
The justification in commit 9ee4a42813 (Cray: Fix Cray compiler
detection on new platforms, 2020-12-01, v3.19.2~26^2) confuses detection
of the CrayPrgEnv with identification of the Cray compiler.  The
change regressed detection of the CrayPrgEnv on non-Cray compilers.
Revert it pending further investigation into the original problem.

Fixes: #21894
2021-03-08 12:28:36 -05:00
Brad King
ef513fe3d1 Cray: Enable explicit Fortran preprocessing for Ninja generator
Cray 11.0 adds support for preprocessing with output written to a
specified file (instead of always next to the source).  Use it to
enable Cray Fortran with the Ninja generator.

Patch-by: James Elliott
Fixes: #20731
2021-03-05 08:11:05 -05:00
Brad King
ef3d1ebda8 Merge topic 'android-r22' into release-3.20
005e2cdfb0 Android: Do not use gold for ndk >= r22
ed7a87f270 Tests: Update RunCMake.Android for NDK r22
4950d35733 Help: Document CMAKE_ANDROID_NDK_VERSION variable
746906242d Android: Detect NDK version number

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5862
2021-03-03 11:11:58 -05:00
Haibo Huang
005e2cdfb0 Android: Do not use gold for ndk >= r22
Fixes: #21772
2021-03-03 10:28:56 -05:00
Haibo Huang
746906242d Android: Detect NDK version number
Report it in `CMAKE_ANDROID_NDK_VERSION`.
2021-03-03 10:26:36 -05:00