summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:15 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:15 +0900
commitef5fd1a2282098bbb9224cc8ca30f0cc5d712545 (patch)
treef0a14aff99171c74a8ca200e25864af6675973ec
parente8d6bf7da6f7f166bcb566ecfd646d20e83f10d2 (diff)
downloadcmake-ef5fd1a2282098bbb9224cc8ca30f0cc5d712545.tar.gz
cmake-ef5fd1a2282098bbb9224cc8ca30f0cc5d712545.tar.bz2
cmake-ef5fd1a2282098bbb9224cc8ca30f0cc5d712545.zip
Imported Upstream version 3.18.2upstream/3.18.2
-rw-r--r--Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst5
-rw-r--r--Help/release/3.18.rst15
-rw-r--r--Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst2
-rw-r--r--Modules/CMakeFindBinUtils.cmake13
-rw-r--r--Modules/CMakeGenericSystem.cmake4
-rw-r--r--Modules/Compiler/MSVC-C-FeatureTests.cmake3
-rw-r--r--Modules/Compiler/MSVC-C.cmake42
-rw-r--r--Modules/ExternalProject.cmake32
-rw-r--r--Modules/FindHDF5.cmake1
-rw-r--r--Modules/FindMPI.cmake2
-rw-r--r--Modules/FindOpenGL.cmake7
-rw-r--r--Modules/FindPerl.cmake7
-rw-r--r--Modules/FindPython/Support.cmake36
-rw-r--r--Modules/FindQt3.cmake7
-rw-r--r--Modules/FindQt4.cmake8
-rw-r--r--Modules/FindRuby.cmake20
-rw-r--r--Modules/FindTCL.cmake6
-rw-r--r--Modules/FindTclsh.cmake9
-rw-r--r--Modules/FindX11.cmake8
-rw-r--r--Modules/GoogleTestAddTests.cmake4
-rw-r--r--Modules/Platform/Windows-Clang.cmake2
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/cmGeneratorTarget.cxx3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx6
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx12
-rw-r--r--Source/cmQtAutoGenInitializer.cxx47
-rw-r--r--Source/cmQtAutoMocUic.cxx4
-rw-r--r--Tests/FindPython/FindPythonScript.cmake2
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt16
-rw-r--r--Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMakeLists.txt12
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake9
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/Ninja/app.cpp6
-rw-r--r--Tests/RunCMake/Ninja/app_qt.cpp11
-rw-r--r--Tests/RunCMake/Ninja/simple_lib.cpp6
38 files changed, 306 insertions, 94 deletions
diff --git a/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
index 3e3059d7a..5ed504ff3 100644
--- a/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
+++ b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
@@ -13,7 +13,7 @@ the ``-p`` path prefix option. ``moc`` usually generates a
relative include path in that case.
:prop_tgt:`AUTOMOC_PATH_PREFIX` is initialized from the variable
-:variable:`CMAKE_AUTOMOC_PATH_PREFIX`, which is ``ON`` by default.
+:variable:`CMAKE_AUTOMOC_PATH_PREFIX`, which is ``OFF`` by default.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
@@ -24,8 +24,7 @@ Reproducible builds
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:
+:prop_tgt:`AUTOMOC_PATH_PREFIX` to ``ON``. This ensures 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/release/3.18.rst b/Help/release/3.18.rst
index ba80d2b35..f199244c0 100644
--- a/Help/release/3.18.rst
+++ b/Help/release/3.18.rst
@@ -264,6 +264,10 @@ Other
* :manual:`ccmake(1)` learned to read a :envvar:`CCMAKE_COLORS`
environment variable to customize colors.
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ is now aware of the availability of C11 features in MSVC 19.27 and above,
+ including support for the ``c_restrict`` feature and the ``-std:c11`` flag.
+
Deprecated and Removed Features
===============================
@@ -339,3 +343,14 @@ Changes made since CMake 3.18.0 include the following.
that were using manual quoting or escaping to work around the prior
limitation. This fix has been reverted in 3.18.1, but may be
re-introduced in future versions of CMake with a policy for compatibility.
+
+3.18.2
+------
+
+* The default value of :variable:`CMAKE_AUTOMOC_PATH_PREFIX` was changed to
+ ``OFF`` because this feature can break existing projects that have
+ identically named header files in different include directories.
+ This restores compatibility with behavior of CMake 3.15 and below.
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ was updated for MSVC 19.27 as mentioned above.
diff --git a/Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst b/Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst
index dca0b0657..1e9790fde 100644
--- a/Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst
+++ b/Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst
@@ -8,4 +8,4 @@ This variable is used to initialize the :prop_tgt:`AUTOMOC_PATH_PREFIX`
property on all the targets. See that target property for additional
information.
-The default value is ``ON``.
+The default value is ``OFF``.
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index de9ef9a23..b2004f109 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -102,6 +102,19 @@ else()
set(_CMAKE_ADDITIONAL_ADDR2LINE_NAMES "llvm-addr2line")
endif()
+ if(NOT CMAKE_CROSSCOMPILING AND NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "")
+ list(APPEND _CMAKE_ADDITIONAL_AR_NAMES "ar")
+ list(APPEND _CMAKE_ADDITIONAL_RANLIB_NAMES "ranlib")
+ list(APPEND _CMAKE_ADDITIONAL_STRIP_NAMES "strip")
+ list(APPEND _CMAKE_ADDITIONAL_LINKER_NAMES "ld")
+ list(APPEND _CMAKE_ADDITIONAL_NM_NAMES "nm")
+ list(APPEND _CMAKE_ADDITIONAL_OBJDUMP_NAMES "objdump")
+ list(APPEND _CMAKE_ADDITIONAL_OBJCOPY_NAMES "objcopy")
+ list(APPEND _CMAKE_ADDITIONAL_READELF_NAMES "readelf")
+ list(APPEND _CMAKE_ADDITIONAL_DLLTOOL_NAMES "dlltool")
+ list(APPEND _CMAKE_ADDITIONAL_ADDR2LINE_NAMES "addr2line")
+ endif()
+
find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} ${_CMAKE_ADDITIONAL_AR_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib ${_CMAKE_ADDITIONAL_RANLIB_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 000fba199..6f665a626 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -26,7 +26,9 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON)
set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON)
-set(CMAKE_AUTOMOC_PATH_PREFIX ON)
+if(NOT DEFINED CMAKE_AUTOMOC_PATH_PREFIX)
+ set(CMAKE_AUTOMOC_PATH_PREFIX OFF)
+endif()
set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")
# basically all general purpose OSs support shared libs
diff --git a/Modules/Compiler/MSVC-C-FeatureTests.cmake b/Modules/Compiler/MSVC-C-FeatureTests.cmake
index 3f09be201..862bff3b7 100644
--- a/Modules/Compiler/MSVC-C-FeatureTests.cmake
+++ b/Modules/Compiler/MSVC-C-FeatureTests.cmake
@@ -2,7 +2,8 @@ set(_cmake_oldestSupported "_MSC_VER >= 1600")
# Not yet supported:
#set(_cmake_feature_test_c_static_assert "")
-#set(_cmake_feature_test_c_restrict "")
+
+set(_cmake_feature_test_c_restrict "_MSC_VER >= 1927")
set(_cmake_feature_test_c_variadic_macros "${_cmake_oldestSupported}")
set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}")
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake
index bca9764a2..a05e6a0bd 100644
--- a/Modules/Compiler/MSVC-C.cmake
+++ b/Modules/Compiler/MSVC-C.cmake
@@ -1,15 +1,31 @@
-# MSVC has no specific options to set C language standards, but set them as
-# empty strings anyways so the feature test infrastructure can at least check
-# to see if they are defined.
-set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
-set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
-set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
-set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
-set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
-set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
-# There is no meaningful default for this
-set(CMAKE_C_STANDARD_DEFAULT "")
+include(Compiler/CMakeCommonCompilerMacros)
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std:c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std:c11")
+
+ __compiler_check_default_language_standard(C 19.27 99)
+else()
+ # MSVC has no specific options to set C language standards, but set them as
+ # empty strings anyways so the feature test infrastructure can at least check
+ # to see if they are defined.
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
+
+ # There is no meaningful default for this
+ set(CMAKE_C_STANDARD_DEFAULT "")
+endif()
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
@@ -31,6 +47,10 @@ macro(cmake_record_c_compile_features)
list(APPEND CMAKE_C_COMPILE_FEATURES c_variadic_macros)
list(APPEND CMAKE_C99_COMPILE_FEATURES c_variadic_macros)
endif()
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27)
+ list(APPEND CMAKE_C_COMPILE_FEATURES c_restrict)
+ list(APPEND CMAKE_C99_COMPILE_FEATURES c_restrict)
+ endif()
set(_result 0) # expected by cmake_determine_compile_features
endmacro()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index aecc00b3b..fcff5ddf8 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -747,7 +747,7 @@ control needed to implement such step-level capabilities.
``<name>`` is the same as the name passed to the original call to
:command:`ExternalProject_Add`. The specified ``<step>`` must not be one of
- the pre-defined steps (``mkdir``, ``download``, ``update``, ``skip-update``,
+ the pre-defined steps (``mkdir``, ``download``, ``update``,
``patch``, ``configure``, ``build``, ``install`` or ``test``). The supported
options are:
@@ -2762,21 +2762,6 @@ Update to Mercurial >= 2.1.1.
)"
)
- if(update_disconnected)
- _ep_get_step_stampfile(${name} skip-update skip-update_stamp_file)
- string(REPLACE "Performing" "Skipping" comment "${comment}")
- ExternalProject_Add_Step(${name} skip-update
- COMMENT ${comment}
- ALWAYS ${always}
- EXCLUDE_FROM_MAIN 1
- WORKING_DIRECTORY ${work_dir}
- DEPENDEES download
- ${log}
- ${uses_terminal}
- )
- set_property(SOURCE ${skip-update_stamp_file} PROPERTY SYMBOLIC 1)
- endif()
-
endfunction()
@@ -2801,9 +2786,9 @@ function(_ep_add_patch_command name)
_ep_get_update_disconnected(update_disconnected ${name})
if(update_disconnected)
- set(update_dep skip-update)
+ set(patch_dep download)
else()
- set(update_dep update)
+ set(patch_dep update)
endif()
set(__cmdQuoted)
@@ -2814,7 +2799,7 @@ function(_ep_add_patch_command name)
ExternalProject_Add_Step(${name} patch
COMMAND ${__cmdQuoted}
WORKING_DIRECTORY \${work_dir}
- DEPENDEES download \${update_dep}
+ DEPENDEES \${patch_dep}
${log}
)"
)
@@ -2970,13 +2955,6 @@ function(_ep_add_configure_command name)
set(uses_terminal "")
endif()
- _ep_get_update_disconnected(update_disconnected ${name})
- if(update_disconnected)
- set(update_dep skip-update)
- else()
- set(update_dep update)
- endif()
-
set(__cmdQuoted)
foreach(__item IN LISTS cmd)
string(APPEND __cmdQuoted " [==[${__item}]==]")
@@ -2985,7 +2963,7 @@ function(_ep_add_configure_command name)
ExternalProject_Add_Step(${name} configure
COMMAND ${__cmdQuoted}
WORKING_DIRECTORY \${binary_dir}
- DEPENDEES \${update_dep} patch
+ DEPENDEES patch
DEPENDS \${file_deps}
${log}
${uses_terminal}
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 60a313d73..c9d15984d 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -208,7 +208,6 @@ function(_HDF5_test_regular_compiler_C success version is_parallel)
set(test_file ${scratch_directory}/cmake_hdf5_test.c)
file(WRITE ${test_file}
"#include <hdf5.h>\n"
- "#include <hdf5_hl.h>\n"
"const char* info_ver = \"INFO\" \":\" H5_VERSION;\n"
"#ifdef H5_HAVE_PARALLEL\n"
"const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n"
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 25de562e2..bbd40a4b0 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1157,7 +1157,7 @@ macro(_MPI_create_imported_target LANG)
string(REPLACE "-pthread" "$<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:SHELL:-Xcompiler >-pthread"
_MPI_${LANG}_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}")
string(REPLACE "-fexceptions" "$<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:SHELL:-Xcompiler >-fexceptions"
- _MPI_${LANG}_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}")
+ _MPI_${LANG}_COMPILE_OPTIONS "${_MPI_${LANG}_COMPILE_OPTIONS}")
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${_MPI_${LANG}_COMPILE_OPTIONS}")
unset(_MPI_${LANG}_COMPILE_OPTIONS)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 74392dac3..17ffe85b3 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -424,8 +424,15 @@ if(OPENGL_EGL_INCLUDE_DIR)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if (CMAKE_FIND_PACKAGE_NAME STREQUAL "GLU")
+ # FindGLU include()'s this module. It's an old pattern, but rather than
+ # trying to suppress this from outside the module (which is then sensitive to
+ # the contents, detect the case in this module and suppress it explicitly.
+ set(FPHSA_NAME_MISMATCHED 1)
+endif ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}
HANDLE_COMPONENTS)
+unset(FPHSA_NAME_MISMATCHED)
unset(_OpenGL_REQUIRED_VARS)
# OpenGL:: targets
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index fd120bf8e..c14e059e9 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -73,8 +73,15 @@ endif()
set(PERL ${PERL_EXECUTABLE})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if (CMAKE_FIND_PACKAGE_NAME STREQUAL "PerlLibs")
+ # FindPerlLibs include()'s this module. It's an old pattern, but rather than
+ # trying to suppress this from outside the module (which is then sensitive to
+ # the contents, detect the case in this module and suppress it explicitly.
+ set(FPHSA_NAME_MISMATCHED 1)
+endif ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl
REQUIRED_VARS PERL_EXECUTABLE
VERSION_VAR PERL_VERSION_STRING)
+unset(FPHSA_NAME_MISMATCHED)
mark_as_advanced(PERL_EXECUTABLE)
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 1be06250f..1d68c4415 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -5,17 +5,13 @@
# This file is a "template" file used by various FindPython modules.
#
-cmake_policy (GET CMP0094 _${_PYTHON_PREFIX}_LOOKUP_POLICY)
-
-cmake_policy (VERSION 3.7)
-
-if (_${_PYTHON_PREFIX}_LOOKUP_POLICY)
- cmake_policy (SET CMP0094 ${_${_PYTHON_PREFIX}_LOOKUP_POLICY})
-endif()
-
#
# Initial configuration
#
+
+# IN_LIST operator
+cmake_policy (SET CMP0057 NEW)
+
if (NOT DEFINED _PYTHON_PREFIX)
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
endif()
@@ -490,7 +486,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endif()
elseif (NAME STREQUAL "SOABI")
execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))\nexcept Exception:\n import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))"
+ "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '',sysconfig.get_config_var('SO') or '']))\nexcept Exception:\n import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '',sysconfig.get_config_var('SO') or '']))"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _soabi
ERROR_QUIET
@@ -526,7 +522,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endif()
endif()
- if (config_flag STREQUAL "ABIFLAGS")
+ if (NAME STREQUAL "ABIFLAGS" OR NAME STREQUAL "SOABI")
set (${_PYTHON_PGCV_VALUE} "${_values}" PARENT_SCOPE)
return()
endif()
@@ -562,18 +558,19 @@ function (_PYTHON_GET_VERSION)
if (_PGV_LIBRARY)
# retrieve version and abi from library name
if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
+ get_filename_component (library_name "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" NAME)
# extract version from library name
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "python([23])([0-9]+)")
+ if (library_name MATCHES "python([23])([0-9]+)")
set (${_PGV_PREFIX}VERSION_MAJOR "${CMAKE_MATCH_1}" PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}ABI "" PARENT_SCOPE)
- elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "python([23])\\.([0-9]+)([dmu]*)")
+ elseif (library_name MATCHES "python([23])\\.([0-9]+)([dmu]*)")
set (${_PGV_PREFIX}VERSION_MAJOR "${CMAKE_MATCH_1}" PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}ABI "${CMAKE_MATCH_3}" PARENT_SCOPE)
- elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "pypy(3)?")
+ elseif (library_name MATCHES "pypy(3)?-c")
set (version "${CMAKE_MATCH_1}")
if (version EQUAL "3")
set (${_PGV_PREFIX}VERSION_MAJOR "3" PARENT_SCOPE)
@@ -1097,6 +1094,7 @@ endif()
unset (${_PYTHON_PREFIX}_SOABI)
# Define lookup strategy
+cmake_policy (GET CMP0094 _${_PYTHON_PREFIX}_LOOKUP_POLICY)
if (_${_PYTHON_PREFIX}_LOOKUP_POLICY STREQUAL "NEW")
set (_${_PYTHON_PREFIX}_FIND_STRATEGY "LOCATION")
else()
@@ -1771,9 +1769,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
unset (${_PYTHON_PREFIX}_SITEARCH)
endif()
- if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL "3")
- _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
- endif()
+ _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
# store properties in the cache to speed-up future searches
set (_${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES
@@ -2844,8 +2840,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
${_PYTHON_PREFIX}_PyPy_VERSION "${${_PYTHON_PREFIX}_PyPy_VERSION}")
endif()
- if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL "3"
- AND NOT DEFINED ${_PYTHON_PREFIX}_SOABI)
+ if (NOT DEFINED ${_PYTHON_PREFIX}_SOABI)
_python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
endif()
@@ -3095,11 +3090,6 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name)
cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY "STATIC;SHARED;MODULE;WITH_SOABI" "" "")
- if (prefix STREQUAL "Python2" AND PYTHON_ADD_LIBRARY_WITH_SOABI)
- message (AUTHOR_WARNING "FindPython2: Option `WITH_SOABI` is not supported for Python2 and will be ignored.")
- unset (PYTHON_ADD_LIBRARY_WITH_SOABI)
- endif()
-
if (PYTHON_ADD_LIBRARY_STATIC)
set (type STATIC)
elseif (PYTHON_ADD_LIBRARY_SHARED)
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 563ed46ec..b5bc8b1cf 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -201,9 +201,16 @@ endif()
# if the include a library are found then we have it
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if (CMAKE_FIND_PACKAGE_NAME STREQUAL "Qt")
+ # FindQt include()'s this module. It's an old pattern, but rather than trying
+ # to suppress this from outside the module (which is then sensitive to the
+ # contents, detect the case in this module and suppress it explicitly.
+ set(FPHSA_NAME_MISMATCHED 1)
+endif ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3
REQUIRED_VARS QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE
VERSION_VAR QT_VERSION_STRING)
+unset(FPHSA_NAME_MISMATCHED)
set(QT_FOUND ${QT3_FOUND} )
if(QT_FOUND)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 399396802..2e3da746b 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1318,10 +1318,18 @@ if (NOT QT_VERSION_MAJOR EQUAL 4)
endif()
endif()
else()
+ if (CMAKE_FIND_PACKAGE_NAME STREQUAL "Qt")
+ # FindQt include()'s this module. It's an old pattern, but rather than
+ # trying to suppress this from outside the module (which is then sensitive
+ # to the contents, detect the case in this module and suppress it
+ # explicitly.
+ set(FPHSA_NAME_MISMATCHED 1)
+ endif ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 FOUND_VAR Qt4_FOUND
REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
VERSION_VAR QTVERSION
)
+ unset(FPHSA_NAME_MISMATCHED)
endif()
#######################################
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 1bdee6033..0559a69b6 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -48,10 +48,21 @@ This module will set the following variables in your project:
Ruby patch version.
-Also:
-
-``Ruby_INCLUDE_PATH``
- same as Ruby_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
+The following variables are also provided for compatibility reasons,
+don't use them in new code:
+
+``RUBY_EXECUTABLE``
+ same as Ruby_EXECUTABLE.
+``RUBY_INCLUDE_DIRS``
+ same as Ruby_INCLUDE_DIRS.
+``RUBY_INCLUDE_PATH``
+ same as Ruby_INCLUDE_DIRS.
+``RUBY_LIBRARY``
+ same as Ruby_LIBRARY.
+``RUBY_VERSION``
+ same as Ruby_VERSION.
+``RUBY_FOUND``
+ same as Ruby_FOUND.
Hints
^^^^^
@@ -493,7 +504,6 @@ foreach(Camel
Ruby_VERSION_MAJOR
Ruby_VERSION_MINOR
Ruby_VERSION_PATCH
- Ruby_INCLUDE_PATH
Ruby_ARCH_DIR
Ruby_ARCH
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 960265f9f..9b771dcd7 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -223,6 +223,12 @@ find_path(TK_INCLUDE_PATH
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if (CMAKE_FIND_PACKAGE_NAME STREQUAL "TclStub")
+ # FindTclStub include()'s this module. It's an old pattern, but rather than
+ # trying to suppress this from outside the module (which is then sensitive to
+ # the contents, detect the case in this module and suppress it explicitly.
+ set(FPHSA_NAME_MISMATCHED 1)
+endif ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
set(FPHSA_NAME_MISMATCHED 1)
set(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index 82be473b1..5555d5960 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -92,8 +92,17 @@ if(TCL_TCLSH)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if (CMAKE_FIND_PACKAGE_NAME STREQUAL "TCL" OR
+ CMAKE_FIND_PACKAGE_NAME STREQUAL "TclStub")
+ # FindTCL include()'s this module. It's an old pattern, but rather than
+ # trying to suppress this from outside the module (which is then sensitive to
+ # the contents, detect the case in this module and suppress it explicitly.
+ # Transitively, FindTclStub includes FindTCL.
+ set(FPHSA_NAME_MISMATCHED 1)
+endif ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh
REQUIRED_VARS TCL_TCLSH
VERSION_VAR TCLSH_VERSION_STRING)
+unset(FPHSA_NAME_MISMATCHED)
mark_as_advanced(TCL_TCLSH)
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index aa83575eb..ccd025266 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -404,9 +404,17 @@ if (UNIX)
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ if (CMAKE_FIND_PACKAGE_NAME STREQUAL "FLTK")
+ # FindFLTK include()'s this module. It's an old pattern, but rather than
+ # trying to suppress this from outside the module (which is then sensitive
+ # to the contents, detect the case in this module and suppress it
+ # explicitly.
+ set(FPHSA_NAME_MISMATCHED 1)
+ endif ()
find_package_handle_standard_args(X11
REQUIRED_VARS X11_X11_INCLUDE_PATH X11_X11_LIB
HANDLE_COMPONENTS)
+ unset(FPHSA_NAME_MISMATCHED)
if(X11_FOUND)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index 5d098d96a..883e1f48d 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -44,8 +44,8 @@ function(gtest_discover_tests_impl)
cmake_parse_arguments(
""
""
- "NO_PRETTY_TYPES;NO_PRETTY_VALUES;TEST_EXECUTABLE;TEST_EXECUTOR;TEST_WORKING_DIR;TEST_PREFIX;TEST_SUFFIX;TEST_LIST;CTEST_FILE;TEST_DISCOVERY_TIMEOUT;TEST_XML_OUTPUT_DIR"
- "TEST_EXTRA_ARGS;TEST_PROPERTIES"
+ "NO_PRETTY_TYPES;NO_PRETTY_VALUES;TEST_EXECUTABLE;TEST_WORKING_DIR;TEST_PREFIX;TEST_SUFFIX;TEST_LIST;CTEST_FILE;TEST_DISCOVERY_TIMEOUT;TEST_XML_OUTPUT_DIR"
+ "TEST_EXTRA_ARGS;TEST_PROPERTIES;TEST_EXECUTOR"
${ARGN}
)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index dff81663f..995c63572 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -142,7 +142,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
endif()
if(DEFINED CMAKE_RC_PREPROCESSOR)
set(CMAKE_DEPFILE_FLAGS_RC "-clang:-MD -clang:-MF -clang:<DEPFILE>")
- set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_COMMAND} -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -E <SOURCE> -- <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> /fo <OBJECT> <OBJECT>.pp")
+ set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -E <SOURCE> -- <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> /fo <OBJECT> <OBJECT>.pp")
if(CMAKE_GENERATOR STREQUAL "Ninja")
set(CMAKE_NINJA_CMCLDEPS_RC 0)
set(CMAKE_NINJA_DEP_TYPE_RC gcc)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 17b38cf0e..3fe6f3a97 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 1)
+set(CMake_VERSION_PATCH 2)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
@@ -21,7 +21,7 @@ endif()
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
- set(git_info [==[63a65baf4c CMake 3.18.1]==])
+ set(git_info [==[aaa5eab410 CMake 3.18.2]==])
# Otherwise, try to identify the current development source version.
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index c7baf2b71..ab6a26c97 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3032,6 +3032,9 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory(
void cmGeneratorTarget::GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const
{
+ if (!this->Makefile->IsOn("APPLE")) {
+ return;
+ }
cmProp archs = nullptr;
if (!config.empty()) {
std::string defVarName =
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index f0737e80f..b28395a56 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3158,6 +3158,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
std::string symroot = cmStrCat(root->GetCurrentBinaryDirectory(), "/build");
buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot));
+ // Inside a try_compile project, do not require signing on any platform.
+ if (this->CMakeInstance->GetIsInTryCompile()) {
+ buildSettings->AddAttribute("CODE_SIGNING_ALLOWED",
+ this->CreateString("NO"));
+ }
+
for (auto& config : configs) {
cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index e26dc94e6..c15ca7c0e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2789,7 +2789,7 @@ void cmLocalGenerator::CopyPchCompilePdb(
}
file << " break()\n"
<< " endif()\n";
- file << " else()\n"
+ file << " elseif(NOT EXISTS \"" << from_file << "\")\n"
<< " execute_process(COMMAND ${CMAKE_COMMAND}"
<< " -E sleep 1)\n"
<< " endif()\n";
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 0f01f85c7..32ab9f80e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -733,12 +733,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
static_cast<int>(cmSystemTools::CalculateCommandLineLengthLimit()) -
globalGen->GetRuleCmdLength(this->LanguageLinkerDeviceRule(config));
- std::string path = localGen.GetHomeRelativeOutputPath();
- if (!path.empty()) {
- path += '/';
- }
build.RspFile = this->ConvertToNinjaPath(
- cmStrCat(path, "CMakeFiles/", genTarget->GetName(),
+ cmStrCat("CMakeFiles/", genTarget->GetName(),
globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp"));
// Gather order-only dependencies.
@@ -1159,12 +1155,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
globalGen->GetRuleCmdLength(linkBuild.Rule);
}
- std::string path = localGen.GetHomeRelativeOutputPath();
- if (!path.empty()) {
- path += '/';
- }
linkBuild.RspFile = this->ConvertToNinjaPath(
- cmStrCat(path, "CMakeFiles/", gt->GetName(),
+ cmStrCat("CMakeFiles/", gt->GetName(),
globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp"));
// Gather order-only dependencies.
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 511a018fb..1132852bc 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1182,11 +1182,54 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
if (useNinjaDepfile) {
// Create a custom command that generates a timestamp file and
// has a depfile assigned. The depfile is created by JobDepFilesMergeT.
-
- // Add additional autogen target dependencies
+ //
+ // Also create an additional '_autogen_timestamp_deps' that the custom
+ // command will depend on. It will have no sources or commands to
+ // execute, but it will have dependencies that would originally be
+ // assigned to the pre-Qt 5.15 'autogen' target. These dependencies will
+ // serve as a list of order-only dependencies for the custom command,
+ // without forcing the custom command to re-execute.
+ //
+ // The dependency tree would then look like
+ // '_autogen_timestamp_deps (order-only)' <- '/timestamp' file <-
+ // '_autogen' target.
+ const auto timestampTargetName =
+ cmStrCat(this->GenTarget->GetName(), "_autogen_timestamp_deps");
+ std::vector<std::string> timestampTargetProvides;
+ cmCustomCommandLines timestampTargetCommandLines;
+
+ // Add additional autogen target dependencies to
+ // '_autogen_timestamp_deps'.
for (const cmTarget* t : this->AutogenTarget.DependTargets) {
dependencies.push_back(t->GetName());
}
+
+ cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
+ timestampTargetName, true, this->Dir.Work.c_str(),
+ /*byproducts=*/timestampTargetProvides,
+ /*depends=*/dependencies, timestampTargetCommandLines, false, nullptr);
+ this->LocalGen->AddGeneratorTarget(
+ cm::make_unique<cmGeneratorTarget>(timestampTarget, this->LocalGen));
+
+ // Set FOLDER property on the timestamp target, so it appears in the
+ // appropriate folder in an IDE or in the file api.
+ if (!this->TargetsFolder.empty()) {
+ timestampTarget->SetProperty("FOLDER", this->TargetsFolder);
+ }
+
+ // Make '/timestamp' file depend on '_autogen_timestamp_deps' and on the
+ // moc and uic executables (whichever are enabled).
+ dependencies.clear();
+ dependencies.push_back(timestampTargetName);
+
+ if (this->Moc.ExecutableTarget != nullptr) {
+ dependencies.push_back(this->Moc.ExecutableTarget->Target->GetName());
+ }
+ if (this->Uic.ExecutableTarget != nullptr) {
+ dependencies.push_back(this->Uic.ExecutableTarget->Target->GetName());
+ }
+
+ // Create the custom command that outputs the timestamp file.
const char timestampFileName[] = "timestamp";
const std::string outputFile =
cmStrCat(this->Dir.Build, "/", timestampFileName);
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 9adcabb80..f6cccfbee 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -2163,7 +2163,9 @@ std::string escapeDependencyPath(cm::string_view path)
void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
{
if (Log().Verbose()) {
- Log().Info(GenT::MOC, "Merging MOC dependencies");
+ Log().Info(GenT::MOC,
+ cmStrCat("Merging MOC dependencies into ",
+ MessagePath(BaseConst().DepFile.c_str())));
}
auto processDepFile =
[](const std::string& mocOutputFile) -> std::vector<std::string> {
diff --git a/Tests/FindPython/FindPythonScript.cmake b/Tests/FindPython/FindPythonScript.cmake
index bc7e0d195..808496ea3 100644
--- a/Tests/FindPython/FindPythonScript.cmake
+++ b/Tests/FindPython/FindPythonScript.cmake
@@ -1,4 +1,4 @@
-
+cmake_minimum_required(VERSION 3.12)
if (PYTHON_MUST_NOT_BE_FOUND)
find_package(${PYTHON_PACKAGE_NAME} QUIET)
if (${PYTHON_PACKAGE_NAME}_FOUND)
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
index 4a6aea353..36daa9f81 100644
--- a/Tests/FindPython/SOABI/CMakeLists.txt
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -20,3 +20,19 @@ if (Python3_Development_FOUND AND Python3_SOABI)
message(FATAL_ERROR "Module suffix do not include Python3_SOABI")
endif()
endif()
+
+
+find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
+if(NOT DEFINED Python2_SOABI)
+ message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
+endif()
+
+if (Python2_Development_FOUND AND Python2_SOABI)
+ Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c)
+ target_compile_definitions (spam2 PRIVATE PYTHON2)
+
+ get_property (suffix TARGET spam2 PROPERTY SUFFIX)
+ if (NOT suffix MATCHES "^.${Python2_SOABI}")
+ message(FATAL_ERROR "Module suffix do not include Python2_SOABI")
+ endif()
+endif()
diff --git a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
index 1627b394f..8b11b465d 100644
--- a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
+++ b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
@@ -61,6 +61,7 @@ macro(buildMocInclude sourceDir binaryDir)
"${sourceDir}"
MocInclude
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOMOC_PATH_PREFIX=ON"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 10e66c31b..470f30291 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -142,6 +142,9 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
if(CMAKE_Fortran_COMPILER)
list(APPEND Ninja_ARGS -DTEST_Fortran=1)
endif()
+ if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
+ list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
+ endif()
add_RunCMake_test(Ninja)
set(NinjaMultiConfig_ARGS
-DCYGWIN=${CYGWIN}
@@ -360,6 +363,15 @@ function(add_RunCMake_test_try_compile)
unset(CMAKE_CXX_STANDARD_DEFAULT)
endif()
endif()
+ if(CMAKE_VERSION VERSION_LESS 3.18.20200813 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")
+ # Older CMake versions do not know about MSVC language standards.
+ # Approximate our logic from MSVC-C.cmake.
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.27)
+ set(CMAKE_C_STANDARD_DEFAULT 99)
+ else()
+ set(CMAKE_C_STANDARD_DEFAULT "")
+ endif()
+ endif()
foreach(var
CMAKE_SYSTEM_NAME
CMAKE_C_COMPILER_ID
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index dc7791513..4e6eef6f0 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -1,5 +1,10 @@
include(RunCMake)
+# Isolate test cases from caller's environment.
+set(ENV{CMAKE_PREFIX_PATH} "")
+set(ENV{CMAKE_APPBUNDLE_PATH} "")
+set(ENV{CMAKE_FRAMEWORK_PATH} "")
+
run_cmake(PkgConfigDoesNotExist)
run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH)
diff --git a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
new file mode 100644
index 000000000..d69a119ac
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
@@ -0,0 +1,9 @@
+enable_language(CXX)
+
+find_package(Qt5Core REQUIRED)
+
+set(CMAKE_AUTOMOC ON)
+
+add_library(simple_lib SHARED simple_lib.cpp)
+add_executable(app_with_qt app.cpp app_qt.cpp)
+target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 8f9c263a2..d43023b6e 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -138,6 +138,7 @@ ${ninja_stderr}
message(FATAL_ERROR
"top ninja build failed exited with status ${ninja_result}")
endif()
+ set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
endfunction(run_ninja)
function (run_LooseObjectDepends)
@@ -322,3 +323,23 @@ function (run_ChangeBuildType)
run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err)
endfunction()
run_ChangeBuildType()
+
+function(run_Qt5AutoMocDeps)
+ if(CMake_TEST_Qt5 AND CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5AutoMocDeps-build)
+ run_cmake(Qt5AutoMocDeps)
+ unset(RunCMake_TEST_OPTIONS)
+ # Build the project.
+ run_ninja("${RunCMake_TEST_BINARY_DIR}")
+ # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC
+ # for app_with_qt target.
+ touch("${RunCMake_SOURCE_DIR}/simple_lib.cpp")
+ # Build and assert that AUTOMOC was not run for app_with_qt.
+ run_ninja("${RunCMake_TEST_BINARY_DIR}")
+ if(ninja_stdout MATCHES "Automatic MOC for target app_with_qt")
+ message(FATAL_ERROR
+ "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}")
+ endif()
+ endif()
+endfunction()
+run_Qt5AutoMocDeps()
diff --git a/Tests/RunCMake/Ninja/app.cpp b/Tests/RunCMake/Ninja/app.cpp
new file mode 100644
index 000000000..57380e489
--- /dev/null
+++ b/Tests/RunCMake/Ninja/app.cpp
@@ -0,0 +1,6 @@
+int main(int argc, char* argv[])
+{
+ (void)argc;
+ (void)argv;
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/app_qt.cpp b/Tests/RunCMake/Ninja/app_qt.cpp
new file mode 100644
index 000000000..302c6723c
--- /dev/null
+++ b/Tests/RunCMake/Ninja/app_qt.cpp
@@ -0,0 +1,11 @@
+#include <QObject>
+
+class Mango : public QObject
+{
+ Q_OBJECT
+public:
+Q_SIGNALS:
+ void eatFruit();
+};
+
+#include "app_qt.moc"
diff --git a/Tests/RunCMake/Ninja/simple_lib.cpp b/Tests/RunCMake/Ninja/simple_lib.cpp
new file mode 100644
index 000000000..cf8d6893d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/simple_lib.cpp
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void dummy_symbol()
+{
+}