Commit Graph

12557 Commits

Author SHA1 Message Date
Brad King
746bed40f2 Merge topic 'lcc-liblfortran-renamed' into release-3.24
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7407
2022-06-28 09:15:23 -04:00
Igor Molchanov
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03
Since LCC 1.26.03, compiler developers decided to rename
liblfortran to libgfortran (internal reference: mcstbug#131633),
and despite it's stated that "-llfortran will be automatically
treated as -lgfortran", it actually does not work (and there's
even no symlinks like liblfortran.* -> libgfortran.*); so we
have to explicitly choose which library we have to link in.

Fixes: #23646
2022-06-27 13:02:53 -04:00
Brad King
0c2066f2d9 Merge topic 'ipo_append_auto_on_gcc' into release-3.24
fe57410b33 IPO: Use -flto=auto if compiler is GCC >= 10.1

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7400
2022-06-23 09:24:58 -04:00
Brad King
7e4adcac82 FindPkgConfig: Revert "Populate _STATIC_LINK_LIBRARIES. Add STATIC_TARGET."
Revert commit 020976d637 (FindPkgConfig: Populate
_STATIC_LINK_LIBRARIES. Add STATIC_TARGET., 2021-12-31,
v3.24.0-rc1~105^2).  Several regressions have been reported.
Revert the feature pending further discussion and design work.

Issue: #21714
Fixes: #23642
2022-06-22 10:13:00 -04:00
Linus Dierheimer
fe57410b33 IPO: Use -flto=auto if compiler is GCC >= 10.1
Since GCC 12.1, the `-flto` option warns unless given an explicit
LTRANS job count.

Issue: #23640
2022-06-22 09:09:16 -04:00
Brad King
aae6a67e5c Merge topic 'FetchContent-doc-example' into release-3.24
641d97e03f FetchContent: Fix example code in documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !7393
2022-06-22 08:50:26 -04:00
Brad King
e38783f16b Merge topic 'FindMPI-l-colon' into release-3.24
a606609499 FindMPI: Parse '-l:' flags in pkg-config output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7392
2022-06-22 08:49:31 -04:00
Brad King
0b86798a53 Merge topic 'xcode14' into release-3.24
7c79fde5fb Xcode: automatically create Info.plist for signing during compiler id
116cc5a57b cm_cxx_features: filter out warnings from Xcode 14

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7391
2022-06-22 08:47:37 -04:00
Brad King
5022b42f8b ExternalProject: Fix regression in stamp creation for Xcode+iOS
The change to `_ep_add_mkdir_command` in commit 5fbac2bb24
(ExternalProject: Move inline scripts to separate files, 2022-01-22,
v3.23.0-rc1~101^2) did not account for the possibility that
`CMAKE_CFG_INTDIR` is `$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)`
instead of just the configuration name.  Pass the value into the helper
script on the command line so that the native buildsystem placeholders
are evaluated.

Fixes: #23645
2022-06-21 18:27:44 -04:00
Brad King
7b622f3e80 ExternalProject: Fix regression in stamp creation for Xcode+iOS
The change to `_ep_add_mkdir_command` in commit 5fbac2bb24
(ExternalProject: Move inline scripts to separate files, 2022-01-22,
v3.23.0-rc1~101^2) did not account for the possibility that
`CMAKE_CFG_INTDIR` is `$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)`
instead of just the configuration name.  Pass the value into the helper
script on the command line so that the native buildsystem placeholders
are evaluated.

Fixes: #23645
2022-06-21 18:26:22 -04:00
Markus Mützel
a606609499 FindMPI: Parse '-l:' flags in pkg-config output
With the msmpi package in MSYS2:

    $ pkg-config --libs msmpi
    -LC:/msys64/mingw64/lib -l:libmsmpi.dll.a

