Commit Graph

13109 Commits

Author SHA1 Message Date
Brad King
ffd8537acf Clang: Record Clang 16.0 C++ modules flags only for GNU-like front-end
The settings added by commit 3fe8e33f27 (Clang: Record Clang 16.0 flags
for our experimental C++ modules support, 2023-03-03, v3.26.0-rc6~6^2)
work only for the GNU-like `clang++` front-end, and not for the
MSVC-like `clang-cl` on Windows.

Also quote the path to `clang-scan-deps` to support spaces in its path.

Issue: #24611
2023-03-20 13:13:08 -04:00
Brad King
5e5a21aadd Merge topic 'CMakePackageConfigHelpers-ARCH_INDEPENDENT' into release-3.26
6988ddf8ac WriteBasicConfigVersionFile: Fix regression in ARCH_INDEPENDENT check

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8337
2023-03-17 07:54:16 -04:00
Brad King
6988ddf8ac WriteBasicConfigVersionFile: Fix regression in ARCH_INDEPENDENT check
Refactoring in commit 77982de955 (CMakePackageConfigHelpers: only emit
arch check if needed, 2023-01-29, v3.26.0-rc1~16^2) did not correctly
preserve the check for empty `CMAKE_SIZEOF_VOID_P`.  Fix it.

The difference between the version files generated before and after is:

    -if(CMAKE_SIZEOF_VOID_P STREQUAL "" OR "8" STREQUAL "")
    +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")

This restores the check generated before the above-mentioned commit.

