summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml60
-rw-r--r--.gitlab/ci/ctest_exclusions.cmake9
-rw-r--r--.gitlab/ci/ctest_test_external.cmake5
-rw-r--r--.gitlab/ci/gitlab_ci.cmake6
-rw-r--r--.gitlab/os-linux.yml54
-rw-r--r--.gitlab/rules.yml15
-rw-r--r--Help/dev/maint.rst18
-rw-r--r--Help/release/dev/FindPython-version_range.rst5
-rw-r--r--Help/release/dev/FindSWIG-version-range.rst4
-rw-r--r--Help/release/dev/genexpr-for-mfc-flag.rst4
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst1
-rw-r--r--Help/variable/CMAKE_MFC_FLAG.rst3
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake1
-rw-r--r--Modules/CMakeDetermineSystem.cmake19
-rw-r--r--Modules/Compiler/IntelClang-DetermineCompiler.cmake7
-rw-r--r--Modules/FindPython.cmake52
-rw-r--r--Modules/FindPython/Support.cmake409
-rw-r--r--Modules/FindPython2.cmake4
-rw-r--r--Modules/FindPython3.cmake4
-rw-r--r--Modules/FindSWIG.cmake41
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake11
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx18
-rw-r--r--Source/cmCMakeLanguageCommand.cxx12
-rw-r--r--Source/cmCPluginAPI.cxx9
-rw-r--r--Source/cmConfigure.cmake.h.in1
-rw-r--r--Source/cmFindPackageCommand.cxx9
-rw-r--r--Source/cmForEachCommand.cxx2
-rw-r--r--Source/cmFunctionBlocker.cxx4
-rw-r--r--Source/cmFunctionCommand.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmIfCommand.cxx23
-rw-r--r--Source/cmListFileCache.cxx23
-rw-r--r--Source/cmListFileCache.h57
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx14
-rw-r--r--Source/cmMacroCommand.cxx15
-rw-r--r--Source/cmMakefile.cxx42
-rw-r--r--Source/cmMakefileProfilingData.cxx6
-rw-r--r--Source/cmMakefileProfilingData.h2
-rw-r--r--Source/cmSystemTools.cxx28
-rw-r--r--Source/cmSystemTools.h1
-rw-r--r--Source/cmVariableWatchCommand.cxx9
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx15
-rw-r--r--Source/cmWhileCommand.cxx2
-rw-r--r--Tests/Assembler/CMakeLists.txt7
-rw-r--r--Tests/FindPython/ArtifactsInteractive/CMakeLists.txt2
-rw-r--r--Tests/FindPython/CMakeLists.txt104
-rw-r--r--Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt2
-rw-r--r--Tests/FindPython/ExactVersion/CMakeLists.txt36
-rw-r--r--Tests/FindPython/Implementation/CMakeLists.txt6
-rw-r--r--Tests/FindPython/IronPython/CMakeLists.txt8
-rw-r--r--Tests/FindPython/IronPython2/CMakeLists.txt8
-rw-r--r--Tests/FindPython/PyPy/CMakeLists.txt12
-rw-r--r--Tests/FindPython/PyPy2/CMakeLists.txt12
-rw-r--r--Tests/FindPython/PyPy3/CMakeLists.txt12
-rw-r--r--Tests/FindPython/Python/CMakeLists.txt8
-rw-r--r--Tests/FindPython/Python2/CMakeLists.txt10
-rw-r--r--Tests/FindPython/Python2Embedded/CMakeLists.txt4
-rw-r--r--Tests/FindPython/Python2Module/CMakeLists.txt4
-rw-r--r--Tests/FindPython/Python3/CMakeLists.txt10
-rw-r--r--Tests/FindPython/Python3Embedded/CMakeLists.txt4
-rw-r--r--Tests/FindPython/Python3Module/CMakeLists.txt4
-rw-r--r--Tests/FindPython/RequiredArtifacts/CMakeLists.txt6
-rw-r--r--Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt8
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt4
-rw-r--r--Tests/FindPython/VersionRange/CMakeLists.txt55
-rw-r--r--Tests/FindPython/VirtualEnv/CMakeLists.txt2
-rw-r--r--Tests/FindPython/VirtualEnvConda/CMakeLists.txt2
-rw-r--r--Tests/MFC/CMakeLists.txt.in3
-rw-r--r--Tests/RunCMake/FindSWIG/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FindSWIG/version-range.cmake30
-rw-r--r--Tests/RunCMake/RunCMake.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/NoImpLib-check.cmake23
-rw-r--r--Tests/RunCMake/VS10Project/NoImpLib.cmake3
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
76 files changed, 1064 insertions, 363 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5c9865e..5f48a02 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,7 +36,7 @@ stages:
# Prep jobs
-prep:source:
+prep:source-package:
extends:
- .linux_prep_source
- .cmake_prep_source_linux
@@ -44,7 +44,7 @@ prep:source:
- .cmake_release_artifacts
- .run_only_for_package
-prep:doc:
+prep:doc-package:
extends:
- .fedora31_sphinx_package
- .cmake_prep_doc_linux
@@ -52,14 +52,14 @@ prep:doc:
- .cmake_doc_artifacts
- .run_only_for_package
-upload:source:
+upload:source-package:
extends:
- .rsync_upload
- .run_only_for_package
dependencies:
- - prep:source
+ - prep:source-package
needs:
- - prep:source
+ - prep:source-package
variables:
RSYNC_DESTINATION: dev
@@ -85,6 +85,9 @@ build:fedora31-sphinx:
- .cmake_build_linux
- .linux_builder_tags_qt
- .run_automatically
+ variables:
+ CMAKE_CI_JOB_CONTINUOUS: "true"
+ CMAKE_CI_JOB_HELP: "true"
# Linux builds
@@ -101,7 +104,7 @@ test:fedora31-makefiles:
- .fedora31_makefiles
- .cmake_test_linux_package
- .linux_builder_tags_qt
- - .run_automatically
+ - .run_dependent
dependencies:
- build:centos6-release
needs:
@@ -112,7 +115,7 @@ test:cuda10.2-nvidia:
- .cuda10.2_nvidia
- .cmake_test_linux_package
- .linux_builder_tags_cuda
- - .run_automatically
+ - .run_dependent
dependencies:
- build:centos6-release
needs:
@@ -132,7 +135,7 @@ test:fedora31-ninja:
- .cmake_test_linux
- .linux_builder_tags_x11
- .cmake_test_artifacts
- - .run_automatically
+ - .run_dependent
dependencies:
- build:fedora31-ninja
needs:
@@ -143,12 +146,35 @@ test:fedora31-ninja-multi:
- .fedora31_ninja_multi
- .cmake_test_linux_external
- .linux_builder_tags_qt
- - .run_automatically
+ - .run_dependent
dependencies:
- test:fedora31-ninja
needs:
- test:fedora31-ninja
+build:linux-x86_64-package:
+ extends:
+ - .linux_package_x86_64
+ - .cmake_build_linux_package
+ - .cmake_release_artifacts
+ - .linux_builder_tags
+ - .run_only_for_package
+ dependencies:
+ - prep:doc-package
+ needs:
+ - prep:doc-package
+
+upload:linux-x86_64-package:
+ extends:
+ - .rsync_upload
+ - .run_only_for_package
+ dependencies:
+ - build:linux-x86_64-package
+ needs:
+ - build:linux-x86_64-package
+ variables:
+ RSYNC_DESTINATION: dev
+
# macOS builds
build:macos-ninja:
@@ -165,7 +191,7 @@ test:macos-ninja:
- .cmake_test_macos
- .cmake_test_artifacts
- .macos_builder_tags
- - .run_automatically
+ - .run_dependent
dependencies:
- build:macos-ninja
needs:
@@ -184,7 +210,7 @@ test:macos-makefiles:
- .macos_makefiles
- .cmake_test_macos
- .macos_builder_tags
- - .run_automatically
+ - .run_dependent
dependencies:
- build:macos-makefiles
needs:
@@ -195,7 +221,7 @@ test:macos-xcode:
- .macos_xcode
- .cmake_test_macos_external
- .macos_builder_ext_tags
- - .run_automatically
+ - .run_dependent
dependencies:
- test:macos-ninja
needs:
@@ -209,11 +235,11 @@ build:macos-package:
- .macos_builder_tags_package
- .run_only_for_package
dependencies:
- - prep:doc
+ - prep:doc-package
needs:
- - prep:doc
+ - prep:doc-package
-upload:macos:
+upload:macos-package:
extends:
- .rsync_upload
- .run_only_for_package
@@ -240,7 +266,7 @@ test:windows-vs2019-x64-ninja:
- .cmake_test_windows
- .windows_builder_tags
- .cmake_test_artifacts
- - .run_automatically
+ - .run_dependent
dependencies:
- build:windows-vs2019-x64-ninja
needs:
@@ -251,7 +277,7 @@ test:windows-vs2019-x64:
- .windows_vs2019_x64
- .cmake_test_windows_external
- .windows_builder_ext_tags
- - .run_automatically
+ - .run_dependent
dependencies:
- test:windows-vs2019-x64-ninja
needs:
diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake
index b885a6a..a68a693 100644
--- a/.gitlab/ci/ctest_exclusions.cmake
+++ b/.gitlab/ci/ctest_exclusions.cmake
@@ -13,6 +13,15 @@ if (CTEST_CMAKE_GENERATOR MATCHES "Visual Studio")
"^ExternalProjectUpdateSetup$")
endif ()
+if (CMAKE_HOST_WIN32)
+ list(APPEND test_exclusions
+ # This test often fails with an undiagnosed subtle race due to the test
+ # re-using the same objects for many files. Some copy operations fail
+ # to open their input with ERROR_SHARING_VIOLATION.
+ "^Module.ExternalData$"
+ )
+endif()
+
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
if (test_exclusions)
set(test_exclusions "(${test_exclusions})")
diff --git a/.gitlab/ci/ctest_test_external.cmake b/.gitlab/ci/ctest_test_external.cmake
index d92b936..4ea060d 100644
--- a/.gitlab/ci/ctest_test_external.cmake
+++ b/.gitlab/ci/ctest_test_external.cmake
@@ -33,6 +33,11 @@ endif ()
include(ProcessorCount)
ProcessorCount(nproc)
+if (NOT "$ENV{CTEST_MAX_PARALLELISM}" STREQUAL "")
+ if (nproc GREATER "$ENV{CTEST_MAX_PARALLELISM}")
+ set(nproc "$ENV{CTEST_MAX_PARALLELISM}")
+ endif ()
+endif ()
if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles")
set(CTEST_BUILD_FLAGS "-j${nproc}")
diff --git a/.gitlab/ci/gitlab_ci.cmake b/.gitlab/ci/gitlab_ci.cmake
index 7bd9300..7e5a7ab 100644
--- a/.gitlab/ci/gitlab_ci.cmake
+++ b/.gitlab/ci/gitlab_ci.cmake
@@ -49,6 +49,12 @@ endif ()
set(ctest_track "Experimental")
if (NOT "$ENV{CI_MERGE_REQUEST_ID}" STREQUAL "")
set(ctest_track "merge-requests")
+elseif (NOT "$ENV{CMAKE_CI_PROJECT_CONTINUOUS_BRANCH}" STREQUAL "" AND "$ENV{CMAKE_CI_PROJECT_CONTINUOUS_BRANCH}" STREQUAL "$ENV{CI_COMMIT_BRANCH}" AND NOT "$ENV{CMAKE_CI_JOB_CONTINUOUS}" STREQUAL "")
+ if (NOT "$ENV{CMAKE_CI_JOB_HELP}" STREQUAL "")
+ set(ctest_track "Continuous Help")
+ else()
+ set(ctest_track "Continuous")
+ endif()
elseif ("$ENV{CI_PROJECT_PATH}" STREQUAL "cmake/cmake")
if ("$ENV{CI_COMMIT_REF_NAME}" STREQUAL "master")
set(ctest_track "master")
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index 74b2de7..19b81d7 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -17,6 +17,19 @@
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+.linux_package:
+ variables:
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+ LAUNCHER: "scl enable devtoolset-6 rh-python36 --"
+
+.linux_package_x86_64:
+ extends: .linux_package
+
+ image: "kitware/cmake:build-linux-x86_64-deps-2020-04-02@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157"
+
+ variables:
+ CMAKE_ARCH: x86_64
+
### Debian
.debian10:
@@ -195,6 +208,42 @@
interruptible: true
+.cmake_build_linux_package:
+ stage: build
+
+ script:
+ # Bootstrap.
+ - cp -v Utilities/Release/linux/$CMAKE_ARCH/cache.txt build/CMakeCache.txt
+ # Make sccache available.
+ - .gitlab/ci/sccache.sh
+ - export PATH=$PWD/.gitlab:$PATH
+ # Append sccache settings to the cache.
+ - echo "CMAKE_C_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
+ - echo "CMAKE_CXX_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
+ # CI settings.
+ - echo "CMake_TEST_INSTALL:BOOL=OFF" >> build/CMakeCache.txt
+ - echo "CMAKE_INSTALL_PREFIX:PATH=$PWD/build/install" >> build/CMakeCache.txt
+ - echo "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY:BOOL=ON" >> build/CMakeCache.txt
+ # Appease Git. The Git in this container is old (1.7) and doesn't
+ # understand some things. But, it doesn't need to, so make it blind.
+ - mkdir -p .git/info
+ - echo "* -crlf" >> .git/info/attributes
+ - git reset --hard
+ # Bootstrap
+ - cd build/
+ - '$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake -- "-DCMake_DOC_ARTIFACT_PREFIX=$CI_PROJECT_DIR/build/install-doc"'
+ # FIXME: When CTest can drive an external CMake for the build as well,
+ # use the scripts here.
+ - "$LAUNCHER make -j$(nproc)"
+ # NOTE: This regex matches that used in the release build.
+ - "$LAUNCHER bin/ctest --output-on-failure -j$(nproc) -R '^(CMake\\.|CMakeLib\\.|CMakeServerLib\\.|RunCMake\\.ctest_memcheck)'"
+ # Make a package.
+ - bin/cpack -G TGZ
+ - bin/cpack -G STGZ
+ - sccache --show-stats
+
+ interruptible: true
+
.cmake_build_release_linux:
stage: build
@@ -212,6 +261,11 @@
- echo "CMake_TEST_INSTALL:BOOL=OFF" >> build/CMakeCache.txt
- echo "CMAKE_INSTALL_PREFIX:PATH=$PWD/build/install" >> build/CMakeCache.txt
- echo "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY:BOOL=ON" >> build/CMakeCache.txt
+ # Appease Git. The Git in this container is old (1.7) and doesn't
+ # understand some things. But, it doesn't need to, so make it blind.
+ - mkdir -p .git/info
+ - echo "* -crlf" >> .git/info/attributes
+ - git reset --hard
# Bootstrap
- cd build/
- "$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake"
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index 1803e79..1edfd97 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -4,6 +4,9 @@
rules:
- if: '$CMAKE_CI_PACKAGE == "true"'
when: never
+ - if: '($CMAKE_CI_PROJECT_CONTINUOUS_BRANCH != "" && $CI_COMMIT_BRANCH == $CMAKE_CI_PROJECT_CONTINUOUS_BRANCH && $CMAKE_CI_JOB_CONTINUOUS == "true")'
+ when: delayed
+ start_in: 5 minutes
- if: '$CI_MERGE_REQUEST_ID'
when: manual
- if: '$CI_PROJECT_PATH == "cmake/cmake"'
@@ -15,6 +18,18 @@
rules:
- if: '$CMAKE_CI_PACKAGE == "true"'
when: never
+ - if: '($CMAKE_CI_PROJECT_CONTINUOUS_BRANCH != "" && $CI_COMMIT_BRANCH == $CMAKE_CI_PROJECT_CONTINUOUS_BRANCH && $CMAKE_CI_JOB_CONTINUOUS == "true")'
+ when: on_success
+ - if: '$CI_MERGE_REQUEST_ID'
+ when: on_success
+ - if: '$CI_PROJECT_PATH == "cmake/cmake"'
+ when: on_success
+ - when: never
+
+.run_dependent:
+ rules:
+ - if: '$CMAKE_CI_PACKAGE == "true"'
+ when: never
- if: '$CI_MERGE_REQUEST_ID'
when: on_success
- if: '$CI_PROJECT_PATH == "cmake/cmake"'
diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst
index 4c2c89f..75d685c 100644
--- a/Help/dev/maint.rst
+++ b/Help/dev/maint.rst
@@ -245,6 +245,20 @@ Commit with a message such as::
Release versions do not have the development topic section of
the CMake Release Notes index page.
+Update ``.gitlab-ci.yml`` to drop the ``upload:`` jobs from the
+packaging pipeline by renaming them to start in ``.``:
+
+.. code-block:: shell
+
+ sed -i 's/^upload:/.upload:/' .gitlab-ci.yml
+
+Commit with a message such as::
+
+ gitlab-ci: Drop package pipeline upload jobs for release branch
+
+ The package pipeline for release versions should not upload packages
+ automatically to our archive of nightly development versions.
+
Update ``Source/CMakeVersion.cmake`` to set the version to
``$major.$minor.0-rc0``:
@@ -276,13 +290,15 @@ Merge the ``release-$ver`` branch to ``master``:
git merge --no-ff release-$ver
Begin post-release development by restoring the development branch release
-note infrastructure and the version date from ``origin/master``:
+note infrastructure, the nightly package pipeline upload jobs, and
+the version date from ``origin/master``:
.. code-block:: shell
git checkout origin/master -- \
Source/CMakeVersion.cmake Help/release/dev/0-sample-topic.rst
sed -i $'/^Releases/ i\\\n.. include:: dev.txt\\\n' Help/release/index.rst
+ sed -i 's/^\.upload:/upload:/' .gitlab-ci.yml
Update ``Source/CMakeVersion.cmake`` to set the version to
``$major.$minor.$date``:
diff --git a/Help/release/dev/FindPython-version_range.rst b/Help/release/dev/FindPython-version_range.rst
new file mode 100644
index 0000000..06318b4
--- /dev/null
+++ b/Help/release/dev/FindPython-version_range.rst
@@ -0,0 +1,5 @@
+FindPython-version_range
+------------------------
+
+* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
+ modules gained the capability to manage a version range.
diff --git a/Help/release/dev/FindSWIG-version-range.rst b/Help/release/dev/FindSWIG-version-range.rst
new file mode 100644
index 0000000..37567d3
--- /dev/null
+++ b/Help/release/dev/FindSWIG-version-range.rst
@@ -0,0 +1,4 @@
+FindSWIG-version-range
+----------------------
+
+* :module:`FindSWIG` module gains the capability to manage a version range.
diff --git a/Help/release/dev/genexpr-for-mfc-flag.rst b/Help/release/dev/genexpr-for-mfc-flag.rst
new file mode 100644
index 0000000..c56a290
--- /dev/null
+++ b/Help/release/dev/genexpr-for-mfc-flag.rst
@@ -0,0 +1,4 @@
+genexpr-for-mfc-flag
+--------------------
+
+* The :variable:`CMAKE_MFC_FLAG` variable now supports generator expressions.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index c495b71..99ff015 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -26,6 +26,7 @@ include:
IAR = IAR Systems (iar.com)
Intel = Intel Compiler (intel.com)
IntelDPCPP = Intel DPCPP Compiler (intel.com)
+ IntelClang = Intel Clang Compiler (intel.com)
MSVC = Microsoft Visual Studio (microsoft.com)
NVIDIA = NVIDIA CUDA Compiler (nvidia.com)
OpenWatcom = Open Watcom (openwatcom.org)
diff --git a/Help/variable/CMAKE_MFC_FLAG.rst b/Help/variable/CMAKE_MFC_FLAG.rst
index 2c4d1c5..118e9c6 100644
--- a/Help/variable/CMAKE_MFC_FLAG.rst
+++ b/Help/variable/CMAKE_MFC_FLAG.rst
@@ -15,3 +15,6 @@ Usage example:
add_definitions(-D_AFXDLL)
set(CMAKE_MFC_FLAG 2)
add_executable(CMakeSetup WIN32 ${SRCS})
+
+Contents of ``CMAKE_MFC_FLAG`` may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 176e768..26fb381 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -79,6 +79,7 @@ function(compiler_id_detection outvar lang)
AppleClang
ARMClang
IntelDPCPP
+ IntelClang
Clang
GNU
MSVC
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index f3ec4da..cb4421a 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -46,10 +46,21 @@ if(CMAKE_HOST_UNIX)
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$|Android")
exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val)
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND
- CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
- # OS X ppc 'uname -m' may report 'Power Macintosh' instead of 'powerpc'
- set(CMAKE_HOST_SYSTEM_PROCESSOR "powerpc")
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ # Check whether we are running under Rosetta on arm64 hardware.
+ execute_process(COMMAND sysctl -q hw.optional.arm64
+ OUTPUT_VARIABLE _sysctl_stdout
+ ERROR_VARIABLE _sysctl_stderr
+ RESULT_VARIABLE _sysctl_result
+ )
+ if(_sysctl_result EQUAL 0 AND _sysctl_stdout MATCHES "hw.optional.arm64: 1")
+ set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64")
+ endif()
+ elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
+ # OS X ppc 'uname -m' may report 'Power Macintosh' instead of 'powerpc'
+ set(CMAKE_HOST_SYSTEM_PROCESSOR "powerpc")
+ endif()
endif()
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD")
exec_program(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
diff --git a/Modules/Compiler/IntelClang-DetermineCompiler.cmake b/Modules/Compiler/IntelClang-DetermineCompiler.cmake
new file mode 100644
index 0000000..3544be3
--- /dev/null
+++ b/Modules/Compiler/IntelClang-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__clang__) && defined(__INTEL_CLANG_COMPILER)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
+
+string(APPEND _compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_CLANG_COMPILER)")
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 584f64d..2d13f48 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -10,6 +10,10 @@ FindPython
Find Python interpreter, compiler and development environment (include
directories and libraries).
+When a version is requested, it can be specified as a simple value or as a
+range. For a detailed description of version range usage and capabilities,
+refer to the :command:`find_package` command.
+
The following components are supported:
* ``Interpreter``: search for Python interpreter.
@@ -387,13 +391,39 @@ module suffix will include the ``Python_SOABI`` value, if any.
#]=======================================================================]
-set (_PYTHON_PREFIX Python)
+cmake_policy(PUSH)
+# numbers and boolean constants
+cmake_policy (SET CMP0012 NEW)
-if (DEFINED Python_FIND_VERSION)
+
+set (_PYTHON_PREFIX Python)
+unset (_Python_REQUIRED_VERSION_MAJOR)
+unset (_Python_REQUIRED_VERSIONS)
+
+if (Python_FIND_VERSION_RANGE)
+ # compute list of major versions
+ foreach (_Python_MAJOR IN ITEMS 3 2)
+ if (_Python_MAJOR VERSION_GREATER_EQUAL Python_FIND_VERSION_MIN_MAJOR
+ AND ((Python_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND _Python_MAJOR VERSION_LESS_EQUAL Python_FIND_VERSION_MAX)
+ OR (Python_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND _Python_MAJOR VERSION_LESS Python_FIND_VERSION_MAX)))
+ list (APPEND _Python_REQUIRED_VERSIONS ${_Python_MAJOR})
+ endif()
+ endforeach()
+ list (LENGTH _Python_REQUIRED_VERSIONS _Python_VERSION_COUNT)
+ if (_Python_VERSION_COUNT EQUAL 0)
+ unset (_Python_REQUIRED_VERSIONS)
+ elseif (_Python_VERSION_COUNT EQUAL 1)
+ set (_Python_REQUIRED_VERSION_MAJOR ${_Python_REQUIRED_VERSIONS})
+ endif()
+elseif (DEFINED Python_FIND_VERSION)
set (_Python_REQUIRED_VERSION_MAJOR ${Python_FIND_VERSION_MAJOR})
+else()
+ set (_Python_REQUIRED_VERSIONS 3 2)
+endif()
+if (_Python_REQUIRED_VERSION_MAJOR)
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
-else()
+elseif (_Python_REQUIRED_VERSIONS)
# iterate over versions in quiet and NOT required modes to avoid multiple
# "Found" messages and prematurally failure.
set (_Python_QUIETLY ${Python_FIND_QUIETLY})
@@ -401,7 +431,6 @@ else()
set (Python_FIND_QUIETLY TRUE)
set (Python_FIND_REQUIRED FALSE)
- set (_Python_REQUIRED_VERSIONS 3 2)
set (_Python_REQUIRED_VERSION_LAST 2)
unset (_Python_INPUT_VARS)
@@ -435,10 +464,21 @@ else()
set (Python_FIND_REQUIRED ${_Python_REQUIRED})
if (Python_FIND_REQUIRED OR NOT Python_FIND_QUIETLY)
# call again validation command to get "Found" or error message
- find_package_handle_standard_args (Python HANDLE_COMPONENTS
+ find_package_handle_standard_args (Python HANDLE_COMPONENTS HANDLE_VERSION_RANGE
REQUIRED_VARS ${_Python_REQUIRED_VARS}
VERSION_VAR Python_VERSION)
endif()
+else()
+ # supported versions not in the specified range. Call final check
+ if (NOT Python_FIND_COMPONENTS)
+ set (Python_FIND_COMPONENTS Interpreter)
+ set (Python_FIND_REQUIRED_Interpreter TRUE)
+ endif()
+
+ include (${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ find_package_handle_standard_args (Python HANDLE_COMPONENTS HANDLE_VERSION_RANGE
+ VERSION_VAR Python_VERSION
+ REASON_FAILURE_MESSAGE "Version range specified \"${Python_FIND_VERSION_RANGE}\" does not include supported versions")
endif()
if (COMMAND __Python_add_library)
@@ -448,3 +488,5 @@ if (COMMAND __Python_add_library)
endif()
unset (_PYTHON_PREFIX)
+
+cmake_policy(POP)
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index c8225c4..41b55ee 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -31,6 +31,7 @@ endif()
get_property(_${_PYTHON_PREFIX}_CMAKE_ROLE GLOBAL PROPERTY CMAKE_ROLE)
+include (${CMAKE_CURRENT_LIST_DIR}/../FindPackageHandleStandardArgs.cmake)
#
# helper commands
@@ -674,12 +675,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
return()
endif()
- cmake_parse_arguments (PARSE_ARGV 0 _PVI "EXACT;CHECK_EXISTS" "" "")
- if (_PVI_UNPARSED_ARGUMENTS)
- set (expected_version "${_PVI_UNPARSED_ARGUMENTS}")
- else()
- unset (expected_version)
- endif()
+ cmake_parse_arguments (PARSE_ARGV 0 _PVI "IN_RANGE;EXACT;CHECK_EXISTS" "VERSION" "")
if (_PVI_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_EXECUTABLE}")
# interpreter does not exist anymore
@@ -710,50 +706,69 @@ function (_PYTHON_VALIDATE_INTERPRETER)
endif()
endif()
- get_filename_component (python_name "${_${_PYTHON_PREFIX}_EXECUTABLE}" NAME)
+ if (_PVI_IN_RANGE OR _PVI_VERSION)
+ # retrieve full version
+ execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (result)
+ # interpreter is not usable
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+ return()
+ endif()
- if (expected_version)
- if (NOT python_name STREQUAL "python${expected_version}${abi}${CMAKE_EXECUTABLE_SUFFIX}")
- # compute number of components for version
- string (REGEX REPLACE "[^.]" "" dots "${expected_version}")
- # add one dot because there is one dot less than there are components
+ if (_PVI_VERSION)
+ # check against specified version
+ ## compute number of components for version
+ string (REGEX REPLACE "[^.]" "" dots "${_PVI_VERSION}")
+ ## add one dot because there is one dot less than there are components
string (LENGTH "${dots}." count)
if (count GREATER 3)
set (count 3)
endif()
+ set (version_regex "^[0-9]+")
+ if (count EQUAL 3)
+ string (APPEND version_regex "\\.[0-9]+\\.[0-9]+")
+ elseif (count EQUAL 2)
+ string (APPEND version_regex "\\.[0-9]+")
+ endif()
+ # extract needed range
+ string (REGEX MATCH "${version_regex}" version "${version}")
- # executable found must have a specific version
- execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:${count}]]))"
- RESULT_VARIABLE result
- OUTPUT_VARIABLE version
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (result)
- # interpreter is not usable
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
+ if (_PVI_EXACT AND NOT version VERSION_EQUAL _PVI_VERSION)
+ # interpreter has wrong version
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+ return()
else()
- if (_PVI_EXACT AND NOT version VERSION_EQUAL expected_version)
- # interpreter has wrong version
+ # check that version is OK
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" major_version "${version}")
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" expected_major_version "${_PVI_VERSION}")
+ if (NOT major_version VERSION_EQUAL expected_major_version
+ OR NOT version VERSION_GREATER_EQUAL _PVI_VERSION)
set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
- else()
- # check that version is OK
- string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" major_version "${version}")
- string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" expected_major_version "${expected_version}")
- if (NOT major_version VERSION_EQUAL expected_major_version
- OR NOT version VERSION_GREATER_EQUAL expected_version)
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
- set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
- endif()
+ return()
endif()
endif()
- if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
+ endif()
+
+ if (_PVI_IN_RANGE)
+ # check if version is in the requested range
+ find_package_check_version ("${version}" in_range HANDLE_VERSION_RANGE)
+ if (NOT in_range)
+ # interpreter has invalid version
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
return()
endif()
endif()
else()
+ get_filename_component (python_name "${_${_PYTHON_PREFIX}_EXECUTABLE}" NAME)
if (NOT python_name STREQUAL "python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}${CMAKE_EXECUTABLE_SUFFIX}")
# executable found do not have version in name
# ensure major version is OK
@@ -805,15 +820,7 @@ function (_PYTHON_VALIDATE_COMPILER)
return()
endif()
- cmake_parse_arguments (PARSE_ARGV 0 _PVC "EXACT;CHECK_EXISTS" "" "")
- if (_PVC_UNPARSED_ARGUMENTS)
- set (major_version FALSE)
- set (expected_version "${_PVC_UNPARSED_ARGUMENTS}")
- else()
- set (major_version TRUE)
- set (expected_version "${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}")
- set (_PVC_EXACT TRUE)
- endif()
+ cmake_parse_arguments (PARSE_ARGV 0 _PVC "IN_RANGE;EXACT;CHECK_EXISTS" "VERSION" "")
if (_PVC_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_COMPILER}")
# Compiler does not exist anymore
@@ -826,19 +833,7 @@ function (_PYTHON_VALIDATE_COMPILER)
# retrieve python environment version from compiler
set (working_dir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir")
- if (major_version)
- # check only major version
- file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write(str(sys.version_info[0]))")
- else()
- # compute number of components for version
- string (REGEX REPLACE "[^.]" "" dots "${expected_version}")
- # add one dot because there is one dot less than there are components
- string (LENGTH "${dots}." count)
- if (count GREATER 3)
- set (count 3)
- endif()
- file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:${count}]]))\n")
- endif()
+ file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n")
execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_COMPILER}"
${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS}
/target:exe /embed "${working_dir}/version.py"
@@ -858,11 +853,64 @@ function (_PYTHON_VALIDATE_COMPILER)
# compiler is not usable
set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Cannot use the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
- elseif ((_PVC_EXACT AND NOT version VERSION_EQUAL expected_version)
- OR NOT version VERSION_GREATER_EQUAL expected_version)
- # Compiler has wrong version
- set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
- set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
+ return()
+ endif()
+
+ if (_PVC_VERSION OR _PVC_IN_RANGE)
+ if (_PVC_VERSION)
+ # check against specified version
+ ## compute number of components for version
+ string (REGEX REPLACE "[^.]" "" dots "${_PVC_VERSION}")
+ ## add one dot because there is one dot less than there are components
+ string (LENGTH "${dots}." count)
+ if (count GREATER 3)
+ set (count 3)
+ endif()
+ set (version_regex "^[0-9]+")
+ if (count EQUAL 3)
+ string (APPEND version_regex "\\.[0-9]+\\.[0-9]+")
+ elseif (count EQUAL 2)
+ string (APPEND version_regex "\\.[0-9]+")
+ endif()
+ # extract needed range
+ string (REGEX MATCH "${version_regex}" version "${version}")
+
+ if (_PVC_EXACT AND NOT version VERSION_EQUAL _PVC_VERSION)
+ # interpreter has wrong version
+ set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
+ return()
+ else()
+ # check that version is OK
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" major_version "${version}")
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" expected_major_version "${_PVC_VERSION}")
+ if (NOT major_version VERSION_EQUAL expected_major_version
+ OR NOT version VERSION_GREATER_EQUAL _PVC_VERSION)
+ set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
+ return()
+ endif()
+ endif()
+ endif()
+
+ if (_PVC_IN_RANGE)
+ # check if version is in the requested range
+ find_package_check_version ("${version}" in_range HANDLE_VERSION_RANGE)
+ if (NOT in_range)
+ # interpreter has invalid version
+ set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
+ return()
+ endif()
+ endif()
+ else()
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" major_version "${version}")
+ if (NOT major_version EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
+ # Compiler has wrong major version
+ set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong major version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
+ return()
+ endif()
endif()
endfunction()
@@ -873,12 +921,7 @@ function (_PYTHON_VALIDATE_LIBRARY)
return()
endif()
- cmake_parse_arguments (PARSE_ARGV 0 _PVL "EXACT;CHECK_EXISTS" "" "")
- if (_PVL_UNPARSED_ARGUMENTS)
- set (expected_version ${_PVL_UNPARSED_ARGUMENTS})
- else()
- unset (expected_version)
- endif()
+ cmake_parse_arguments (PARSE_ARGV 0 _PVL "IN_RANGE;EXACT;CHECK_EXISTS" "VERSION" "")
if (_PVL_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
# library does not exist anymore
@@ -899,13 +942,25 @@ function (_PYTHON_VALIDATE_LIBRARY)
set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong ABI for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
else()
- if (expected_version)
- # library have only major.minor information
- string (REGEX MATCH "[0-9](\\.[0-9]+)?" version "${expected_version}")
- if ((_PVL_EXACT AND NOT lib_VERSION VERSION_EQUAL version) OR (lib_VERSION VERSION_LESS version))
- # library has wrong version
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
- set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+ if (_PVL_VERSION OR _PVL_IN_RANGE)
+ if (_PVL_VERSION)
+ # library have only major.minor information
+ string (REGEX MATCH "[0-9](\\.[0-9]+)?" version "${_PVL_VERSION}")
+ if ((_PVL_EXACT AND NOT lib_VERSION VERSION_EQUAL version) OR (lib_VERSION VERSION_LESS version))
+ # library has wrong version
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+ endif()
+ endif()
+
+ if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND _PVL_IN_RANGE)
+ # check if library version is in the requested range
+ find_package_check_version ("${lib_VERSION}" in_range HANDLE_VERSION_RANGE)
+ if (NOT in_range)
+ # library has wrong version
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+ endif()
endif()
else()
if (NOT lib_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
@@ -932,12 +987,7 @@ function (_PYTHON_VALIDATE_INCLUDE_DIR)
return()
endif()
- cmake_parse_arguments (PARSE_ARGV 0 _PVID "EXACT;CHECK_EXISTS" "" "")
- if (_PVID_UNPARSED_ARGUMENTS)
- set (expected_version ${_PVID_UNPARSED_ARGUMENTS})
- else()
- unset (expected_version)
- endif()
+ cmake_parse_arguments (PARSE_ARGV 0 _PVID "IN_RANGE;EXACT;CHECK_EXISTS" "VERSION" "")
if (_PVID_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
# include file does not exist anymore
@@ -954,11 +1004,23 @@ function (_PYTHON_VALIDATE_INCLUDE_DIR)
set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong ABI for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
else()
- if (expected_version)
- if ((_PVID_EXACT AND NOT inc_VERSION VERSION_EQUAL expected_version) OR (inc_VERSION VERSION_LESS expected_version))
- # include dir has wrong version
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
- set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+ if (_PVID_VERSION OR _PVID_IN_RANGE)
+ if (_PVID_VERSION)
+ if ((_PVID_EXACT AND NOT inc_VERSION VERSION_EQUAL expected_version) OR (inc_VERSION VERSION_LESS expected_version))
+ # include dir has wrong version
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+ endif()
+ endif()
+
+ if (_${_PYTHON_PREFIX}_INCLUDE_DIR AND PVID_IN_RANGE)
+ # check if include dir is in the request range
+ find_package_check_version ("${inc_VERSION}" in_range HANDLE_VERSION_RANGE)
+ if (NOT in_range)
+ # include dir has wrong version
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+ endif()
endif()
else()
if (NOT inc_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
@@ -1020,13 +1082,27 @@ function (_PYTHON_SET_DEVELOPMENT_MODULE_FOUND module)
endfunction()
-# If major version is specified, it must be the same as internal major version
-if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR
- AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
- _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
+if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ # range must include internal major version
+ if (${_PYTHON_PREFIX}_FIND_VERSION_MIN_MAJOR VERSION_GREATER _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR
+ OR ((${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
+ AND ${_PYTHON_PREFIX}_FIND_VERSION_MAX VERSION_LESS _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
+ OR (${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
+ AND ${_PYTHON_PREFIX}_FIND_VERSION_MAX VERSION_LESS_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)))
+ _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong version range specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_RANGE}\", but expected version range must include major version \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
- cmake_policy(POP)
- return()
+ cmake_policy(POP)
+ return()
+ endif()
+else()
+ if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR
+ AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
+ # If major version is specified, it must be the same as internal major version
+ _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
+
+ cmake_policy(POP)
+ return()
+ endif()
endif()
@@ -1070,18 +1146,32 @@ list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSIONS})
unset (_${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
-if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT)
- if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- set (_${_PYTHON_PREFIX}_FIND_VERSION_EXACT "EXACT")
- set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR})
- else()
- unset (_${_PYTHON_PREFIX}_FIND_VERSIONS)
- # add all compatible versions
- foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
- if (_${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL "${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR}")
- list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSION})
- endif()
- endforeach()
+if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ unset (_${_PYTHON_PREFIX}_FIND_VERSIONS)
+ foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
+ if ((${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE"
+ AND _${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL ${_PYTHON_PREFIX}_FIND_VERSION_MIN)
+ AND ((${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
+ AND _${_PYTHON_PREFIX}_VERSION VERSION_LESS_EQUAL ${_PYTHON_PREFIX}_FIND_VERSION_MAX)
+ OR (${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
+ AND _${_PYTHON_PREFIX}_VERSION VERSION_LESS ${_PYTHON_PREFIX}_FIND_VERSION_MAX)))
+ list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSION})
+ endif()
+ endforeach()
+else()
+ if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT GREATER 1)
+ if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
+ set (_${_PYTHON_PREFIX}_FIND_VERSION_EXACT "EXACT")
+ set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR})
+ else()
+ unset (_${_PYTHON_PREFIX}_FIND_VERSIONS)
+ # add all compatible versions
+ foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
+ if (_${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL "${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR}")
+ list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSION})
+ endif()
+ endforeach()
+ endif()
endif()
endif()
@@ -1300,14 +1390,26 @@ function (_PYTHON_CHECK_DEVELOPMENT_SIGNATURE module)
string (MD5 signature "${signature}")
if (signature STREQUAL _${_PYTHON_PREFIX}_DEVELOPMENT_${id}_SIGNATURE)
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
- _python_validate_library (${${_PYTHON_PREFIX}_FIND_VERSION}
- ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT}
- CHECK_EXISTS)
+ if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
+ _python_validate_library (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ _python_validate_library (IN_RANGE CHECK_EXISTS)
+ elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
+ _python_validate_library (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ else()
+ _python_validate_library (CHECK_EXISTS)
+ endif()
endif()
if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
- _python_validate_include_dir (${${_PYTHON_PREFIX}_FIND_VERSION}
- ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT}
- CHECK_EXISTS)
+ if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
+ _python_validate_include_dir (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ _python_validate_include_dir (IN_RANGE CHECK_EXISTS)
+ elseif (${_PYTHON_PREFIX}_FIND_VERSION)
+ _python_validate_include_dir (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ else()
+ _python_validate_include_dir (CHECK_EXISTS)
+ endif()
endif()
else()
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
@@ -1384,9 +1486,13 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (__${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE STREQUAL _${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE)
# check version validity
if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
+ _python_validate_interpreter (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ _python_validate_interpreter (IN_RANGE CHECK_EXISTS)
+ elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
+ _python_validate_interpreter (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
else()
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ _python_validate_interpreter (CHECK_EXISTS)
endif()
else()
unset (_${_PYTHON_PREFIX}_EXECUTABLE CACHE)
@@ -1410,6 +1516,13 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# Registry Paths
_python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
+ set (_${_PYTHON_PREFIX}_VALIDATE_OPTIONS ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE)
+ elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
+ list (APPEND VERSION ${${_PYTHON_PREFIX}_FIND_VERSION})
+ endif()
+
while (TRUE)
# Virtual environments handling
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
@@ -1424,7 +1537,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_interpreter (${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1445,7 +1558,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1460,7 +1573,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1474,7 +1587,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1483,7 +1596,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1496,7 +1609,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1509,7 +1622,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1519,6 +1632,11 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endwhile()
else()
# look-up for various versions and locations
+ set (_${_PYTHON_PREFIX}_VALIDATE_OPTIONS EXACT)
+ if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE)
+ endif()
+
foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
_python_get_names (_${_PYTHON_PREFIX}_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} POSIX INTERPRETER)
_python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} INTERPRETER)
@@ -1538,7 +1656,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_interpreter (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1573,7 +1691,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_CMAKE_SYSTEM_PATH)
endif()
- _python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_interpreter (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1586,7 +1704,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_interpreter (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1599,7 +1717,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
- _python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_interpreter (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1624,7 +1742,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_DEFAULT_PATH)
endif()
- _python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_interpreter (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1825,9 +1943,13 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (__${_PYTHON_PREFIX}_COMPILER_SIGNATURE STREQUAL _${_PYTHON_PREFIX}_COMPILER_SIGNATURE)
# check version validity
if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
+ _python_validate_compiler (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ _python_validate_compiler (IN_RANGE CHECK_EXISTS)
+ elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
+ _python_validate_compiler (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
else()
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ _python_validate_compiler (CHECK_EXISTS)
endif()
else()
unset (_${_PYTHON_PREFIX}_COMPILER CACHE)
@@ -1862,6 +1984,13 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
IMPLEMENTATIONS IronPython
VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
+ set (_${_PYTHON_PREFIX}_VALIDATE_OPTIONS ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE)
+ elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
+ list (APPEND VERSION ${${_PYTHON_PREFIX}_FIND_VERSION})
+ endif()
+
while (TRUE)
# Apple frameworks handling
if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
@@ -1875,7 +2004,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -1890,7 +2019,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -1904,7 +2033,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -1914,7 +2043,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
NAMES_PER_DIR
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -1927,7 +2056,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -1940,6 +2069,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -1949,6 +2079,11 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endwhile()
else()
# try using root dir and registry
+ set (_${_PYTHON_PREFIX}_VALIDATE_OPTIONS EXACT)
+ if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE)
+ endif()
+
foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
_python_get_names (_${_PYTHON_PREFIX}_COMPILER_NAMES
IMPLEMENTATIONS IronPython
@@ -1979,7 +2114,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_compiler (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -1994,7 +2129,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_compiler (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -2008,7 +2143,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_compiler (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -2021,7 +2156,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
- _python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_compiler (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -2034,7 +2169,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
- _python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ _python_validate_compiler (VERSION ${_${_PYTHON_PREFIX}_VERSION} ${_${_PYTHON_PREFIX}_VALIDATE_OPTIONS})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
@@ -2054,6 +2189,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
+ _python_validate_compiler ()
endif()
endif()
@@ -2754,7 +2890,6 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (_${_PYTHON_PREFIX}_INCLUDE_DIR)
# retrieve version from header file
_python_get_version (INCLUDE PREFIX _${_PYTHON_PREFIX}_INC_)
-
if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
if ("${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}"
VERSION_EQUAL _${_PYTHON_PREFIX}_VERSION)
@@ -2980,10 +3115,10 @@ foreach (_${_PYTHON_PREFIX}_COMPONENT IN ITEMS Interpreter Compiler Development
endif()
endforeach()
-include (${CMAKE_CURRENT_LIST_DIR}/../FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args (${_PYTHON_PREFIX}
REQUIRED_VARS ${_${_PYTHON_PREFIX}_REQUIRED_VARS}
VERSION_VAR ${_PYTHON_PREFIX}_VERSION
+ HANDLE_VERSION_RANGE
HANDLE_COMPONENTS
REASON_FAILURE_MESSAGE "${_${_PYTHON_PREFIX}_REASON_FAILURE}")
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index 1c75011..97e376d 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -10,6 +10,10 @@ FindPython2
Find Python 2 interpreter, compiler and development environment (include
directories and libraries).
+When a version is requested, it can be specified as a simple value or as a
+range. For a detailed description of version range usage and capabilities,
+refer to the :command:`find_package` command.
+
The following components are supported:
* ``Interpreter``: search for Python 2 interpreter
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index e6e9f04..266b50a 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -10,6 +10,10 @@ FindPython3
Find Python 3 interpreter, compiler and development environment (include
directories and libraries).
+When a version is requested, it can be specified as a simple value or as a
+range. For a detailed description of version range usage and capabilities,
+refer to the :command:`find_package` command.
+
The following components are supported:
* ``Interpreter``: search for Python 3 interpreter
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 2fded49..f732289 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -7,11 +7,16 @@ FindSWIG
Find the Simplified Wrapper and Interface Generator (SWIG_) executable.
-
This module finds an installed SWIG and determines its version. If a
-``COMPONENTS`` or ``OPTIONAL_COMPONENTS`` argument is given to ``find_package``,
-it will also determine supported target languages. The module sents the
-following variables:
+``COMPONENTS`` or ``OPTIONAL_COMPONENTS`` argument is given to the
+:command:`find_package` command, it will also determine supported target
+languages.
+
+When a version is requested, it can be specified as a simple value or as a
+range. For a detailed description of version range usage and capabilities,
+refer to the :command:`find_package` command.
+
+The module defines the following variables:
``SWIG_FOUND``
Whether SWIG and any required components were found on the system.
@@ -50,7 +55,30 @@ optional Fortran support:
#]=======================================================================]
-find_program(SWIG_EXECUTABLE NAMES swig4.0 swig3.0 swig2.0 swig)
+# compute list of possible names
+if (SWIG_FIND_VERSION_RANGE)
+ set (_SWIG_NAMES)
+ foreach (_SWIG_MAJOR IN ITEMS 4 3 2)
+ if (_SWIG_MAJOR VERSION_GREATER_EQUAL SWIG_FIND_VERSION_MIN_MAJOR
+ AND ((SWIG_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND _SWIG_MAJOR VERSION_LESS_EQUAL SWIG_FIND_VERSION_MAX)
+ OR (SWIG_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND _SWIG_MAJOR VERSION_LESS SWIG_FIND_VERSION_MAX)))
+ list (APPEND _SWIG_NAMES swig${_SWIG_MAJOR}.0)
+ endif()
+ endforeach()
+elseif(SWIG_FIND_VERSION)
+ if (SWIG_FIND_VERSION_EXACT)
+ set(_SWIG_NAMES swig${SWIG_FIND_VERSION_MAJOR}.0)
+ else()
+ foreach (_SWIG_MAJOR IN ITEMS 4 3 2)
+ if (_SWIG_MAJOR VERSION_GREATER_EQUAL SWIG_FIND_VERSION_MAJOR)
+ list (APPEND _SWIG_NAMES swig${_SWIG_MAJOR}.0)
+ endif()
+ endif()
+else()
+ set (_SWIG_NAMES swig4.0 swig3.0 swig2.0)
+endif()
+
+find_program(SWIG_EXECUTABLE NAMES ${_SWIG_NAMES} swig)
if(SWIG_EXECUTABLE)
execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
@@ -105,6 +133,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(
SWIG HANDLE_COMPONENTS
REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
- VERSION_VAR SWIG_VERSION)
+ VERSION_VAR SWIG_VERSION
+ HANDLE_VERSION_RANGE)
mark_as_advanced(SWIG_DIR SWIG_VERSION SWIG_EXECUTABLE)
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index d087412..15e6123 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -20,6 +20,17 @@ execute_process(COMMAND sw_vers -productVersion
set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING
"Build architectures for OSX")
+if(NOT CMAKE_CROSSCOMPILING AND
+ CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
+ CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" AND
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
+ # When building on Apple Silicon (arm64), we need to explicitly specify
+ # the architecture to the toolchain since it will otherwise guess the
+ # architecture based on that of the build system tool.
+ # Set an *internal variable* to tell the generators to do this.
+ set(_CMAKE_APPLE_ARCHS_DEFAULT "arm64")
+endif()
+
# macOS, iOS, tvOS, and watchOS should lookup compilers from
# Platform/Apple-${CMAKE_CXX_COMPILER_ID}-<LANG>
set(CMAKE_EFFECTIVE_SYSTEM_NAME "Apple")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ce9646d..524dea1 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 18)
-set(CMake_VERSION_PATCH 20201001)
+set(CMake_VERSION_PATCH 20201002)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index a904b94..df22028 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -181,11 +181,25 @@ CMakeSetupDialog::CMakeSetupDialog()
&QCMakeCacheView::collapseAll);
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
- a = HelpMenu->addAction(tr("About"));
- QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout);
a = HelpMenu->addAction(tr("Help"));
QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doHelp);
a->setShortcut(QKeySequence::HelpContents);
+ a = HelpMenu->addAction(tr("CMake Reference Manual"));
+ QObject::connect(a, &QAction::triggered, this, []() {
+ QString urlFormat("https://cmake.org/cmake/help/v%1.%2/");
+ QUrl url(urlFormat.arg(QString::number(cmVersion::GetMajorVersion()),
+ QString::number(cmVersion::GetMinorVersion())));
+
+ if (!cmSystemTools::GetHTMLDoc().empty()) {
+ url = QUrl::fromLocalFile(
+ QDir(QString::fromLocal8Bit(cmSystemTools::GetHTMLDoc().data()))
+ .filePath("index.html"));
+ }
+
+ QDesktopServices::openUrl(url);
+ });
+ a = HelpMenu->addAction(tr("About"));
+ QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout);
this->setAcceptDrops(true);
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx
index 9277c20..789c78d 100644
--- a/Source/cmCMakeLanguageCommand.cxx
+++ b/Source/cmCMakeLanguageCommand.cxx
@@ -77,18 +77,14 @@ bool cmCMakeLanguageCommandCALL(std::vector<cmListFileArgument> const& args,
cmMakefile& makefile = status.GetMakefile();
cmListFileContext context = makefile.GetBacktrace().Top();
- cmListFileFunction func;
- func.Name = callCommand;
- func.Line = context.Line;
+ std::vector<cmListFileArgument> funcArgs;
+ funcArgs.reserve(args.size() - startArg);
// The rest of the arguments are passed to the function call above
for (size_t i = startArg; i < args.size(); ++i) {
- cmListFileArgument lfarg;
- lfarg.Delim = args[i].Delim;
- lfarg.Line = context.Line;
- lfarg.Value = args[i].Value;
- func.Arguments.emplace_back(lfarg);
+ funcArgs.emplace_back(args[i].Value, args[i].Delim, context.Line);
}
+ cmListFileFunction func{ callCommand, context.Line, std::move(funcArgs) };
if (defer) {
if (defer->Id.empty()) {
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index ee2960b..8ebf6d2 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -419,12 +419,15 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
const char** args)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- cmListFileFunction lff;
- lff.Name = name;
+
+ std::vector<cmListFileArgument> lffArgs;
+ lffArgs.reserve(numArgs);
for (int i = 0; i < numArgs; ++i) {
// Assume all arguments are quoted.
- lff.Arguments.emplace_back(args[i], cmListFileArgument::Quoted, 0);
+ lffArgs.emplace_back(args[i], cmListFileArgument::Quoted, 0);
}
+
+ cmListFileFunction lff{ name, 0, std::move(lffArgs) };
cmExecutionStatus status(*mf);
return mf->ExecuteCommand(lff, status);
}
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index ceb2a32..cf32b05 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -21,6 +21,7 @@
#define CMake_DEFAULT_RECURSION_LIMIT @CMake_DEFAULT_RECURSION_LIMIT@
#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"
#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
+#define CMAKE_DOC_DIR "/@CMAKE_DOC_DIR@"
#define CM_FALLTHROUGH cmsys_FALLTHROUGH
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 86251d2..c988b59 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1984,6 +1984,9 @@ cmFileListGeneratorBase* cmFileListGeneratorBase::SetNext(
bool cmFileListGeneratorBase::Consider(std::string const& fullPath,
cmFileList& listing)
{
+ if (!cmSystemTools::FileIsDirectory(fullPath)) {
+ return false;
+ }
if (this->Next) {
return this->Next->Search(fullPath + "/", listing);
}
@@ -2238,10 +2241,8 @@ private:
// Look for directories among the matches.
for (std::string const& f : files) {
- if (cmSystemTools::FileIsDirectory(f)) {
- if (this->Consider(f, lister)) {
- return true;
- }
+ if (this->Consider(f, lister)) {
+ return true;
}
}
return false;
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 42df923..bcacb15 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -90,7 +90,7 @@ bool cmForEachFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile& mf) const
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments(), expandedArguments);
return expandedArguments.empty() ||
expandedArguments.front() == this->Args.front();
}
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx
index 643cd82..d4666d7 100644
--- a/Source/cmFunctionBlocker.cxx
+++ b/Source/cmFunctionBlocker.cxx
@@ -15,9 +15,9 @@
bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus& status)
{
- if (lff.Name.Lower == this->StartCommandName()) {
+ if (lff.LowerCaseName() == this->StartCommandName()) {
this->ScopeDepth++;
- } else if (lff.Name.Lower == this->EndCommandName()) {
+ } else if (lff.LowerCaseName() == this->EndCommandName()) {
this->ScopeDepth--;
if (this->ScopeDepth == 0U) {
cmMakefile& mf = status.GetMakefile();
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 46bd057..71c82d6 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -147,7 +147,7 @@ bool cmFunctionFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile& mf) const
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments(), expandedArguments);
return expandedArguments.empty() ||
expandedArguments.front() == this->Args.front();
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 859fa6a..bdea9fa 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3190,6 +3190,9 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config,
if (archs) {
cmExpandList(*archs, archVec);
}
+ if (archVec.empty()) {
+ this->Makefile->GetDefExpandList("_CMAKE_APPLE_ARCHS_DEFAULT", archVec);
+ }
}
void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index b78f0a0..acae2b6 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -4023,6 +4023,10 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
}
if (this->Architectures.empty()) {
+ mf->GetDefExpandList("_CMAKE_APPLE_ARCHS_DEFAULT", this->Architectures);
+ }
+
+ if (this->Architectures.empty()) {
// With no ARCHS we use ONLY_ACTIVE_ARCH and possibly a
// platform-specific default ARCHS placeholder value.
// Look up the arch that Xcode chooses in this case.
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index fc257b1..55f6453 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -54,7 +54,7 @@ public:
bool cmIfFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile&) const
{
- return lff.Arguments.empty() || lff.Arguments == this->Args;
+ return lff.Arguments().empty() || lff.Arguments() == this->Args;
}
bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
@@ -65,19 +65,19 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
int scopeDepth = 0;
for (cmListFileFunction const& func : functions) {
// keep track of scope depth
- if (func.Name.Lower == "if") {
+ if (func.LowerCaseName() == "if") {
scopeDepth++;
}
- if (func.Name.Lower == "endif") {
+ if (func.LowerCaseName() == "endif") {
scopeDepth--;
}
// watch for our state change
- if (scopeDepth == 0 && func.Name.Lower == "else") {
+ if (scopeDepth == 0 && func.LowerCaseName() == "else") {
if (this->ElseSeen) {
- cmListFileBacktrace elseBT = mf.GetBacktrace().Push(
- cmListFileContext{ func.Name.Original,
- this->GetStartingContext().FilePath, func.Line });
+ cmListFileBacktrace elseBT = mf.GetBacktrace().Push(cmListFileContext{
+ func.OriginalName(), this->GetStartingContext().FilePath,
+ func.Line() });
mf.GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
"A duplicate ELSE command was found inside an IF block.", elseBT);
@@ -94,9 +94,10 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
if (!this->IsBlocking && mf.GetCMakeInstance()->GetTrace()) {
mf.PrintCommandTrace(func);
}
- } else if (scopeDepth == 0 && func.Name.Lower == "elseif") {
- cmListFileBacktrace elseifBT = mf.GetBacktrace().Push(cmListFileContext{
- func.Name.Original, this->GetStartingContext().FilePath, func.Line });
+ } else if (scopeDepth == 0 && func.LowerCaseName() == "elseif") {
+ cmListFileBacktrace elseifBT = mf.GetBacktrace().Push(
+ cmListFileContext{ func.OriginalName(),
+ this->GetStartingContext().FilePath, func.Line() });
if (this->ElseSeen) {
mf.GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
@@ -116,7 +117,7 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
std::string errorString;
std::vector<cmExpandedCommandArgument> expandedArguments;
- mf.ExpandArguments(func.Arguments, expandedArguments);
+ mf.ExpandArguments(func.Arguments(), expandedArguments);
MessageType messType;
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index d678b56..70ef5af 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -15,14 +15,6 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-cmCommandContext::cmCommandName& cmCommandContext::cmCommandName::operator=(
- std::string const& name)
-{
- this->Original = name;
- this->Lower = cmSystemTools::LowerCase(name);
- return *this;
-}
-
struct cmListFileParser
{
cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
@@ -43,7 +35,9 @@ struct cmListFileParser
cmMessenger* Messenger;
const char* FileName;
cmListFileLexer* Lexer;
- cmListFileFunction Function;
+ std::string FunctionName;
+ long FunctionLine;
+ std::vector<cmListFileArgument> FunctionArguments;
enum
{
SeparationOkay,
@@ -141,7 +135,9 @@ bool cmListFileParser::Parse()
if (haveNewline) {
haveNewline = false;
if (this->ParseFunction(token->text, token->line)) {
- this->ListFile->Functions.push_back(this->Function);
+ this->ListFile->Functions.emplace_back(
+ std::move(this->FunctionName), this->FunctionLine,
+ std::move(this->FunctionArguments));
} else {
return false;
}
@@ -200,9 +196,8 @@ bool cmListFile::ParseString(const char* str, const char* virtual_filename,
bool cmListFileParser::ParseFunction(const char* name, long line)
{
// Ininitialize a new function call.
- this->Function = cmListFileFunction();
- this->Function.Name = name;
- this->Function.Line = line;
+ this->FunctionName = name;
+ this->FunctionLine = line;
// Command name has already been parsed. Read the left paren.
cmListFileLexer_Token* token;
@@ -297,7 +292,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
cmListFileArgument::Delimiter delim)
{
- this->Function.Arguments.emplace_back(token->text, delim, token->line);
+ this->FunctionArguments.emplace_back(token->text, delim, token->line);
if (this->Separation == SeparationOkay) {
return true;
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 5617536..727fc60 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -14,6 +14,7 @@
#include <cm/optional>
#include "cmStateSnapshot.h"
+#include "cmSystemTools.h"
/** \class cmListFileCache
* \brief A class to cache list file contents.
@@ -28,16 +29,19 @@ struct cmCommandContext
{
struct cmCommandName
{
- std::string Lower;
std::string Original;
+ std::string Lower;
cmCommandName() = default;
- cmCommandName(std::string const& name) { *this = name; }
- cmCommandName& operator=(std::string const& name);
+ cmCommandName(std::string name)
+ : Original(std::move(name))
+ , Lower(cmSystemTools::LowerCase(this->Original))
+ {
+ }
} Name;
long Line = 0;
cmCommandContext() = default;
- cmCommandContext(const char* name, int line)
- : Name(name)
+ cmCommandContext(std::string name, long line)
+ : Name(std::move(name))
, Line(line)
{
}
@@ -103,9 +107,48 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
-struct cmListFileFunction : public cmCommandContext
+class cmListFileFunction
{
- std::vector<cmListFileArgument> Arguments;
+public:
+ cmListFileFunction(std::string name, long line,
+ std::vector<cmListFileArgument> args)
+ : Impl{ std::make_shared<Implementation>(std::move(name), line,
+ std::move(args)) }
+ {
+ }
+
+ std::string const& OriginalName() const noexcept
+ {
+ return this->Impl->Name.Original;
+ }
+
+ std::string const& LowerCaseName() const noexcept
+ {
+ return this->Impl->Name.Lower;
+ }
+
+ long Line() const noexcept { return this->Impl->Line; }
+
+ std::vector<cmListFileArgument> const& Arguments() const noexcept
+ {
+ return this->Impl->Arguments;
+ }
+
+ operator cmCommandContext const&() const noexcept { return *this->Impl; }
+
+private:
+ struct Implementation : public cmCommandContext
+ {
+ Implementation(std::string name, long line,
+ std::vector<cmListFileArgument> args)
+ : cmCommandContext{ std::move(name), line }
+ , Arguments{ std::move(args) }
+ {
+ }
+ std::vector<cmListFileArgument> Arguments;
+ };
+
+ std::shared_ptr<Implementation const> Impl;
};
// Represent a backtrace (call stack). Provide value semantics
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7795654..fdf8307 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -583,7 +583,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
{
std::string mfcFlag;
if (cmProp p = this->Makefile->GetDefinition("CMAKE_MFC_FLAG")) {
- mfcFlag = *p;
+ mfcFlag = cmGeneratorExpression::Evaluate(*p, this, configName);
} else {
mfcFlag = "0";
}
@@ -1081,11 +1081,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
if (stackVal) {
fout << "\t\t\t\tStackReserveSize=\"" << *stackVal << "\"\n";
}
- temp = cmStrCat(
- target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact),
- '/', targetNames.ImportLibrary);
- fout << "\t\t\t\tImportLibrary=\""
- << this->ConvertToXMLOutputPathSingle(temp) << "\"";
+ if (!targetNames.ImportLibrary.empty()) {
+ temp = cmStrCat(target->GetDirectory(
+ configName, cmStateEnums::ImportLibraryArtifact),
+ '/', targetNames.ImportLibrary);
+ fout << "\t\t\t\tImportLibrary=\""
+ << this->ConvertToXMLOutputPathSingle(temp) << "\"";
+ }
if (this->FortranProject) {
fout << "\n\t\t\t\tLinkDLL=\"true\"";
}
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 91a600e..98f88c1 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -81,17 +81,14 @@ bool cmMacroHelperCommand::operator()(
argVs.emplace_back(argvName);
}
// Invoke all the functions that were collected in the block.
- cmListFileFunction newLFF;
// for each function
for (cmListFileFunction const& func : this->Functions) {
// Replace the formal arguments and then invoke the command.
- newLFF.Arguments.clear();
- newLFF.Arguments.reserve(func.Arguments.size());
- newLFF.Name = func.Name;
- newLFF.Line = func.Line;
+ std::vector<cmListFileArgument> newLFFArgs;
+ newLFFArgs.reserve(func.Arguments().size());
// for each argument of the current function
- for (cmListFileArgument const& k : func.Arguments) {
+ for (cmListFileArgument const& k : func.Arguments()) {
cmListFileArgument arg;
arg.Value = k.Value;
if (k.Delim != cmListFileArgument::Bracket) {
@@ -116,8 +113,10 @@ bool cmMacroHelperCommand::operator()(
}
arg.Delim = k.Delim;
arg.Line = k.Line;
- newLFF.Arguments.push_back(std::move(arg));
+ newLFFArgs.push_back(std::move(arg));
}
+ cmListFileFunction newLFF{ func.OriginalName(), func.Line(),
+ std::move(newLFFArgs) };
cmExecutionStatus status(makefile);
if (!makefile.ExecuteCommand(newLFF, status) || status.GetNestedError()) {
// The error message should have already included the call stack
@@ -157,7 +156,7 @@ bool cmMacroFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile& mf) const
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments(), expandedArguments);
return expandedArguments.empty() || expandedArguments[0] == this->Args[0];
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ac3a193..14ec689 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -306,8 +306,8 @@ void cmMakefile::PrintCommandTrace(
std::string temp;
bool expand = this->GetCMakeInstance()->GetTraceExpand();
- args.reserve(lff.Arguments.size());
- for (cmListFileArgument const& arg : lff.Arguments) {
+ args.reserve(lff.Arguments().size());
+ for (cmListFileArgument const& arg : lff.Arguments()) {
if (expand) {
temp = arg.Value;
this->ExpandVariablesInString(temp);
@@ -324,11 +324,11 @@ void cmMakefile::PrintCommandTrace(
Json::StreamWriterBuilder builder;
builder["indentation"] = "";
val["file"] = full_path;
- val["line"] = static_cast<Json::Value::Int64>(lff.Line);
+ val["line"] = static_cast<Json::Value::Int64>(lff.Line());
if (deferId) {
val["defer"] = *deferId;
}
- val["cmd"] = lff.Name.Original;
+ val["cmd"] = lff.OriginalName();
val["args"] = Json::Value(Json::arrayValue);
for (std::string const& arg : args) {
val["args"].append(arg);
@@ -341,11 +341,11 @@ void cmMakefile::PrintCommandTrace(
break;
}
case cmake::TraceFormat::TRACE_HUMAN:
- msg << full_path << "(" << lff.Line << "):";
+ msg << full_path << "(" << lff.Line() << "):";
if (deferId) {
msg << "DEFERRED:" << *deferId << ":";
}
- msg << " " << lff.Name.Original << "(";
+ msg << " " << lff.OriginalName() << "(";
for (std::string const& arg : args) {
msg << arg << " ";
@@ -451,7 +451,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// Lookup the command prototype.
if (cmState::Command command =
- this->GetState()->GetCommandByExactName(lff.Name.Lower)) {
+ this->GetState()->GetCommandByExactName(lff.LowerCaseName())) {
// Decide whether to invoke the command.
if (!cmSystemTools::GetFatalErrorOccured()) {
// if trace is enabled, print out invoke information
@@ -459,13 +459,13 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
this->PrintCommandTrace(lff, this->Backtrace.Top().DeferId);
}
// Try invoking the command.
- bool invokeSucceeded = command(lff.Arguments, status);
+ bool invokeSucceeded = command(lff.Arguments(), status);
bool hadNestedError = status.GetNestedError();
if (!invokeSucceeded || hadNestedError) {
if (!hadNestedError) {
// The command invocation requested that we report an error.
std::string const error =
- std::string(lff.Name.Original) + " " + status.GetError();
+ std::string(lff.OriginalName()) + " " + status.GetError();
this->IssueMessage(MessageType::FATAL_ERROR, error);
}
result = false;
@@ -477,7 +477,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
} else {
if (!cmSystemTools::GetFatalErrorOccured()) {
std::string error =
- cmStrCat("Unknown CMake command \"", lff.Name.Original, "\".");
+ cmStrCat("Unknown CMake command \"", lff.OriginalName(), "\".");
this->IssueMessage(MessageType::FATAL_ERROR, error);
result = false;
cmSystemTools::SetFatalErrorOccured();
@@ -1690,7 +1690,7 @@ void cmMakefile::Configure()
bool hasVersion = false;
// search for the right policy command
for (cmListFileFunction const& func : listFile.Functions) {
- if (func.Name.Lower == "cmake_minimum_required") {
+ if (func.LowerCaseName() == "cmake_minimum_required") {
hasVersion = true;
break;
}
@@ -1717,7 +1717,7 @@ void cmMakefile::Configure()
allowedCommands.insert("message");
isProblem = false;
for (cmListFileFunction const& func : listFile.Functions) {
- if (!cm::contains(allowedCommands, func.Name.Lower)) {
+ if (!cm::contains(allowedCommands, func.LowerCaseName())) {
isProblem = true;
break;
}
@@ -1737,7 +1737,7 @@ void cmMakefile::Configure()
bool hasProject = false;
// search for a project command
for (cmListFileFunction const& func : listFile.Functions) {
- if (func.Name.Lower == "project") {
+ if (func.LowerCaseName() == "project") {
hasProject = true;
break;
}
@@ -1754,12 +1754,12 @@ void cmMakefile::Configure()
"CMake is pretending there is a \"project(Project)\" command on "
"the first line.",
this->Backtrace);
- cmListFileFunction project;
- project.Name.Lower = "project";
- project.Arguments.emplace_back("Project", cmListFileArgument::Unquoted,
- 0);
- project.Arguments.emplace_back("__CMAKE_INJECTED_PROJECT_COMMAND__",
- cmListFileArgument::Unquoted, 0);
+ cmListFileFunction project{ "project",
+ 0,
+ { { "Project", cmListFileArgument::Unquoted,
+ 0 },
+ { "__CMAKE_INJECTED_PROJECT_COMMAND__",
+ cmListFileArgument::Unquoted, 0 } } };
listFile.Functions.insert(listFile.Functions.begin(), project);
}
}
@@ -3105,8 +3105,8 @@ cm::optional<std::string> cmMakefile::DeferGetCall(std::string const& id) const
std::string tmp;
for (DeferCommand const& dc : this->Defer->Commands) {
if (dc.Id == id) {
- tmp = dc.Command.Name.Original;
- for (cmListFileArgument const& arg : dc.Command.Arguments) {
+ tmp = dc.Command.OriginalName();
+ for (cmListFileArgument const& arg : dc.Command.Arguments()) {
tmp = cmStrCat(tmp, ';', arg.Value);
}
break;
diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx
index 29fd440..86188db 100644
--- a/Source/cmMakefileProfilingData.cxx
+++ b/Source/cmMakefileProfilingData.cxx
@@ -58,7 +58,7 @@ void cmMakefileProfilingData::StartEntry(const cmListFileFunction& lff,
cmsys::SystemInformation info;
Json::Value v;
v["ph"] = "B";
- v["name"] = lff.Name.Lower;
+ v["name"] = lff.LowerCaseName();
v["cat"] = "cmake";
v["ts"] = Json::Value::UInt64(
std::chrono::duration_cast<std::chrono::microseconds>(
@@ -67,9 +67,9 @@ void cmMakefileProfilingData::StartEntry(const cmListFileFunction& lff,
v["pid"] = static_cast<int>(info.GetProcessId());
v["tid"] = 0;
Json::Value argsValue;
- if (!lff.Arguments.empty()) {
+ if (!lff.Arguments().empty()) {
std::string args;
- for (const auto& a : lff.Arguments) {
+ for (auto const& a : lff.Arguments()) {
args += (args.empty() ? "" : " ") + a.Value;
}
argsValue["functionArgs"] = args;
diff --git a/Source/cmMakefileProfilingData.h b/Source/cmMakefileProfilingData.h
index a3f128b..a86764a 100644
--- a/Source/cmMakefileProfilingData.h
+++ b/Source/cmMakefileProfilingData.h
@@ -11,7 +11,7 @@ class StreamWriter;
}
class cmListFileContext;
-struct cmListFileFunction;
+class cmListFileFunction;
class cmMakefileProfilingData
{
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1e625a4..97440d2 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2077,6 +2077,7 @@ static std::string cmSystemToolsCMakeCursesCommand;
static std::string cmSystemToolsCMakeGUICommand;
static std::string cmSystemToolsCMClDepsCommand;
static std::string cmSystemToolsCMakeRoot;
+static std::string cmSystemToolsHTMLDoc;
void cmSystemTools::FindCMakeResources(const char* argv0)
{
std::string exe_dir;
@@ -2166,18 +2167,23 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
// Install tree has
// - "<prefix><CMAKE_BIN_DIR>/cmake"
// - "<prefix><CMAKE_DATA_DIR>"
- if (cmHasSuffix(exe_dir, CMAKE_BIN_DIR)) {
+ // - "<prefix><CMAKE_DOC_DIR>"
+ if (cmHasLiteralSuffix(exe_dir, CMAKE_BIN_DIR)) {
std::string const prefix =
- exe_dir.substr(0, exe_dir.size() - strlen(CMAKE_BIN_DIR));
- cmSystemToolsCMakeRoot = prefix + CMAKE_DATA_DIR;
+ exe_dir.substr(0, exe_dir.size() - cmStrLen(CMAKE_BIN_DIR));
+ cmSystemToolsCMakeRoot = cmStrCat(prefix, CMAKE_DATA_DIR);
+ if (cmSystemTools::FileExists(
+ cmStrCat(prefix, CMAKE_DOC_DIR "/html/index.html"))) {
+ cmSystemToolsHTMLDoc = cmStrCat(prefix, CMAKE_DOC_DIR "/html");
+ }
}
if (cmSystemToolsCMakeRoot.empty() ||
!cmSystemTools::FileExists(
- (cmSystemToolsCMakeRoot + "/Modules/CMake.cmake"))) {
+ cmStrCat(cmSystemToolsCMakeRoot, "/Modules/CMake.cmake"))) {
// Build tree has "<build>/bin[/<config>]/cmake" and
// "<build>/CMakeFiles/CMakeSourceDir.txt".
std::string dir = cmSystemTools::GetFilenamePath(exe_dir);
- std::string src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt";
+ std::string src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt");
cmsys::ifstream fin(src_dir_txt.c_str());
std::string src_dir;
if (fin && cmSystemTools::GetLineFromStream(fin, src_dir) &&
@@ -2185,13 +2191,18 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
cmSystemToolsCMakeRoot = src_dir;
} else {
dir = cmSystemTools::GetFilenamePath(dir);
- src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt";
+ src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt");
cmsys::ifstream fin2(src_dir_txt.c_str());
if (fin2 && cmSystemTools::GetLineFromStream(fin2, src_dir) &&
cmSystemTools::FileIsDirectory(src_dir)) {
cmSystemToolsCMakeRoot = src_dir;
}
}
+ if (!cmSystemToolsCMakeRoot.empty() && cmSystemToolsHTMLDoc.empty() &&
+ cmSystemTools::FileExists(
+ cmStrCat(dir, "/Utilities/Sphinx/html/index.html"))) {
+ cmSystemToolsHTMLDoc = cmStrCat(dir, "/Utilities/Sphinx/html");
+ }
}
#else
// Bootstrap build knows its source.
@@ -2234,6 +2245,11 @@ std::string const& cmSystemTools::GetCMakeRoot()
return cmSystemToolsCMakeRoot;
}
+std::string const& cmSystemTools::GetHTMLDoc()
+{
+ return cmSystemToolsHTMLDoc;
+}
+
std::string cmSystemTools::GetCurrentWorkingDirectory()
{
return cmSystemTools::CollapseFullPath(
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d571b96..1100f05 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -389,6 +389,7 @@ public:
static std::string const& GetCMakeCursesCommand();
static std::string const& GetCMClDepsCommand();
static std::string const& GetCMakeRoot();
+ static std::string const& GetHTMLDoc();
/** Get the CWD mapped through the KWSys translation map. */
static std::string GetCurrentWorkingDirectory();
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 750b0b5..7c7fbca 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -45,20 +45,21 @@ void cmVariableWatchCommandVariableAccessed(const std::string& variable,
std::string stack = *mf->GetProperty("LISTFILE_STACK");
if (!data->Command.empty()) {
- cmListFileFunction newLFF;
cmProp const currentListFile =
mf->GetDefinition("CMAKE_CURRENT_LIST_FILE");
const auto fakeLineNo =
std::numeric_limits<decltype(cmListFileArgument::Line)>::max();
- newLFF.Arguments = {
+
+ std::vector<cmListFileArgument> newLFFArgs{
{ variable, cmListFileArgument::Quoted, fakeLineNo },
{ accessString, cmListFileArgument::Quoted, fakeLineNo },
{ newValue ? newValue : "", cmListFileArgument::Quoted, fakeLineNo },
{ *currentListFile, cmListFileArgument::Quoted, fakeLineNo },
{ stack, cmListFileArgument::Quoted, fakeLineNo }
};
- newLFF.Name = data->Command;
- newLFF.Line = fakeLineNo;
+
+ cmListFileFunction newLFF{ data->Command, fakeLineNo,
+ std::move(newLFFArgs) };
cmExecutionStatus status(*makefile);
if (!makefile->ExecuteCommand(newLFF, status)) {
cmSystemTools::Error(
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a7b90b4..413166e 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1224,7 +1224,8 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmProp mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if (mfcFlag) {
- std::string const mfcFlagValue = *mfcFlag;
+ std::string const mfcFlagValue =
+ cmGeneratorExpression::Evaluate(*mfcFlag, this->LocalGenerator, config);
std::string useOfMfcValue = "false";
if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
@@ -3791,12 +3792,14 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string pdb = cmStrCat(this->GeneratorTarget->GetPDBDirectory(config),
'/', targetNames.PDB);
- std::string imLib =
- cmStrCat(this->GeneratorTarget->GetDirectory(
- config, cmStateEnums::ImportLibraryArtifact),
- '/', targetNames.ImportLibrary);
+ if (!targetNames.ImportLibrary.empty()) {
+ std::string imLib =
+ cmStrCat(this->GeneratorTarget->GetDirectory(
+ config, cmStateEnums::ImportLibraryArtifact),
+ '/', targetNames.ImportLibrary);
- linkOptions.AddFlag("ImportLibrary", imLib);
+ linkOptions.AddFlag("ImportLibrary", imLib);
+ }
linkOptions.AddFlag("ProgramDataBaseFile", pdb);
// A Windows Runtime component uses internal .NET metadata,
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 2c7a8a7..327c1c7 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -54,7 +54,7 @@ cmWhileFunctionBlocker::~cmWhileFunctionBlocker()
bool cmWhileFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile&) const
{
- return lff.Arguments.empty() || lff.Arguments == this->Args;
+ return lff.Arguments().empty() || lff.Arguments() == this->Args;
}
bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt
index a3c9946..a574c4e 100644
--- a/Tests/Assembler/CMakeLists.txt
+++ b/Tests/Assembler/CMakeLists.txt
@@ -8,7 +8,7 @@ set(SRCS)
# (at least) the following toolchains can process assembler files directly
# and also generate assembler files from C:
if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND
- NOT CMAKE_OSX_ARCHITECTURES)
+ NOT CMAKE_OSX_ARCHITECTURES MATCHES ";")
if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND UNIX)
AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"))
set(C_FLAGS "${CMAKE_C_FLAGS}")
@@ -16,6 +16,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND
if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};")
list(APPEND C_FLAGS ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT})
endif()
+ if(CMAKE_OSX_ARCHITECTURES)
+ list(APPEND C_FLAGS -arch ${CMAKE_OSX_ARCHITECTURES})
+ elseif("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ list(APPEND C_FLAGS -arch arm64)
+ endif()
# Clang on OS X, and perhaps other compilers, do not support -g
# for both generating and assembling, so drop it from generating.
list(REMOVE_ITEM C_FLAGS -g)
diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
index 524be92..8ada221 100644
--- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
+++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestArtifactsInteractive LANGUAGES C)
+project(TestArtifactsInteractive LANGUAGES NONE)
set (components Interpreter Development)
if (CMake_TEST_FindPython_NumPy)
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index fdfa36e..44484c3 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -243,6 +243,87 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ add_test(NAME FindPython.Python3.VersionRange.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3.VersionRange.LOCATION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3
+ -DPython3_FIND_STRATEGY=LOCATION
+ )
+ add_test(NAME FindPython.Python3.VersionRange.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3.VersionRange.VERSION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3
+ -DPython3_FIND_STRATEGY=VERSION
+ )
+ add_test(NAME FindPython.Python2.VersionRange.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.LOCATION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2
+ -DPython2_FIND_STRATEGY=LOCATION
+ )
+ add_test(NAME FindPython.Python2.VersionRange.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.VERSION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2
+ -DPython2_FIND_STRATEGY=VERSION
+ )
+ add_test(NAME FindPython.Python.V2.VersionRange.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.LOCATION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2
+ -DPython_FIND_STRATEGY=LOCATION
+ )
+ add_test(NAME FindPython.Python.V2.VersionRange.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.VERSION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2
+ -DPython_FIND_STRATEGY=VERSION
+ )
+ add_test(NAME FindPython.Python.V3.VersionRange.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.VersionRange.LOCATION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=3
+ -DPython_FIND_STRATEGY=LOCATION
+ )
+ add_test(NAME FindPython.Python.V3.VersionRange.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.VersionRange.VERSION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=3
+ -DPython_FIND_STRATEGY=VERSION
+ )
+
add_test(NAME FindPython.MultiplePackages COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -492,6 +573,29 @@ if(CMake_TEST_FindPython_IronPython)
--build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+
+ add_test(NAME FindPython.IronPython2.VersionRange.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/IronPython2.VersionRange.LOCATION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2
+ -DPython2_FIND_IMPLEMENTATIONS=IronPython
+ -DPython2_FIND_STRATEGY=LOCATION
+ )
+ add_test(NAME FindPython.IronPython2.VersionRange.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange"
+ "${CMake_BINARY_DIR}/Tests/FindPython/IronPython2.VersionRange.VERSION"
+ ${build_generator_args}
+ --build-project TestVersionRange
+ --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2
+ -DPython2_FIND_IMPLEMENTATIONS=IronPython
+ -DPython2_FIND_STRATEGY=VERSION
+ )
endif()
if(CMake_TEST_FindPython_PyPy)
diff --git a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
index fed963e..2164ac1 100644
--- a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
+++ b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.1)
-project(TestCustomFailureMessage.Check LANGUAGES C)
+project(TestCustomFailureMessage.Check LANGUAGES NONE)
find_package (Python3 REQUIRED COMPONENTS ${CHECK_COMPONENTS})
diff --git a/Tests/FindPython/ExactVersion/CMakeLists.txt b/Tests/FindPython/ExactVersion/CMakeLists.txt
index e09f73a..4aa748b 100644
--- a/Tests/FindPython/ExactVersion/CMakeLists.txt
+++ b/Tests/FindPython/ExactVersion/CMakeLists.txt
@@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 3.1)
-project(TestExactVersion C)
+project(TestExactVersion LANGUAGES NONE)
find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development)
-if (NOT Python${Python_MAJOR_VERSION}_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+if(NOT Python${Python_MAJOR_VERSION}_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter")
+if(NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Interpreter")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development")
+if(NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Development")
endif()
if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter)
@@ -26,22 +26,22 @@ endif()
# reset artifacts and second search with exact version already founded
-unset (Python${Python_MAJOR_VERSION}_EXECUTABLE)
-unset (_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE)
+unset(Python${Python_MAJOR_VERSION}_EXECUTABLE)
+unset(_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE)
-unset (_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE)
-unset (_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE)
+unset(_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE)
+unset(_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE)
-set (Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION})
+set(Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION})
find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} EXACT COMPONENTS Interpreter Development)
-if (NOT Python${Python_MAJOR_VERSION}_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+if(NOT Python${Python_MAJOR_VERSION}_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter")
+if(NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Interpreter")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development")
+if(NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Development")
endif()
if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter)
diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt
index d64fa1e..592329b 100644
--- a/Tests/FindPython/Implementation/CMakeLists.txt
+++ b/Tests/FindPython/Implementation/CMakeLists.txt
@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.1)
-project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} C)
+project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} LANGUAGES NONE)
set (Python${Python_REQUESTED_VERSION}_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
find_package(Python${Python_REQUESTED_VERSION} COMPONENTS Interpreter)
if (NOT Python${Python_REQUESTED_VERSION}_FOUND OR NOT Python${Python_REQUESTED_VERSION}_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python${Python_REQUESTED_VERSION}")
endif()
if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
@@ -24,7 +24,7 @@ set (Python_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter)
if (NOT Python_FOUND OR NOT Python_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt
index 3493c29..47ca022 100644
--- a/Tests/FindPython/IronPython/CMakeLists.txt
+++ b/Tests/FindPython/IronPython/CMakeLists.txt
@@ -1,23 +1,23 @@
cmake_minimum_required(VERSION 3.1)
-project(TestIronPython C)
+project(TestIronPython LANGUAGES NONE)
set (Python_FIND_IMPLEMENTATIONS IronPython)
find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Compiler)
if (NOT Python_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
if (NOT Python_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python Interpreter")
+ message (FATAL_ERROR "Failed to find Python Interpreter")
endif()
if (NOT Python_INTERPRETER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
endif()
if (NOT Python_Compiler_FOUND)
- message (FATAL_ERROR "Fail to found Python Compiler")
+ message (FATAL_ERROR "Failed to find Python Compiler")
endif()
if (NOT Python_COMPILER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous compiler ID (${Python_COMPILER_ID})")
diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt
index 1db798c..fd9d947 100644
--- a/Tests/FindPython/IronPython2/CMakeLists.txt
+++ b/Tests/FindPython/IronPython2/CMakeLists.txt
@@ -1,23 +1,23 @@
cmake_minimum_required(VERSION 3.1)
-project(TestIronPython2 C)
+project(TestIronPython2 LANGUAGES NONE)
set (Python2_FIND_IMPLEMENTATIONS "IronPython")
find_package(Python2 COMPONENTS Interpreter Compiler)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (NOT Python2_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 Interpreter")
+ message (FATAL_ERROR "Failed to find Python 2 Interpreter")
endif()
if (NOT Python2_INTERPRETER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})")
endif()
if (NOT Python2_Compiler_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 Compiler")
+ message (FATAL_ERROR "Failed to find Python 2 Compiler")
endif()
if (NOT Python2_COMPILER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous compiler ID (${Python2_COMPILER_ID})")
diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt
index b4ade8c..6539b63 100644
--- a/Tests/FindPython/PyPy/CMakeLists.txt
+++ b/Tests/FindPython/PyPy/CMakeLists.txt
@@ -1,29 +1,29 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPyPy C)
+project(TestPyPy LANGUAGES NONE)
set (Python_FIND_IMPLEMENTATIONS PyPy)
find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development)
if (NOT Python_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION}")
endif()
if (NOT Python_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy Interpreter")
+ message (FATAL_ERROR "Failed to find Python PyPy Interpreter")
endif()
if (NOT Python_INTERPRETER_ID STREQUAL "PyPy")
message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
endif()
if (NOT Python_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Module")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development.Module")
endif()
if (NOT Python_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Embed")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development.Embed")
endif()
if (NOT Python_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development")
endif()
if(NOT TARGET Python::Interpreter)
diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt
index 2f0ddc9..4efea23 100644
--- a/Tests/FindPython/PyPy2/CMakeLists.txt
+++ b/Tests/FindPython/PyPy2/CMakeLists.txt
@@ -1,29 +1,29 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPyPy2 C)
+project(TestPyPy2 LANGUAGES NONE)
set (Python2_FIND_IMPLEMENTATIONS "PyPy")
find_package(Python2 COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2")
+ message (FATAL_ERROR "Failed to find Python PyPy 2")
endif()
if (NOT Python2_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Interpreter")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Interpreter")
endif()
if (NOT Python2_INTERPRETER_ID STREQUAL "PyPy")
message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})")
endif()
if (NOT Python2_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Module")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Development.Module")
endif()
if (NOT Python2_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Embed")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Development.Embed")
endif()
if (NOT Python2_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Development")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Development")
endif()
if(NOT TARGET Python2::Interpreter)
diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt
index 5562d57..7454a68 100644
--- a/Tests/FindPython/PyPy3/CMakeLists.txt
+++ b/Tests/FindPython/PyPy3/CMakeLists.txt
@@ -1,29 +1,29 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPyPy3 C)
+project(TestPyPy3 LANGUAGES NONE)
set (Python3_FIND_IMPLEMENTATIONS "PyPy")
find_package(Python3 COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3")
+ message (FATAL_ERROR "Failed to find Python PyPy 3")
endif()
if (NOT Python3_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Interpreter")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Interpreter")
endif()
if (NOT Python3_INTERPRETER_ID STREQUAL "PyPy")
message (FATAL_ERROR "Erroneous interpreter ID (${Python3_INTERPRETER_ID})")
endif()
if (NOT Python3_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Module")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Development.Module")
endif()
if (NOT Python3_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Embed")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Development.Embed")
endif()
if (NOT Python3_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Development")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Development")
endif()
if(NOT TARGET Python3::Interpreter)
diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt
index e8828a2..9bec22f 100644
--- a/Tests/FindPython/Python/CMakeLists.txt
+++ b/Tests/FindPython/Python/CMakeLists.txt
@@ -1,18 +1,18 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython C)
+project(TestPython LANGUAGES C)
include(CTest)
find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Development)
if (NOT Python_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
if (NOT Python_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module'")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module'")
endif()
if (NOT Python_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed'")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed'")
endif()
if(NOT TARGET Python::Interpreter)
diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt
index 609d80f..39577b2 100644
--- a/Tests/FindPython/Python2/CMakeLists.txt
+++ b/Tests/FindPython/Python2/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython2 C)
+project(TestPython2 LANGUAGES C)
include(CTest)
@@ -11,16 +11,16 @@ endif()
find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (NOT Python2_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 'Development' component")
+ message (FATAL_ERROR "Failed to find Python 2 'Development' component")
endif()
if (NOT Python2_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 'Development.Module' component")
+ message (FATAL_ERROR "Failed to find Python 2 'Development.Module' component")
endif()
if (NOT Python2_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 'Development.Embed' component")
+ message (FATAL_ERROR "Failed to find Python 2 'Development.Embed' component")
endif()
if(NOT TARGET Python2::Interpreter)
diff --git a/Tests/FindPython/Python2Embedded/CMakeLists.txt b/Tests/FindPython/Python2Embedded/CMakeLists.txt
index 1cf6034..a1036ce 100644
--- a/Tests/FindPython/Python2Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python2Embedded/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython2Embedded C)
+project(TestPython2Embedded LANGUAGES C)
include(CTest)
find_package(Python2 REQUIRED COMPONENTS Development.Embed)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (Python2_Development_FOUND)
message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/Python2Module/CMakeLists.txt b/Tests/FindPython/Python2Module/CMakeLists.txt
index 0bc3390..c9d46ac 100644
--- a/Tests/FindPython/Python2Module/CMakeLists.txt
+++ b/Tests/FindPython/Python2Module/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython2Module C)
+project(TestPython2Module LANGUAGES C)
include(CTest)
find_package(Python2 REQUIRED COMPONENTS Interpreter Development.Module)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (Python2_Development_FOUND)
message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt
index d6e5fdb..e40557d 100644
--- a/Tests/FindPython/Python3/CMakeLists.txt
+++ b/Tests/FindPython/Python3/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython3 C)
+project(TestPython3 LANGUAGES C)
include(CTest)
@@ -11,16 +11,16 @@ endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if (NOT Python3_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python 3 'Development' component")
+ message (FATAL_ERROR "Failed to find Python 3 'Development' component")
endif()
if (NOT Python3_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python 3 'Development.Module' component")
+ message (FATAL_ERROR "Failed to find Python 3 'Development.Module' component")
endif()
if (NOT Python3_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python 3 'Development.Embed' component")
+ message (FATAL_ERROR "Failed to find Python 3 'Development.Embed' component")
endif()
if(NOT TARGET Python3::Interpreter)
diff --git a/Tests/FindPython/Python3Embedded/CMakeLists.txt b/Tests/FindPython/Python3Embedded/CMakeLists.txt
index 184c0b4..c45bd8c 100644
--- a/Tests/FindPython/Python3Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python3Embedded/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython3Embedded C)
+project(TestPython3Embedded LANGUAGES C)
include(CTest)
find_package(Python3 REQUIRED COMPONENTS Development.Embed)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if (Python3_Development_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt
index 676f4c8..5945962 100644
--- a/Tests/FindPython/Python3Module/CMakeLists.txt
+++ b/Tests/FindPython/Python3Module/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython3Module C)
+project(TestPython3Module LANGUAGES C)
include(CTest)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if (Python3_Development_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
index 39e8ea5..6e854e3 100644
--- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
@@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 3.1)
-project(TestRequiredArtifacts LANGUAGES C)
+project(TestRequiredArtifacts LANGUAGES NONE)
include(CTest)
find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
index b859ac5..036407f 100644
--- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestRequiredArtifacts.Check LANGUAGES C)
+project(TestRequiredArtifacts.Check LANGUAGES NONE)
set (components)
if (CHECK_INTERPRETER)
@@ -29,13 +29,13 @@ endif()
if (CHECK_INTERPRETER AND NOT Python3_EXECUTABLE STREQUAL required_interpreter)
- message (FATAL_ERROR "Fail to use input variable Python3_EXECUTABLE")
+ message (FATAL_ERROR "Failed to use input variable Python3_EXECUTABLE")
endif()
if (CHECK_LIBRARY AND NOT Python3_LIBRARY_RELEASE STREQUAL required_library)
- message (FATAL_ERROR "Fail to use input variable Python3_LIBRARY")
+ message (FATAL_ERROR "Failed to use input variable Python3_LIBRARY")
endif()
if (CHECK_INCLUDE AND NOT Python3_INCLUDE_DIRS STREQUAL required_include)
- message (FATAL_ERROR "Fail to use input variable Python3_INCLUDE_DIR")
+ message (FATAL_ERROR "Failed to use input variable Python3_INCLUDE_DIR")
endif()
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
index 36daa9f..84f7362 100644
--- a/Tests/FindPython/SOABI/CMakeLists.txt
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.1)
-project(TestSOABI C)
+project(TestSOABI LANGUAGES C)
find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if(NOT DEFINED Python3_SOABI)
diff --git a/Tests/FindPython/VersionRange/CMakeLists.txt b/Tests/FindPython/VersionRange/CMakeLists.txt
new file mode 100644
index 0000000..0d946f5
--- /dev/null
+++ b/Tests/FindPython/VersionRange/CMakeLists.txt
@@ -0,0 +1,55 @@
+cmake_minimum_required (VERSION 3.18...3.19)
+
+project (TestVersionRange LANGUAGES NONE)
+
+
+find_package (${Python} ${Python_REQUESTED_VERSION} EXACT COMPONENTS Interpreter)
+if (NOT ${Python}_FOUND)
+ message (FATAL_ERROR "Failed to find ${Python} ${Python_REQUESTED_VERSION}")
+endif()
+
+if (Python_REQUESTED_VERSION VERSION_LESS 3.0)
+ set (IN_VERSION_RANGE 2.0...<3.0)
+ set (OUT_VERSION_RANGE 2.0...<${${Python}_VERSION})
+else()
+ set (IN_VERSION_RANGE 3.0...<4.0)
+ set (OUT_VERSION_RANGE 3.0...<${${Python}_VERSION})
+endif()
+
+function (FIND_PYTHON EXPECTED_VERSION)
+ unset (_${Python}_EXECUTABLE CACHE)
+ unset (_${Python}_LIBRARY_RELEASE CACHE)
+ unset (_${Python}_INCLUDE_DIR CACHE)
+ unset (${Python}_FOUND)
+
+ find_package (${ARGN})
+
+ if (EXPECTED_VERSION STREQUAL "NONE")
+ if (${Python}_FOUND)
+ message (SEND_ERROR "Unexpectedly found version: ${${Python}_VERSION} for ${ARGN}")
+ endif()
+ return()
+ endif()
+
+ if (NOT ${Python}_FOUND)
+ message (SEND_ERROR "Not found: ${ARGN}")
+ elseif (NOT ${Python}_VERSION VERSION_EQUAL EXPECTED_VERSION)
+ message (SEND_ERROR "Wrong version: ${${Python}_VERSION} for ${ARGN}")
+ endif()
+endfunction()
+
+find_python (${${Python}_VERSION} ${Python} ${IN_VERSION_RANGE} COMPONENTS Interpreter)
+if (${Python}_FIND_IMPLEMENTATIONS STREQUAL "IronPython")
+ find_python (${${Python}_VERSION} ${Python} ${IN_VERSION_RANGE} COMPONENTS Compiler)
+else()
+ find_python (${${Python}_VERSION} ${Python} ${IN_VERSION_RANGE} COMPONENTS Development)
+endif()
+
+find_python ("NONE" ${Python} ${OUT_VERSION_RANGE} COMPONENTS Interpreter)
+if (${Python}_FIND_IMPLEMENTATIONS STREQUAL "IronPython")
+ find_python ("NONE" ${Python} ${OUT_VERSION_RANGE} COMPONENTS Compiler)
+else()
+ find_python ("NONE" ${Python} ${OUT_VERSION_RANGE} COMPONENTS Development)
+endif()
+
+find_python ("NONE" ${Python} 5...6 COMPONENTS Interpreter)
diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt
index 045a3f2..dae3282 100644
--- a/Tests/FindPython/VirtualEnv/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt
@@ -6,7 +6,7 @@ include(CTest)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/py3venv")
diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
index 565095a..23d208d 100644
--- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
@@ -6,7 +6,7 @@ include(CTest)
find_program(CONDA_EXECUTABLE conda)
if (CONDA_EXECUTABLE EQUAL NOTFOUND)
- message (FATAL_ERROR "Fail to found Conda")
+ message (FATAL_ERROR "Failed to find Conda")
endif()
set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/condaenv")
diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in
index bf98e91..3632e03 100644
--- a/Tests/MFC/CMakeLists.txt.in
+++ b/Tests/MFC/CMakeLists.txt.in
@@ -65,3 +65,6 @@ if("${CMAKE_MFC_FLAG}" STREQUAL "2")
set(CMAKE_INSTALL_MFC_LIBRARIES ON)
include(InstallRequiredSystemLibraries)
endif()
+
+# Encode the value inside a generator expression to test evaluation.
+set(CMAKE_MFC_FLAG "$<1:${CMAKE_MFC_FLAG}>")
diff --git a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake
index 5f5f7f5..6becc3c 100644
--- a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake
@@ -2,3 +2,4 @@ include(RunCMake)
run_cmake(components)
run_cmake(missing-components)
+run_cmake(version-range)
diff --git a/Tests/RunCMake/FindSWIG/version-range.cmake b/Tests/RunCMake/FindSWIG/version-range.cmake
new file mode 100644
index 0000000..7ba1134
--- /dev/null
+++ b/Tests/RunCMake/FindSWIG/version-range.cmake
@@ -0,0 +1,30 @@
+cmake_minimum_required (VERSION 3.18...3.19)
+
+find_package (SWIG)
+if (NOT SWIG_FOUND)
+ message (FATAL_ERROR "Failed to find SWIG")
+endif()
+
+# clean-up SWIG variables
+unset (SWIG_EXECUTABLE CACHE)
+unset (SWIG_DIR CACHE)
+
+## Specify a range including current SWIG version
+string (REGEX MATCH "^([0-9]+)" upper_version "${SWIG_VERSION}")
+math (EXPR upper_version "${upper_version} + 1")
+
+find_package (SWIG 1.0...${upper_version}.0)
+if (NOT SWIG_FOUND)
+ message (FATAL_ERROR "Failed to find SWIG with version range 1.0...${upper_version}.0")
+endif()
+
+# clean-up SWIG variables
+unset (SWIG_EXECUTABLE CACHE)
+unset (SWIG_DIR CACHE)
+
+## Specify a range excluding current SWIG version
+set (range 1.0...<${SWIG_VERSION})
+find_package (SWIG ${range})
+if (SWIG_FOUND)
+ message (FATAL_ERROR "Unexpectedly find SWIG with version range ${range}")
+endif()
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index c13c694..7d96e50 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -153,6 +153,7 @@ function(run_cmake test)
"|contact PGI Sales at"
"|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type"
+ "|[^\n]*objc[^\n]*: Class AMSupportURL[^\n]* One of the two will be used. Which one is undefined."
"|[^\n]*is a member of multiple groups"
"|[^\n]*offset in archive not a multiple of 8"
"|[^\n]*from Time Machine by path"
diff --git a/Tests/RunCMake/VS10Project/NoImpLib-check.cmake b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake
new file mode 100644
index 0000000..50722b2
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake
@@ -0,0 +1,23 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(found_ImportLibrary 0)
+set(found_TargetExt_dll 0)
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "<ImportLibrary>")
+ set(found_ImportLibrary 1)
+ endif()
+ if(line MATCHES "<TargetExt[^\n]*\\.dll")
+ set(found_TargetExt_dll 1)
+ endif()
+endforeach()
+if(found_ImportLibrary)
+ string(APPEND RunCMake_TEST_FAILED "ImportLibrary incorrectly found in\n ${vcProjectFile}\n")
+endif()
+if(NOT found_TargetExt_dll)
+ string(APPEND RunCMake_TEST_FAILED "TargetExt not found in\n ${vcProjectFile}\n")
+endif()
diff --git a/Tests/RunCMake/VS10Project/NoImpLib.cmake b/Tests/RunCMake/VS10Project/NoImpLib.cmake
new file mode 100644
index 0000000..2c11eac
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/NoImpLib.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+set(CMAKE_IMPORT_LIBRARY_SUFFIX "")
+add_library(foo SHARED empty.c)
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 8e56e1b..133dacc 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -11,6 +11,7 @@ run_cmake(VsCsharpSourceGroup)
run_cmake(VsCSharpCompilerOpts)
run_cmake(ExplicitCMakeLists)
run_cmake(InterfaceLibSources)
+run_cmake(NoImpLib)
run_cmake(RuntimeLibrary)
run_cmake(SourceGroupCMakeLists)
run_cmake(SourceGroupTreeCMakeLists)