MSYS2-Issue: https://github.com/msys2/MINGW-packages/pull/11839
Fixes: #23620
2022-06-21 12:38:30 -04:00
pigeon
641d97e03f FetchContent: Fix example code in documentation 2022-06-21 12:31:00 -04:00
Gregor Jasny
7c79fde5fb Xcode: automatically create Info.plist for signing during compiler id
Extend the Xcode 14 update from commit 89e1113e0c (Xcode: Use ad-hoc
signing during compiler id on macOS, 2022-06-10, v3.24.0-rc1~13^2~2).
2022-06-21 10:49:45 -04:00
Brad King
012eb49263 Merge topic 'fetchcontent-global-targets' into release-3.24
f19b48e0b8 FetchContent: Honor CMAKE_FIND_PACKAGE_TARGETS_GLOBAL
1305bade56 Help: Add missing version directive for find_package() GLOBAL keyword

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7347
2022-06-11 06:13:57 -04:00
Brad King
61c357a021 Merge topic 'xcode-14' into release-3.24
627c08e28b Tests: Teach RunCMake to ignore Xcode DVTSDK warnings
ab40020b17 Xcode: Suppress "Run Script" build phase warning during compiler id
89e1113e0c Xcode: Use ad-hoc signing during compiler id on macOS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7350
2022-06-11 05:39:10 -04:00
Brad King
65f2e9263c Merge branch 'xcode-14' into release-3.23
Merge-request: !7350
2022-06-11 05:37:53 -04:00
Brad King
ab40020b17 Xcode: Suppress "Run Script" build phase warning during compiler id
warning: Run script build phase 'Run Script' will be run during every
    build because it does not specify any outputs.
2022-06-10 14:24:03 -04:00
Brad King
89e1113e0c Xcode: Use ad-hoc signing during compiler id on macOS
Xcode 14 no longer accepts an empty signing identity for macOS.
However, Xcode in general does not accept an ad-hoc signing
identity for iOS.  Switch based on the target platform.

Fixes: #23609
2022-06-10 14:22:40 -04:00
Brad King
ec6d574d4a Merge topic 'ExternalProject-stamp-genex' into release-3.24
c111d440ce ExternalProject: Express per-config step stamp file paths using CONFIG genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7341
2022-06-10 11:10:23 -04:00
Brad King
ec08bc1752 CheckIPOSupported: Compile check using flags of calling project
Forward `CMAKE_<LANG>_FLAGS` and `CMAKE_<LANG>_FLAGS_DEBUG` from the
calling project into the test project.  The set of flags may affect the
availability of IPO support.  Since this may change the result of the
check for existing projects, add a policy for compatibility.

This was discovered after commit 5fcadc481e (MSVC: Default to -ZI
instead of /Zi for x86 and x64, 2022-05-24) introduced policy CMP0138 to
switch our default for MSVC's debug info flag.  The `-ZI` flag is
incompatible with the `-GL` flag used for IPO, so CMP0138 was reverted
pending future work on an alternative solution.  Re-use the CMP0138
policy number for this change to CheckIPOSupported instead.

Fixes: #23607
2022-06-10 09:12:43 -04:00
Craig Scott
f19b48e0b8 FetchContent: Honor CMAKE_FIND_PACKAGE_TARGETS_GLOBAL
Fixes: #23606
2022-06-10 21:49:38 +10:00
Brad King
7d73e88d3a MSVC: Revert "Default to -ZI instead of /Zi for x86 and x64"
Revert commit 5fcadc481e (MSVC: Default to -ZI instead of /Zi for x86
and x64, 2022-05-24).  The `-ZI` flag is incompatible with the `-GL`
flag used for IPO, and so is not an unconditionally better default.
Revert the change pending future design of a first-class setting for
MSVC debug info format that can be automatically reconciled with IPO
settings.

That commit introduced policy CMP0138, but we already have later policy
numbers used too.  Leave placeholder text to avoid policy renumbering.

Issue: #23607, #10189
2022-06-09 12:24:33 -04:00
Brad King
9d43059132 Merge topic 'doc-using-deps-guide' into release-3.24
92e93f5c9e Help: Overhaul and expand the Using Dependencies Guide

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !7332
2022-06-09 09:03:13 -04:00
Craig Scott
92e93f5c9e Help: Overhaul and expand the Using Dependencies Guide
The guide previously only focused on the find_package() command,
with a bias towards libraries. FetchContent was not mentioned at all.
Reorganise and update the existing content. Add new sections to cover
providing dependencies with FetchContent and dependency providers.
Improve discoverability of the guide by mentioning it at the beginning
of the find_package(), FetchContent and dependency provider docs.
2022-06-09 22:55:11 +10:00
Brad King
c111d440ce ExternalProject: Express per-config step stamp file paths using CONFIG genex
The ExternalProject module has long used the generator-specific
placeholder in the `${CMAKE_CFG_INTDIR}` variable to express per-config
stamp file paths in multi-config generators.  Now that most generators
support generator expressions in custom command outputs, we can use
the `$<CONFIG>` genex instead.

