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
diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml
index bd13646..bf8e8b6 100644
--- a/.gitlab/artifacts.yml
+++ b/.gitlab/artifacts.yml
@@ -71,6 +71,8 @@
.cmake_release_artifacts:
artifacts:
expire_in: 5d
+ # Release artifacts are of interest even for failed jobs.
+ when: always
paths:
# Any packages made.
- build/cmake-*-linux-x86_64.*
@@ -83,6 +85,8 @@
.cmake_test_artifacts:
artifacts:
expire_in: 1d
+ # External testing can be useful even if test jobs fail.
+ when: always
paths:
# Take the install tree.
- build/install/
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index 7fe6277..1ce96b3 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -7,7 +7,7 @@
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
# TODO: Factor this out so that each job selects the Xcode version to
# use so that different versions can be tested in a single pipeline.
- DEVELOPER_DIR: "/Applications/Xcode-12.3.app/Contents/Developer"
+ DEVELOPER_DIR: "/Applications/Xcode-12.4.app/Contents/Developer"
# Avoid conflicting with other projects running on the same machine.
SCCACHE_SERVER_PORT: 4227
@@ -70,6 +70,7 @@
variables:
CMAKE_CONFIGURATION: macos_x86_64_xcode
CMAKE_GENERATOR: Xcode
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
.macos_arm64_xcode:
extends: .macos
@@ -77,6 +78,7 @@
variables:
CMAKE_CONFIGURATION: macos_arm64_xcode
CMAKE_GENERATOR: Xcode
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
## Tags
@@ -85,7 +87,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.3
+ - xcode-12.4
- nonconcurrent
.macos_x86_64_builder_tags_package:
@@ -93,7 +95,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.3
+ - xcode-12.4
- nonconcurrent
- finder
@@ -102,7 +104,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.3
+ - xcode-12.4
- concurrent
.macos_arm64_builder_tags:
@@ -110,7 +112,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-12.3
+ - xcode-12.4
- nonconcurrent
.macos_arm64_builder_ext_tags:
@@ -118,7 +120,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-12.3
+ - xcode-12.4
- concurrent
## macOS-specific scripts
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index 1fff2bb..3e9634d 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -50,6 +50,7 @@
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_GENERATOR_PLATFORM: "x64"
CMAKE_GENERATOR_TOOLSET: "v142,version=14.28"
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
## Tags
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index e8c527d..b3e5342 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -38,6 +38,8 @@
rules:
- if: '$CMAKE_CI_PACKAGE == "true"'
when: never
+ - if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_NIGHTLY_IGNORE_DEPS == "true")'
+ when: always
- if: '$CMAKE_CI_NIGHTLY == "true"'
when: on_success
- if: '($CMAKE_CI_NO_MR == "true" && $CI_MERGE_REQUEST_ID)'
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt
index e3cf711..17ad952 100644
--- a/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt
@@ -26,5 +26,5 @@
install(EXPORT AdditionTargets
FILE MathFunctionsAdditionTargets.cmake
NAMESPACE MathFunctions::
- DESTINATION lib/cmake
+ DESTINATION lib/cmake/MathFunctions
)
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt
index 4e3496d..fd95e28 100644
--- a/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt
@@ -24,7 +24,7 @@
# create config file
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
- INSTALL_DESTINATION lib/cmake
+ INSTALL_DESTINATION lib/cmake/MathFunctions
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
@@ -32,5 +32,5 @@
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake"
- DESTINATION lib/cmake
+ DESTINATION lib/cmake/MathFunctions
)
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
index ffa1e3d..be5ae65 100644
--- a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
@@ -26,5 +26,5 @@
install(EXPORT SquareRootTargets
FILE MathFunctionsSquareRootTargets.cmake
NAMESPACE MathFunctions::
- DESTINATION lib/cmake
+ DESTINATION lib/cmake/MathFunctions
)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 1be570e..1595cfd 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -1,6 +1,17 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
+macro(__determine_compiler_id_test testflags_in userflags)
+ separate_arguments(testflags UNIX_COMMAND "${testflags_in}")
+ CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}")
+ CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
+
+ if(NOT CMAKE_${lang}_COMPILER_ID)
+ foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
+ CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ endforeach()
+ endif()
+endmacro()
# Function to compile a source file to identify the compiler. This is
# used internally by CMake and should not be included by user code.
@@ -24,29 +35,36 @@
# Compute the directory in which to run the test.
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
- # Try building with no extra flags and then try each set
- # of helper flags. Stop when the compiler is identified.
- foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
- foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
- ""
- ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
- separate_arguments(testflags UNIX_COMMAND "${testflags}")
- CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}")
- CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
+ # If we REQUIRE_SUCCESS, i.e. TEST_FLAGS_FIRST has the correct flags, we still need to
+ # try two combinations: with COMPILER_ID_FLAGS (from user) and without (see issue #21869).
+ if(CMAKE_${lang}_COMPILER_ID_REQUIRE_SUCCESS)
+ # If there COMPILER_ID_FLAGS is empty we can error for the first invocation.
+ if("${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" STREQUAL "")
+ set(__compiler_id_require_success TRUE)
+ endif()
+
+ foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
+ __determine_compiler_id_test("${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}" "${userflags}")
if(CMAKE_${lang}_COMPILER_ID)
break()
endif()
- foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
- CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ set(__compiler_id_require_success TRUE)
+ endforeach()
+ else()
+ # Try building with no extra flags and then try each set
+ # of helper flags. Stop when the compiler is identified.
+ foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
+ foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
+ __determine_compiler_id_test("${testflags}" "${userflags}")
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
+ endif()
endforeach()
if(CMAKE_${lang}_COMPILER_ID)
break()
endif()
endforeach()
- if(CMAKE_${lang}_COMPILER_ID)
- break()
- endif()
- endforeach()
+ endif()
# Check if compiler id detection gave us the compiler tool.
if(CMAKE_${lang}_COMPILER_ID_TOOL)
@@ -653,7 +671,7 @@
# Some languages may know the correct/desired set of flags and want to fail right away if they don't work.
# This is currently only used by CUDA.
- if(CMAKE_${lang}_COMPILER_ID_REQUIRE_SUCCESS)
+ if(__compiler_id_require_success)
message(FATAL_ERROR "${MSG}")
endif()
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 4766102..d6d1c00 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -465,7 +465,7 @@
# ::GLX is a GLVND library, and thus Linux-only: we don't bother checking
# for a framework version of this library.
- if(OpenGL_GLX_FOUND AND NOT TARGET OpenGL::GLX)
+ if(OpenGL_GLX_FOUND AND NOT TARGET OpenGL::GLX AND TARGET OpenGL::OpenGL)
if(IS_ABSOLUTE "${OPENGL_glx_LIBRARY}")
add_library(OpenGL::GLX UNKNOWN IMPORTED)
set_target_properties(OpenGL::GLX PROPERTIES IMPORTED_LOCATION