summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-properties.7.rst16
-rw-r--r--Help/prop_tgt/AUTOGEN_PARALLEL.rst6
-rw-r--r--Help/prop_tgt/AUTOMOC.rst2
-rw-r--r--Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst6
-rw-r--r--Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst4
-rw-r--r--Help/prop_tgt/AUTORCC.rst7
-rw-r--r--Help/prop_tgt/AUTORCC_OPTIONS.rst4
-rw-r--r--Help/prop_tgt/AUTOUIC.rst7
-rw-r--r--Help/prop_tgt/AUTOUIC_OPTIONS.rst4
-rw-r--r--Help/release/dev/FindPython-SOABI.rst6
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake1
-rw-r--r--Modules/FindLibXml2.cmake19
-rw-r--r--Modules/FindOpenSSL.cmake12
-rw-r--r--Modules/FindPython.cmake7
-rw-r--r--Modules/FindPython/Support.cmake50
-rw-r--r--Modules/FindPython3.cmake7
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmFindPackageCommand.cxx46
-rw-r--r--Source/cmFindPackageCommand.h1
-rw-r--r--Tests/FindPython/CMakeLists.txt28
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt12
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv-stderr.txt10
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt5
23 files changed, 199 insertions, 63 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 10a0c7c..b3802d1 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -27,6 +27,8 @@ Properties of Global Scope
/prop_gbl/CMAKE_ROLE
/prop_gbl/DEBUG_CONFIGURATIONS
/prop_gbl/DISABLED_FEATURES
+ /prop_gbl/ECLIPSE_EXTRA_CPROJECT_CONTENTS
+ /prop_gbl/ECLIPSE_EXTRA_NATURES
/prop_gbl/ENABLED_FEATURES
/prop_gbl/ENABLED_LANGUAGES
/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS
@@ -37,12 +39,10 @@ Properties of Global Scope
/prop_gbl/GLOBAL_DEPENDS_DEBUG_MODE
/prop_gbl/GLOBAL_DEPENDS_NO_CYCLES
/prop_gbl/IN_TRY_COMPILE
+ /prop_gbl/JOB_POOLS
/prop_gbl/PACKAGES_FOUND
/prop_gbl/PACKAGES_NOT_FOUND
- /prop_gbl/JOB_POOLS
/prop_gbl/PREDEFINED_TARGETS_FOLDER
- /prop_gbl/ECLIPSE_EXTRA_NATURES
- /prop_gbl/ECLIPSE_EXTRA_CPROJECT_CONTENTS
/prop_gbl/REPORT_UNDEFINED_PROPERTIES
/prop_gbl/RULE_LAUNCH_COMPILE
/prop_gbl/RULE_LAUNCH_CUSTOM
@@ -130,20 +130,20 @@ Properties on Targets
/prop_tgt/AUTOGEN_ORIGIN_DEPENDS
/prop_tgt/AUTOGEN_PARALLEL
/prop_tgt/AUTOGEN_TARGET_DEPENDS
+ /prop_tgt/AUTOMOC
/prop_tgt/AUTOMOC_COMPILER_PREDEFINES
/prop_tgt/AUTOMOC_DEPEND_FILTERS
/prop_tgt/AUTOMOC_EXECUTABLE
/prop_tgt/AUTOMOC_MACRO_NAMES
/prop_tgt/AUTOMOC_MOC_OPTIONS
/prop_tgt/AUTOMOC_PATH_PREFIX
- /prop_tgt/AUTOMOC
+ /prop_tgt/AUTORCC
+ /prop_tgt/AUTORCC_EXECUTABLE
+ /prop_tgt/AUTORCC_OPTIONS
/prop_tgt/AUTOUIC
/prop_tgt/AUTOUIC_EXECUTABLE
/prop_tgt/AUTOUIC_OPTIONS
/prop_tgt/AUTOUIC_SEARCH_PATHS
- /prop_tgt/AUTORCC
- /prop_tgt/AUTORCC_EXECUTABLE
- /prop_tgt/AUTORCC_OPTIONS
/prop_tgt/BINARY_DIR
/prop_tgt/BUILD_RPATH
/prop_tgt/BUILD_RPATH_USE_ORIGIN
@@ -446,8 +446,8 @@ Properties on Source Files
:maxdepth: 1
/prop_sf/ABSTRACT
- /prop_sf/AUTOUIC_OPTIONS
/prop_sf/AUTORCC_OPTIONS
+ /prop_sf/AUTOUIC_OPTIONS
/prop_sf/COMPILE_DEFINITIONS
/prop_sf/COMPILE_FLAGS
/prop_sf/COMPILE_OPTIONS
diff --git a/Help/prop_tgt/AUTOGEN_PARALLEL.rst b/Help/prop_tgt/AUTOGEN_PARALLEL.rst
index 07fbc5a..968b619 100644
--- a/Help/prop_tgt/AUTOGEN_PARALLEL.rst
+++ b/Help/prop_tgt/AUTOGEN_PARALLEL.rst
@@ -4,9 +4,9 @@ AUTOGEN_PARALLEL
Number of parallel ``moc`` or ``uic`` processes to start when using
:prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
-The custom `<origin>_autogen` target starts a number of threads of which
+The custom ``<origin>_autogen`` target starts a number of threads of which
each one parses a source file and on demand starts a ``moc`` or ``uic``
-process. :prop_tgt:`AUTOGEN_PARALLEL` controls how many parallel threads
+process. ``AUTOGEN_PARALLEL`` controls how many parallel threads
(and therefore ``moc`` or ``uic`` processes) are started.
- An empty (or unset) value or the string ``AUTO`` sets the number of
@@ -14,7 +14,7 @@ process. :prop_tgt:`AUTOGEN_PARALLEL` controls how many parallel threads
- A positive non zero integer value sets the exact thread/process count.
- Otherwise a single thread/process is started.
-By default :prop_tgt:`AUTOGEN_PARALLEL` is initialized from
+By default ``AUTOGEN_PARALLEL`` is initialized from
:variable:`CMAKE_AUTOGEN_PARALLEL`.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index f6dfabd..c18859b 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -172,7 +172,7 @@ variables. If the call is in a different context than the
then the version variables might not be available to the :prop_tgt:`AUTOMOC`
enabled target.
In that case the version variables can be forwarded from the
-`find_package(Qt[45]...)` calling context to the :command:`add_executable`
+``find_package(Qt[45]...)`` calling context to the :command:`add_executable`
or :command:`add_library` calling context as directory properties.
The following Qt5 example demonstrates the procedure.
diff --git a/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst b/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
index ebd5c49..330849b 100644
--- a/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
@@ -1,7 +1,7 @@
AUTOMOC_MOC_OPTIONS
-------------------
-Additional options for moc when using :prop_tgt:`AUTOMOC`
+Additional options for ``moc`` when using :prop_tgt:`AUTOMOC`
This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON``
for this target. In this case, it holds additional command line
@@ -9,7 +9,9 @@ options which will be used when ``moc`` is executed during the build, i.e.
it is equivalent to the optional ``OPTIONS`` argument of the
:module:`qt4_wrap_cpp() <FindQt4>` macro.
-By default it is empty.
+This property is initialized by the value of the
+:variable:`CMAKE_AUTOMOC_MOC_OPTIONS` variable if it is set when a target
+is created, or an empty string otherwise.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
diff --git a/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
index e2ebb3f..3e3059d 100644
--- a/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
+++ b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
@@ -21,11 +21,11 @@ with Qt.
Reproducible builds
^^^^^^^^^^^^^^^^^^^
-For reproducible builds is is recommended to keep headers that are ``moc``
+For reproducible builds it is recommended to keep headers that are ``moc``
compiled in one of the target
:command:`include directories <target_include_directories>` and set
:prop_tgt:`AUTOMOC_PATH_PREFIX` to ``ON`` (which is the default). This ensures
-that
+that:
- ``moc`` output files are identical on different build setups,
- ``moc`` output files will compile correctly when the source and/or
diff --git a/Help/prop_tgt/AUTORCC.rst b/Help/prop_tgt/AUTORCC.rst
index cca3e58..9a98f44 100644
--- a/Help/prop_tgt/AUTORCC.rst
+++ b/Help/prop_tgt/AUTORCC.rst
@@ -31,9 +31,10 @@ Modifiers
The ``rcc`` executable will be detected automatically, but can be forced to
a certain binary by setting this target property.
-:prop_sf:`AUTORCC_OPTIONS`:
-Additional command line options for ``rcc`` can be set via this ``.qrc``
-source file property.
+:prop_tgt:`AUTORCC_OPTIONS`:
+Additional command line options for ``rcc`` can be set via this target
+property. The corresponding :prop_sf:`AUTORCC_OPTIONS` source file property
+can be used to specify options to be applied only to a specific ``.qrc`` file.
:prop_sf:`SKIP_AUTORCC`:
``.qrc`` files can be excluded from :prop_tgt:`AUTORCC` processing by
diff --git a/Help/prop_tgt/AUTORCC_OPTIONS.rst b/Help/prop_tgt/AUTORCC_OPTIONS.rst
index d6ade5a..5261aff 100644
--- a/Help/prop_tgt/AUTORCC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTORCC_OPTIONS.rst
@@ -8,11 +8,9 @@ when ``rcc`` is executed during the build via :prop_tgt:`AUTORCC`,
i.e. it is equivalent to the optional ``OPTIONS`` argument of the
:module:`qt4_add_resources() <FindQt4>` macro.
-By default it is empty.
-
This property is initialized by the value of the
:variable:`CMAKE_AUTORCC_OPTIONS` variable if it is set when a target is
-created.
+created, or an empty string otherwise.
The options set on the target may be overridden by :prop_sf:`AUTORCC_OPTIONS`
set on the ``.qrc`` source file.
diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst
index 5cf8755..cd24f5e 100644
--- a/Help/prop_tgt/AUTOUIC.rst
+++ b/Help/prop_tgt/AUTOUIC.rst
@@ -52,8 +52,11 @@ Modifiers
The ``uic`` executable will be detected automatically, but can be forced to
a certain binary using this target property.
-:prop_sf:`AUTOUIC_OPTIONS`: Additional command line options for ``uic`` can
-be set via this source file property on a ``<base_name>.ui`` file.
+:prop_tgt:`AUTOUIC_OPTIONS`:
+Additional command line options for ``uic`` can be set via this target
+property. The corresponding :prop_sf:`AUTOUIC_OPTIONS` source file property
+can be used to specify options to be applied only to a specific
+``<base_name>.ui`` file.
:prop_sf:`SKIP_AUTOUIC`:
Source files can be excluded from :prop_tgt:`AUTOUIC` processing by setting
diff --git a/Help/prop_tgt/AUTOUIC_OPTIONS.rst b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
index 3f613b9..425ea1c 100644
--- a/Help/prop_tgt/AUTOUIC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
@@ -8,11 +8,9 @@ This property holds additional command line options which will be used when
equivalent to the optional ``OPTIONS`` argument of the
:module:`qt4_wrap_ui() <FindQt4>` macro.
-By default it is empty.
-
This property is initialized by the value of the
:variable:`CMAKE_AUTOUIC_OPTIONS` variable if it is set when a target is
-created.
+created, or an empty string otherwise.
The options set on the target may be overridden by :prop_sf:`AUTOUIC_OPTIONS`
set on the ``.ui`` source file.
diff --git a/Help/release/dev/FindPython-SOABI.rst b/Help/release/dev/FindPython-SOABI.rst
new file mode 100644
index 0000000..29f7292
--- /dev/null
+++ b/Help/release/dev/FindPython-SOABI.rst
@@ -0,0 +1,6 @@
+FindPython-SOABI
+----------------
+
+* The :module:`FindPython3` and :module:`FindPython` modules gained,
+ respectively, variable ``Python3_SOABI`` and ``Python_SOABI`` giving
+ the standard extension suffix for modules.
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index e1ce617..2dc75d6 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -9,6 +9,7 @@
macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
set(${_VAR}
FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG
+ FAIL_REGEX "switch .* is no longer supported" # GNU
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "optimization flag .* not supported" # Clang
FAIL_REGEX "unknown argument ignored" # Clang (cl)
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 9480cea..f551dfe 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -52,7 +52,6 @@ The following cache variables may also be set:
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
-set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
HINTS
@@ -78,9 +77,7 @@ find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
# for backwards compat. with KDE 4.0.x:
set(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
-if(PC_LIBXML_VERSION)
- set(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION})
-elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
+if(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
file(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str
REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"")
@@ -89,9 +86,20 @@ elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.
unset(libxml2_version_str)
endif()
-set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR} ${PC_LIBXML_INCLUDE_DIRS})
+set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR})
set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY})
+# Did we find the same installation as pkg-config?
+# If so, use additional information from it.
+unset(LIBXML2_DEFINITIONS)
+foreach(libxml2_pc_lib_dir IN LISTS PC_LIBXML_LIBDIR PC_LIBXML_LIBRARY_DIRS)
+ if (LIBXML2_LIBRARY MATCHES "^${libxml2_pc_lib_dir}")
+ list(APPEND LIBXML2_INCLUDE_DIRS ${PC_LIBXML_INCLUDE_DIRS})
+ set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
+ break()
+ endif()
+endforeach()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
REQUIRED_VARS LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR
@@ -102,6 +110,7 @@ mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARY LIBXML2_XMLLINT_EXECUTABLE)
if(LibXml2_FOUND AND NOT TARGET LibXml2::LibXml2)
add_library(LibXml2::LibXml2 UNKNOWN IMPORTED)
set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}")
+ set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_COMPILE_OPTIONS "${LIBXML2_DEFINITIONS}")
set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}")
endif()
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 3688ae9..043fc6c 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -65,7 +65,7 @@ macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
endif()
endmacro()
-function(_OpenSSL_add_dependencies libraries_var library)
+function(_OpenSSL_add_dependencies libraries_var)
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND ${libraries_var} ${CMAKE_THREAD_LIBS_INIT})
endif()
@@ -341,13 +341,14 @@ else()
endif()
-# compat defines
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} )
_OpenSSL_test_and_find_dependencies("${OPENSSL_SSL_LIBRARY}" "${OPENSSL_CRYPTO_LIBRARY}")
if(_OpenSSL_has_dependencies)
- _OpenSSL_add_dependencies( OPENSSL_SSL_LIBRARIES "${OPENSSL_SSL_LIBRARY}" )
- _OpenSSL_add_dependencies( OPENSSL_CRYPTO_LIBRARIES "${OPENSSL_CRYPTO_LIBRARY}" )
+ _OpenSSL_add_dependencies( OPENSSL_SSL_LIBRARIES )
+ _OpenSSL_add_dependencies( OPENSSL_CRYPTO_LIBRARIES )
+ _OpenSSL_add_dependencies( OPENSSL_LIBRARIES )
endif()
function(from_hex HEX DEC)
@@ -417,9 +418,6 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
endif ()
endif ()
-set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} )
-list(REMOVE_DUPLICATES OPENSSL_LIBRARIES)
-
foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS)
if(_comp STREQUAL "Crypto")
if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 177ed58..be272e1 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -93,6 +93,13 @@ This module will set the following variables in your project
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``.
+``Python_SOABI``
+ Extension suffix for modules.
+
+ Information returned by
+ ``distutils.sysconfig.get_config_flag('SOABI')`` or computed from
+ ``distutils.sysconfig.get_config_flag('EXT_SUFFIX')`` or
+ ``python-config --extension-suffix``.
``Python_Compiler_FOUND``
System has the Python compiler.
``Python_COMPILER``
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 0163d56..086b229 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -244,12 +244,16 @@ endfunction()
function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
unset (${_PYTHON_PGCV_VALUE} PARENT_SCOPE)
- if (NOT NAME MATCHES "^(PREFIX|ABIFLAGS|CONFIGDIR|INCLUDES|LIBS)$")
+ if (NOT NAME MATCHES "^(PREFIX|ABIFLAGS|CONFIGDIR|INCLUDES|LIBS|SOABI)$")
return()
endif()
if (_${_PYTHON_PREFIX}_CONFIG)
- set (config_flag "--${NAME}")
+ if (NAME STREQUAL "SOABI")
+ set (config_flag "--extension-suffix")
+ else()
+ set (config_flag "--${NAME}")
+ endif()
string (TOLOWER "${config_flag}" config_flag)
execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" ${config_flag}
RESULT_VARIABLE _result
@@ -264,6 +268,9 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
string (REGEX MATCHALL "(-I|-iwithsysroot)[ ]*[^ ]+" _values "${_values}")
string (REGEX REPLACE "(-I|-iwithsysroot)[ ]*" "" _values "${_values}")
list (REMOVE_DUPLICATES _values)
+ elseif (NAME STREQUAL "SOABI")
+ # clean-up: remove prefix character and suffix
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\.(so|pyd))$" "\\1" _values "${_values}")
endif()
endif()
endif()
@@ -289,6 +296,25 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
if (_result)
unset (_values)
endif()
+ elseif (NAME STREQUAL "SOABI")
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))"
+ RESULT_VARIABLE _result
+ OUTPUT_VARIABLE _soabi
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (_result)
+ unset (_values)
+ else()
+ list (GET _soabi 0 _values)
+ if (NOT _values)
+ # try to compute SOABI from EXT_SUFFIX
+ list (GET _soabi 1 _values)
+ if (_values)
+ # clean-up: remove prefix character and suffix
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\.(so|pyd))$" "\\1" _values "${_values}")
+ endif()
+ endif()
+ endif()
else()
set (config_flag "${NAME}")
if (NAME STREQUAL "CONFIGDIR")
@@ -745,6 +771,7 @@ else()
_python_get_abiflags (_${_PYTHON_PREFIX}_ABIFLAGS)
endif()
endif()
+unset (${_PYTHON_PREFIX}_SOABI)
# Define lookup strategy
if (_${_PYTHON_PREFIX}_LOOKUP_POLICY STREQUAL "NEW")
@@ -1267,7 +1294,6 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# retrieve various package installation directories
execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
-
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
ERROR_QUIET)
@@ -1282,6 +1308,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
unset (${_PYTHON_PREFIX}_SITELIB)
unset (${_PYTHON_PREFIX}_SITEARCH)
endif()
+
+ if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL 3)
+ _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
+ endif()
else()
unset (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE CACHE)
unset (${_PYTHON_PREFIX}_INTERPRETER_ID)
@@ -1522,9 +1552,13 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
unset (_${_PYTHON_PREFIX}_LIBRARY_RELEASE CACHE)
unset (_${_PYTHON_PREFIX}_LIBRARY_DEBUG CACHE)
unset (_${_PYTHON_PREFIX}_INCLUDE_DIR CACHE)
- unset (_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE CACHE)
endif()
endif()
+ if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE OR NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)
+ unset (_${_PYTHON_PREFIX}_CONFIG CACHE)
+ unset (_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE CACHE)
+ endif()
+
if (DEFINED ${_PYTHON_PREFIX}_LIBRARY
AND IS_ABSOLUTE "${${_PYTHON_PREFIX}_LIBRARY}")
set (_${_PYTHON_PREFIX}_LIBRARY_RELEASE "${${_PYTHON_PREFIX}_LIBRARY}" CACHE INTERNAL "")
@@ -2148,6 +2182,11 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
endif()
+ if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL 3
+ AND NOT DEFINED ${_PYTHON_PREFIX}_SOABI)
+ _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
+ endif()
+
if (${_PYTHON_PREFIX}_Development_FOUND)
# compute and save development signature
string (MD5 __${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}:${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
@@ -2166,6 +2205,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
_${_PYTHON_PREFIX}_INCLUDE_DIR
+ _${_PYTHON_PREFIX}_CONFIG
_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE)
endif()
@@ -2425,5 +2465,3 @@ if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK)
else()
unset (CMAKE_FIND_FRAMEWORK)
endif()
-
-unset (_${_PYTHON_PREFIX}_CONFIG CACHE)
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 0a96fad..00c354e 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -94,6 +94,13 @@ This module will set the following variables in your project
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``.
+``Python3_SOABI``
+ Extension suffix for modules.
+
+ Information returned by
+ ``distutils.sysconfig.get_config_flag('SOABI')`` or computed from
+ ``distutils.sysconfig.get_config_flag('EXT_SUFFIX')`` or
+ ``python3-config --extension-suffix``.
``Python3_Compiler_FOUND``
System has the Python 3 compiler.
``Python3_COMPILER``
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e5f526a..0b2979b 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 16)
-set(CMake_VERSION_PATCH 20200108)
+set(CMake_VERSION_PATCH 20200110)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9eb256b..297c72b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -161,6 +161,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
this->DebugMode = ComputeIfDebugModeWanted();
+ this->DebugBuffer.clear();
// Lookup target architecture, if any.
if (const char* arch =
@@ -575,6 +576,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
this->AppendSuccessInformation();
+
return loadedPackage;
}
@@ -708,7 +710,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
debugBuffer =
cmStrCat(debugBuffer, "The file was found at\n ", mfile, "\n");
}
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
if (!mfile.empty()) {
@@ -841,6 +843,11 @@ bool cmFindPackageCommand::HandlePackageMode(
result = false;
}
+ if (this->DebugMode) {
+ this->DebugMessage(this->DebugBuffer);
+ this->DebugBuffer.clear();
+ }
+
// package not found
if (result && !found) {
// warn if package required or neither quiet nor in config mode
@@ -1001,6 +1008,11 @@ bool cmFindPackageCommand::FindConfig()
// Look for the project's configuration file.
bool found = false;
+ if (this->DebugMode) {
+ this->DebugBuffer = cmStrCat(this->DebugBuffer,
+ "find_package considered the following "
+ "locations for the Config module:\n");
+ }
// Search for frameworks.
if (!found && (this->SearchFrameworkFirst || this->SearchFrameworkOnly)) {
@@ -1027,6 +1039,16 @@ bool cmFindPackageCommand::FindConfig()
found = this->FindAppBundleConfig();
}
+ if (this->DebugMode) {
+ if (found) {
+ this->DebugBuffer = cmStrCat(
+ this->DebugBuffer, "The file was found at\n ", this->FileFound, "\n");
+ } else {
+ this->DebugBuffer =
+ cmStrCat(this->DebugBuffer, "The file was not found.\n");
+ }
+ }
+
// Store the entry in the cache so it can be set by the user.
std::string init;
if (found) {
@@ -1040,6 +1062,7 @@ bool cmFindPackageCommand::FindConfig()
// We force the value since we do not get here if it was already set.
this->Makefile->AddCacheDefinition(this->Variable, init.c_str(),
help.c_str(), cmStateEnums::PATH, true);
+
return found;
}
@@ -1244,7 +1267,7 @@ void cmFindPackageCommand::FillPrefixesPackageRoot()
std::string debugBuffer = "<PackageName>_ROOT CMake variable "
"[CMAKE_FIND_USE_PACKAGE_ROOT_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1280,7 +1303,7 @@ void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
"\nCMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env "
"variables [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].\n");
collectPathsForDebug(debugBuffer, paths, debugOffset);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1304,7 +1327,7 @@ void cmFindPackageCommand::FillPrefixesCMakeVariable()
"\nCMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables "
"[CMAKE_FIND_USE_CMAKE_PATH].\n");
collectPathsForDebug(debugBuffer, paths, debugOffset);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1329,7 +1352,7 @@ void cmFindPackageCommand::FillPrefixesSystemEnvironment()
std::string debugBuffer = "Standard system environment variables "
"[CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1359,7 +1382,7 @@ void cmFindPackageCommand::FillPrefixesUserRegistry()
"CMake User Package Registry [CMAKE_FIND_USE_PACKAGE_REGISTRY].\n";
collectPathsForDebug(debugBuffer,
this->LabeledPaths[PathLabel::UserRegistry]);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1379,7 +1402,7 @@ void cmFindPackageCommand::FillPrefixesSystemRegistry()
"[CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY].\n";
collectPathsForDebug(debugBuffer,
this->LabeledPaths[PathLabel::SystemRegistry]);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1558,7 +1581,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable()
std::string debugBuffer = "CMake variables defined in the Platform file "
"[CMAKE_FIND_USE_CMAKE_SYSTEM_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1573,7 +1596,7 @@ void cmFindPackageCommand::FillPrefixesUserGuess()
std::string debugBuffer =
"Paths specified by the find_package PATHS option.\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1588,7 +1611,7 @@ void cmFindPackageCommand::FillPrefixesUserHints()
std::string debugBuffer =
"Paths specified by the find_package HINTS option.\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1634,8 +1657,7 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
for (std::string const& c : this->Configs) {
file = cmStrCat(dir, '/', c);
if (this->DebugMode) {
- std::string msg = "Checking file [" + file + "]\n";
- this->DebugMessage(msg);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, " ", file, "\n");
}
if (cmSystemTools::FileExists(file, true) && this->CheckVersion(file)) {
// Allow resolving symlinks when the config file is found through a link
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index a65a292..ae9ade7 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -183,6 +183,7 @@ private:
std::vector<std::string> Names;
std::vector<std::string> Configs;
std::set<std::string> IgnoredPaths;
+ std::string DebugBuffer;
/*! the selected sortOrder (None by default)*/
SortOrderType SortOrder;
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index 5e20dd3..bfec986 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -148,6 +148,34 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+ add_test(NAME FindPython.Interpreter.SOABI COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/SOABI"
+ "${CMake_BINARY_DIR}/Tests/FindPython/SOABI.Interpreter"
+ ${build_generator_args}
+ --build-project TestSOABI
+ --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}"
+ "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}"
+ "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}"
+ "-DCMake_TEST_FindPython_COMPONENT=Interpreter"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Development.SOABI COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/SOABI"
+ "${CMake_BINARY_DIR}/Tests/FindPython/SOABI.Development"
+ ${build_generator_args}
+ --build-project TestSOABI
+ --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}"
+ "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}"
+ "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}"
+ "-DCMake_TEST_FindPython_COMPONENT=Development"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ endif()
endif()
if(CMake_TEST_FindPython_NumPy)
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
new file mode 100644
index 0000000..aea2baf
--- /dev/null
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestSOABI C)
+
+find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
+if (NOT Python3_FOUND)
+ message (FATAL_ERROR "Fail to found Python 3")
+endif()
+
+if(NOT DEFINED Python3_SOABI)
+ message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
+endif()
diff --git a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
index 5856d56..b35f05e 100644
--- a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
+++ b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
@@ -1,6 +1,7 @@
CMake Debug Log at FromPATHEnv.cmake:5 \(find_package\):
- find_package considered the following paths for Resolved.cmake
-.*
+ find_package considered the following paths for Resolved.cmake.*
+.*/Modules/FindResolved.cmake.*
+ The file was not found.*
<PackageName>_ROOT CMake variable.*
CMAKE_PREFIX_PATH variable.*
CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
@@ -13,4 +14,7 @@ CMake Debug Log at FromPATHEnv.cmake:5 \(find_package\):
CMake variables defined in the Platform file.*
CMake System Package Registry.*
Paths specified by the find_package PATHS option.*
- Checking file.*\[.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake\]
+ find_package considered the following locations for the Config module:.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake.*
+ The file was found at.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake
diff --git a/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
index 8ff04a9..379bf7a 100644
--- a/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
+++ b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
@@ -9,8 +9,9 @@
CMake System Package Registry.*
Paths specified by the find_package PATHS option.*
.*
- Checking file \[.*NotHereConfig.cmake\].*
- Checking file \[.*nothere-config.cmake\].*
+ .*NotHereConfig.cmake
+ .*nothere-config.cmake
+.*
CMake Warning at MissingConfigDebug.cmake:3 \(message\):
This warning must be reachable.
Call Stack \(most recent call first\):