Fixes: #24608
2023-03-16 11:26:10 -04:00
scivision
58ab34d88a FindMatlab: add version/release map for R2023a 2023-03-16 11:08:05 -04:00
Brad King
97fcd3bd30 CheckCompilerFlag: Revert 'Match the Clang "argument unused" output ...'
Revert commit 5b45a3d0ce (CheckCompilerFlag: Match the Clang "argument
unused" output for all languages, 2023-01-23, v3.26.0-rc1~38^2).  It
broke existing projects that were silently tolerating unrelated unused
arguments in their checks for C and CXX.  For example, using
`CFLAGS=-nostdinc` or `CXXFLAGS=-nostdinc++` causes those flags to be
used when driving the linker as well, and Clang warns they are unused in
that case.

Add a test case covering the now-restored behavior.

Fixes: #24591
2023-03-13 16:18:50 -04:00
Brad King
5f4dad37f0 Merge topic 'clang-16-cxx-modules' into release-3.26
3fe8e33f27 Clang: Record Clang 16.0 flags for our experimental C++ modules support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !8285
2023-03-06 08:59:20 -05:00
Brad King
9c181ad470 Merge topic 'GoogleTest-type-param-suite' into release-3.26
9aa9032266 GoogleTest: Restore suite name for type-parametrized tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8282
2023-03-06 08:53:40 -05:00
Brad King
3fe8e33f27 Clang: Record Clang 16.0 flags for our experimental C++ modules support
LLVM/Clang 16.0 now contains official support for what CMake needs.
2023-03-03 12:44:53 -05:00
Brad King
9aa9032266 GoogleTest: Restore suite name for type-parametrized tests
Fix a regression from commit 073dd1bd81 (GoogleTest: Change format for
typed tests, 2022-02-07, v3.23.0-rc1~4^2) in the suite name detection.

Co-authored-by: Evgeniy Shcherbina <ixsci@pm.me>
Fixes: #24563
2023-03-03 10:38:02 -05:00
Brad King
cb1b95886b Merge topic 'ExternalProject-revert-install' into release-3.26
771387523a ExternalProject: Restore driving install through build system

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Craig Scott <craig.scott@crascit.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !8279
2023-03-03 09:22:45 -05:00
Brad King
771387523a ExternalProject: Restore driving install through build system
Revert commit 66b5d51f38 (ExternalProject: Install CMake projects
using 'cmake --install', 2022-09-08, v3.25.0-rc1~150^2).
It changed the ExternalProject install step command from:

    cmake --build <dir> --target install --config <cfg>

to:

    cmake --install <dir> --config <cfg>

The latter command no longer runs the external project build system
during the install step.  We could consider using the commands:

    cmake --build <dir> --target all --config <cfg>
    cmake --install <dir> --config <cfg>

as the install step, but if `CMAKE_SKIP_INSTALL_ALL_DEPENDENCY` is
used in the external project, that can change semantics too.

Revert the original change pending further investigation on other ways
to support its motivating use case.  Add a test covering the
previously-regressed use case.

Fixes: #24567
Issue: #23946
2023-03-02 14:28:26 -05:00
Marc Chevrier
764441e672 FindPython: fix erroneous ${CMAKE_SHARED_LIBRARY_SUFFIX} matching
Fixes: #24556
2023-03-01 12:34:13 +01:00
Kyle Edwards
24c7279a6f FindOpenSSL: Search for -pthread flag
Because -pthread doesn't begin with -l, it doesn't show up in the
pkgconfig LIBRARIES variable, causing FindOpenSSL to not add the
Threads::Threads dependency. Explicitly search LDFLAGS_EXTRA
for -pthread and add the dependency if it's found.

Fixes: #24532
2023-02-23 13:31:23 -05:00
Brad King
70ecc3c36a Merge topic 'BundleUtilities-chmod-later' into release-3.26
1430f7f574 BundleUtilities: Avoid unnecessary chmod in fixup_bundle_item

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !8232
2023-02-21 08:38:59 -05:00
Brad King
1430f7f574 BundleUtilities: Avoid unnecessary chmod in fixup_bundle_item
Move the permissions modification added by commit 88fed668b1 (Make
bundle items writable before fixup, 2010-09-07, v2.8.3~129^2) inside the
condition added by commit 45ed314bff (BundleUtilities: do not run
install_name_tool on scripts, 2020-07-27, v3.19.0-rc1~404^2).
There is no reason to add write permissions to a file that we are
not going to modify.

Fixes: #24424
2023-02-20 13:17:04 -05:00
Brad King
a8cedb1572 FindOpenSSL: Fix regression in dependency on threads
Since commit 1b7804edd0 (FindOpenSSL: use extra dependencies from
pkg-config as well, 2022-12-05, v3.26.0-rc1~227^2) we conditionally find
Threads but unconditionally depend on it.  Make the conditions
consistent.

Fixes: #24505
2023-02-20 10:53:42 -05:00
David Truby
3f1e58c5b9 LLVMFlang: Fix post-preprocess compile for fixed-form Fortran
LLVM Flang's preprocessor output is always valid fixed form Fortran with
a fixed line length of 72. If an application tries to use fixed form
with a different line length, this will fail in the
post-preprocessing compilation step as they will pass a flag asking for
a different fixed line length.

To fix this we can pass -ffixed-line-length-72 to the post-preprocess
compilation stage. This will be ignored when the input is free form
Fortran, and force to a 72 line length when the input is fixed.
2023-02-14 09:22:12 -05:00
Brad King
2a75edb342 LCC: Fix extraction of __LCC__ version components
Previously the logic only worked for major versions of the form `1.xx`.
Fix it to work with versions `2.xx` and above.
2023-02-13 09:29:32 -05:00
Brad King
4ce614eb5a Merge topic 'findopenssl-static-findpkg-fix' into release-3.26
652f34eab9 FindOpenSSL: Use static pkgconfig if OPENSSL_USE_STATIC_LIBS=ON

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8174
2023-02-08 11:37:59 -05:00
Eisuke Kawashima
6d48f48d5d FetchContent: Bump documented example Catch2 to v3.0.1
The previous Catch2 v2.13.4 does not compile on some platforms [1].

[1] https://github.com/catchorg/Catch2/issues/2326
2023-02-07 10:54:25 -05:00
Kyle Edwards
652f34eab9 FindOpenSSL: Use static pkgconfig if OPENSSL_USE_STATIC_LIBS=ON
Fixes: #24395
2023-02-07 10:38:20 -05:00
Brad King
5d40cf45fa Merge topic 'android-ndk-legacy-toolchain' into release-3.26
cb0b9452e8 Android: Provide CMAKE_ANDROID_NDK_VERSION with NDK legacy toolchain file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8170
2023-02-07 09:32:19 -05:00
Brad King
7aee115ff4 Merge topic 'FindCUDAToolkit-nvrtc-builtins' into release-3.26
9688a8ebc2 FindCUDAToolkit: Fix `nvrtc_builtins_static` library name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8162
2023-02-07 09:00:35 -05:00
Brad King
cb0b9452e8 Android: Provide CMAKE_ANDROID_NDK_VERSION with NDK legacy toolchain file
This variable has been provided since commit 746906242d (Android: Detect
NDK version number, 2021-02-26, v3.20.0-rc3~1^2~3) when using CMake's
NDK support or the modern NDK toolchain file.  Since commit 005e2cdfb0
(Android: Do not use gold for ndk >= r22, 2021-02-26, v3.20.0-rc3~1^2)
we need the value in our compiler/platform information files, so provide
it when using the NDK legacy toolchain file too.

Revert commit 1c86e397fe (Android/Clang: Tolerate undefined
CMAKE_ANDROID_NDK_VERSION, 2022-09-16, v3.25.0-rc1~118^2) since the
variable should now always be defined.

Issue: #21772
Fixes: #24386
2023-02-06 17:17:25 -05:00
scivision
b19036d8b3 Help: CheckSource{Compiles,Runs}: fix typo and clarify 2023-02-06 09:55:23 -05:00
Paul Taylor
9688a8ebc2 FindCUDAToolkit: Fix nvrtc_builtins_static library name
Update the change from commit 2a94c762ed (FindCUDAToolkit: Add support
for CUDA::nvrtc_static, 2023-01-20, v3.26.0-rc1~55^2).  The lib is named
`libnvrtc-builtins_static.a`, not `libnvrtc_builtins_static.a`.
2023-02-06 09:36:43 -05:00
Brad King
71f9c1943d FindImageMagick: Fix documentation syntax in usage example 2023-02-01 13:58:23 -05:00
Brad King
ce0139a1df Merge topic '_hm_swift_threads_pthread'
d7963aa9ee FindThreads: Filter -pthread out for compatibility with Swift linker

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8142
2023-02-01 09:09:52 -05:00
Brad King
2f5b0ac34e Merge topic 'CMakePackageConfigHelpers-ARCH_INDEPENDENT'
77982de955 CMakePackageConfigHelpers: only emit arch check if needed

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8133
2023-01-31 09:33:53 -05:00
Harry Mallon
d7963aa9ee FindThreads: Filter -pthread out for compatibility with Swift linker 2023-01-31 09:11:08 +00:00
Brad King
1c4825066b Merge topic 'msvc-showIncludes'
8f82e755f3 Ninja: Fix detection of MSVC showIncludes prefix in Italian
d6e7e4d4a1 Tests: Extend RunCMake.Ninja ShowIncludes cases to cover more languages
9596305c0b Tests: Generalize RunCMake.Ninja ShowIncludes test infrastructure
c6dd4fa21d Tests: Extend RunCMake.Ninja ShowIncludes case with sample path
a9d97492fd Ninja: Record showIncludes detection in configure log

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8129
2023-01-30 10:23:31 -05:00
Andrea Pappacoda
77982de955 CMakePackageConfigHelpers: only emit arch check if needed
Before this patch, the write_basic_package_version_file() function of
the CMakePackageConfigHelpers module always emitted an architecture
check, even if the ARCH_INDEPENDENT option was specified. While this is
not an issue when configuring builds, as the check is skipped, this can
create issues when the "arch independent" version files are installed in
the datadir (e.g. /usr/share) in a MultiArch environment like Debian,
where different architecture packages of the same libraries can be
coinstalled; as the amd64 version of a given library contains "8 * 8"
in the file, while the i386 one contains "4 * 8", there's a conflict, as
files in /usr/share are expected to be identical across architectures.

This patch fixes this issue by only emitting the architecture check code
if needed; when ARCH_INDEPENDENT is specified, no code is written at
all.

Here's a diff between the version files generated before and after this
patch:

    diff -u old/indep.cmake new/indep.cmake
    --- old/indep.cmake	2023-01-29 13:43:04.840671117 +0100
    +++ new/indep.cmake	2023-01-29 13:57:28.475191551 +0100
    @@ -52,19 +52,3 @@
     endif()

    -# if the installed project requested no architecture check, don't perform the check
    -if("TRUE")
    -  return()
    -endif()
    -
    -# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
    -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
    -  return()
    -endif()
    -
    -# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
    -if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
    -  math(EXPR installedBits "8 * 8")
    -  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
    -  set(PACKAGE_VERSION_UNSUITABLE TRUE)
    -endif()
    diff -u old/no-indep.cmake new/no-indep.cmake
    --- old/no-indep.cmake	2023-01-29 13:42:05.010710508 +0100
    +++ new/no-indep.cmake	2023-01-29 13:57:40.914237219 +0100
    @@ -52,13 +52,8 @@
     endif()

    -# if the installed project requested no architecture check, don't perform the check
    -if("FALSE")
    -  return()
    -endif()
    -
     # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
    -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
    +if(CMAKE_SIZEOF_VOID_P STREQUAL "" OR "8" STREQUAL "")
       return()
     endif()

Fixes: #24375
2023-01-29 14:00:13 +01:00
Brad King
8f82e755f3 Ninja: Fix detection of MSVC showIncludes prefix in Italian
The prefix does not have two colons.  Update our regex.

Fixes: #24357
2023-01-28 07:16:58 -05:00
Brad King
a9d97492fd Ninja: Record showIncludes detection in configure log
Also avoid running the detection multiple times.
2023-01-27 10:55:37 -05:00
hstejas
1bba218214 FindImageMagick: Define targets for specific components
- With this change we can use e.g. ImageMagick::Magick++ directly
  in targt_link_libraries.
- This change also adds CFLAGS which was missing before.
- Also adds example on how to use the targets.
2023-01-27 10:33:10 -05:00
Jiri Malak
e194caa5a3 OpenWatcom: Add correct support for 16-bit Windows
This add correct Open Watcom support for 16-bit Windows 3.x.
It replace existing strange mixture with WIN32 stuff which implement 16-bit Windows target partially as part of WIN32 stuff.
Now pre-defined OS ID Windows3x is used instead of confusing WIN32.
It support properly 16-bit and 32-bit application for 16-bit Windows host.
32-bit applications are build with OW WIN386 extender.

It is used similar as for other platforms by set CMAKE_SYSTEM_NAME=Windows3x and CMAKE_SYSTEM_PROCESSOR=I86 for 16-bit application or CMAKE_SYSTEM_PROCESSOR=x86 for 32-bit WIN386 extender application running on 16-bit Windows 3.x.
CMAKE_SYSTEM_NAME=Windows is used only for WIN32 applications.
2023-01-25 17:53:03 +01:00
Brad King
950effe434 Merge topic 'CheckCompilerFlag-clang'
5b45a3d0ce CheckCompilerFlag: Match the Clang "argument unused" output for all languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8117
2023-01-25 11:19:21 -05:00
Brad King
d1ba79da4f Merge topic 'FindOpenMP-test-include-dir'
6e53d74147 FindOpenMP: Use OpenMP_<lang>_INCLUDE_DIR

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8110
2023-01-25 11:17:46 -05:00
KOLANICH
5b45a3d0ce CheckCompilerFlag: Match the Clang "argument unused" output for all languages
Improve detection of missing compiler flags: move "argument unused
during compilation: .*" pattern from language-specific branches into
the common list.
2023-01-24 17:17:36 -05:00
Jiri Malak
10623a51a0 OpenWatcom: Refactor population of standard include directories
Add setup of system include directories to language related macro to remove extra lines for C and CXX.
System include directories are always same for both languages (they are defined per platform).
2023-01-24 20:44:11 +01:00
Brad King
62483b9b99 Merge topic 'gen-pkg-example'
bfa61ccf64 Help: Modernize PackageConfigHelpers example

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8111
2023-01-24 09:20:49 -05:00
Brad King
caf5aea63f Merge topic 'FindPython-CMP0007-NEW'
486b3c0850 FindPython: Policy CMP0007 must be set to NEW

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8104
2023-01-24 09:19:16 -05:00
Brad King
4db877ce9a Merge topic 'FindPython-CMP0007-NEW' into release-3.25
486b3c0850 FindPython: Policy CMP0007 must be set to NEW

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8104
2023-01-24 09:19:14 -05:00
FeRD (Frank Dana)
bfa61ccf64 Help: Modernize PackageConfigHelpers example
The example shown in the module documentation for
CMakePackageConfigHelpers was showing its age, by:

1. Hardcoding directory prefixes (`etc/`, `lib/`, etc.) instead of
   using GNUInstallDirs
2. Handwaving `set()` commands (incorrectly!) as:
     `set(VAR dir/ ... CACHE )`
   which should, at the very least, be:
     `set(VAR dir/ CACHE ... )`
3. Installing CMake configuration files to `lib/Foo/cmake/`, when
   current practice favors `${CMAKE_INSTALL_LIBDIR}/cmake/Foo/`

This updated example addresses all of those issues.
2023-01-23 18:02:31 -05:00
Andrey Alekseenko
6e53d74147 FindOpenMP: Use OpenMP_<lang>_INCLUDE_DIR
If `OpenMP_<lang>_INCLUDE_DIR` is defined, add it to the list of include
directories before checking flags. Previously, this variable was
ignored for all compilers but AppleClang, despite the documentation
mentioning it as one of the possible inputs.

Fixes: #24260
2023-01-23 19:37:26 +01:00
Brad King
c9fc146a93 Merge topic 'find_cudatoolkit_add_nvrtc_static'
2a94c762ed FindCUDAToolkit: Add support for CUDA::nvrtc_static

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8100
2023-01-23 10:40:05 -05:00
Brad King
f07fdb250c Merge topic 'FindOpenSP-pkg-config-hints'
3b1c19f00a FindOpenSP: Use pkg-config only as hints for main code path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8097
2023-01-23 10:35:52 -05:00
Marc Chevrier
486b3c0850 FindPython: Policy CMP0007 must be set to NEW
Fixes: #24306
2023-01-21 15:08:21 +01:00
Robert Maynard
2a94c762ed FindCUDAToolkit: Add support for CUDA::nvrtc_static 2023-01-20 12:05:43 -05:00
Kefu Chai
3b1c19f00a FindOpenSP: Use pkg-config only as hints for main code path
before this change, pkg_check_modules(.. IMPORTED_TARGET GLOBAL)
is used for creating an imported target from which another imported
interface library named OpenSP::OpenSP is created. but pkg-config
does not account for all of CMake's other search behavior controls,
such as CMAKE_FIND_ROOT_PATH. neither does it export the full path
with OpenSP_LIBRARY.

after this change, the paths found by pkg-config are only used
as hints for the find_*() commands. and some cleanup are included:

* be QUIET when calling find_package(PkgConfig ..) and
  pkg_check_modules(..) as they are distracting from user's point of
  view. what matters is the output of find_package_handle_standard_args()
* parse the version and check for the existance of symbol as long as
  header path is found. because they only use header files.
* define OpenSP_LIBRARY as long as it exists. this just follows
  the convention. as OpenSP_FOUND implies a valid OpenSP_LIBRARY.
* wrap and intent multi-line command calls for better readability
* check OpenSP_FOUND before adding OpenSP::OpenSP, it's more
  idiomatic.

Fixes: #24313
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2023-01-20 10:14:39 -05:00