In particular, this fixes cross-config `BUILD_BYPRODUCTS` with the Ninja
Multi-Config generator.

Fixes: #23595
2022-06-08 15:13:27 -04:00
Brad King
bdd44eca9b Merge topic 'print-sources'
d8dcfa7776 Tests: Add tests for CMakePrintHelpers
b7ddfcfe08 cmake_print_properties(): Update grammar docs
e52b9e1270 PrintHelpers: Document argument order restriction
d87ed4d88f PrintHelpers: Fix indentation
5fa70e1738 PrintHelpers: Rewrite a few more error messages
2579503f45 PrintHelpers: Fix target SOURCES property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7331
2022-06-07 10:55:29 -04:00
FeRD (Frank Dana)
b7ddfcfe08 cmake_print_properties(): Update grammar docs 2022-06-06 12:27:11 -04:00
FeRD (Frank Dana)
e52b9e1270 PrintHelpers: Document argument order restriction 2022-06-06 12:27:11 -04:00
FeRD (Frank Dana)
d87ed4d88f PrintHelpers: Fix indentation 2022-06-06 12:27:11 -04:00
FeRD (Frank Dana)
5fa70e1738 PrintHelpers: Rewrite a few more error messages 2022-06-06 12:27:09 -04:00
FeRD (Frank Dana)
2579503f45 PrintHelpers: Fix target SOURCES property
It's been a long-standing bug in CMakePrintHelpers that the
cmake_print_properties() function cannot print the SOURCES
property of a requested TARGET, confusing it with a request
to print properties of SOURCES.

We work around this by parsing the arguments in two stages,
so that a SOURCES that comes after the PROPERTIES keyword
is handled differently from a SOURCES that comes before it.

This adds the restriction that the "mode" keyword (TARGETS
SOURCES DIRECTORIES etc...) and its arguments **must** precede
the PROPERTIES keyword and its arguments. In other words:

1. Both of these are now valid and will be interpreted correctly,
   whereas previously only the first was, and the second caused
   a FATAL_ERROR:

   cmake_print_properties(SOURCES foo.c PROPERTIES LANGUAGE)
   cmake_print_properties(TARGETS foo PROPERTIES SOURCES)

2. This, OTOH, which used to be valid, no longer is, and will
   trigger a FATAL_ERROR:

   cmake_print_properties(PROPERTIES LANGUAGE SOURCES foo.c)

Fixes: #14883
2022-06-06 12:25:51 -04:00
Marc Chevrier
8de50bae84 FindPython*: enhance interpreter lookup
Fixes: #23588
2022-06-05 14:44:04 +02:00
Brad King
3715c154c8 Merge topic 'FindOpenSSL3_applink'
4a6caef9d5 FindOpenSSL: Set version variables for version >= 3.0.0

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7305
2022-06-03 09:43:53 -04:00
Brad King
16ad65c5a2 Merge topic 'envmod'
fcddb1cd5f FindEnvModules: BUGFIX: env_module_swap OUTPUT_VARIBLE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7315
2022-06-03 09:43:05 -04:00
Brad King
ac2952792a Merge topic 'GNUInstallDirs-opt-homebrew'
8de3983b4c GNUInstallDirs: Do not treat /opt/homebrew as under /opt

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7318
2022-06-03 09:41:37 -04:00
James Calo
4a6caef9d5 FindOpenSSL: Set version variables for version >= 3.0.0
The variables `OPENSSL_VERSION_MAJOR`, `OPENSSL_VERSION_MINOR` and
`OPENSSL_VERSION_FIX` are now set to the correct values when using
OpenSSL version >= 3.0.0, which uses a new format.
2022-06-02 11:14:45 -04:00
Brad King
8de3983b4c GNUInstallDirs: Do not treat /opt/homebrew as under /opt
Fixes: #23579
2022-06-02 10:04:35 -04:00
Craig Scott
c2044fdf3f FetchContent: Respect the CMP0135 policy setting
Fixes: #23560
2022-06-02 11:10:27 +10:00
Michael Hirsch
fcddb1cd5f FindEnvModules: BUGFIX: env_module_swap OUTPUT_VARIBLE
Since originally added to CMake, env_module_swap(OUTPUT_VARIABLE)
did not give output since the incorrect variable name was used.
2022-06-01 16:50:44 -04:00
Marc Chevrier
e8ce8f0858 Merge topic 'findjava'
3acbe073ba FindJava: improve failure/verbosity when 'java -version' fails

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7299
2022-06-01 08:11:37 -04:00
Seth R Johnson
3acbe073ba FindJava: improve failure/verbosity when 'java -version' fails
On macOS monterey, `java -version` returns
```
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

```
which does not match the existing regex. Instead of hitting a fatal error if required,
reset the variable and let FindPackage handle the result.

If `QUIET` is requested, don't print anything if the version query fails. Otherwise, print the message.

Additionally, clean up temporary variables set by the execute_process commands.
2022-05-31 07:34:49 -04:00
Brad King
49e31d9c55 Merge topic 'msvc-compilers-default-to-ZI'
5fcadc481e MSVC: Default to -ZI instead of /Zi for x86 and x64

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7295
2022-05-27 09:10:43 -04:00
Brad King
9019537670 MSYS/MinGW Makfiles: Select the compiler occurring first in PATH
Extend the change from commit e01990999a (Ninja: On Windows, select the
compiler occurring first in PATH, 2020-04-17, v3.18.0-rc1~291^2) to
apply to the MSYS/MinGW Makefiles generators too.  Drop the implied
`gcc` and `g++` default compilers.  This allows MinGW/Clang environments
to work out of the box.

Inspired-by: Mehdi Chinoune <mehdi.chinoune@hotmail.com>
Fixes: #23542
2022-05-26 13:22:58 -04:00
Glen Chung
5fcadc481e MSVC: Default to -ZI instead of /Zi for x86 and x64
Add a policy for compatibility.

For more information, see [1].

[1] https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170

Fixes: #10189
2022-05-26 09:06:01 -04:00
Brad King
711496b672 Merge topic 'LLVMFlang-compiler'
85749766df LLVMFlang: Add support for LLVM Flang

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7246
2022-05-26 08:52:02 -04:00
Brad King
5dcf505f63 Merge topic 'dependency-providers'
2aa83fa15b Dependency providers: Add find_package and FetchContent support
8a28368feb FetchContent: Don't discard non-empty SOURCE_DIR and BINARY_DIR
8ce9bb8a0c FetchContent: Don't leak internal variables
74a6ddc339 cmFindPackageCommand: Handle Makefile variable definitions more robustly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Gerhard Olsson <gerhard.nospam@gmail.com>
Merge-request: !7276
2022-05-25 07:24:48 -04:00
Brad King
7120221e24 Merge topic 'cpack-component-special-chars'
11ac6751a8 CPack: Support component names with special characters, too

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7290
2022-05-25 07:20:58 -04:00
Craig Scott
2aa83fa15b Dependency providers: Add find_package and FetchContent support
Fixes: #22619
2022-05-25 08:46:18 +10:00
Deniz Bahadir
11ac6751a8 CPack: Support component names with special characters, too
The macros `cpack_append_variable_set_command` and
`cpack_append_string_variable_set_command` became functions, in order to
support arguments with special characters (e.g. `:`).
2022-05-24 19:07:36 +02:00
Tin Huynh
85749766df LLVMFlang: Add support for LLVM Flang
LLVM Flang (https://github.com/llvm/llvm-project/tree/main/flang) is an LLVM
Fortran compiler that shares the same name as Flang (also known as Classic
Flang). Classic Flang is in active development and is already identified by
CMake as Flang. As such, LLVM Flang will be identified as `LLVMFlang`.

Fixes: #22387
2022-05-24 10:37:33 -04:00