diff options
-rw-r--r-- | Help/release/3.16.rst | 26 | ||||
-rw-r--r-- | Help/release/3.17.rst | 4 | ||||
-rw-r--r-- | Modules/FindPython.cmake | 8 | ||||
-rw-r--r-- | Modules/FindPython/Support.cmake | 29 | ||||
-rw-r--r-- | Modules/FindPython2.cmake | 5 | ||||
-rw-r--r-- | Modules/FindPython3.cmake | 10 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang.cmake | 2 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 6 | ||||
-rw-r--r-- | Tests/FindPython/SOABI/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake | 14 |
14 files changed, 100 insertions, 24 deletions
diff --git a/Help/release/3.16.rst b/Help/release/3.16.rst index 0d1cc1e..e2d6788 100644 --- a/Help/release/3.16.rst +++ b/Help/release/3.16.rst @@ -277,3 +277,29 @@ Other Changes * When using :variable:`CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS` on Windows the auto-generated exports are now updated only when the object files providing the symbols are updated. + +Updates +======= + +Changes made since CMake 3.16.0 include the following. + +3.16.2 +------ + +* CMake 3.16.0 and 3.16.1 processed ``.hh`` files with :prop_tgt:`AUTOMOC`. + This was a behavior change from CMake 3.15 and below that can break + existing projects, so it has been reverted as of 3.16.2. + +3.16.5 +------ + +* The :module:`FindPython`, :module:`FindPython2`, and :module:`FindPython3` + modules no longer create cache entries for ``Python{,2,3}_LIBRARY_RELEASE`` + and ``Python{,2,3}_LIBRARY_DEBUG``. Those values are always computed from + other results and so should not be cached. The entries were created by + CMake 3.16.0 through 3.16.4 but were always ``FORCE``-set and could not + be meaningfully edited by users. + + Additionally, the modules no longer expose their internal ``_Python*`` + cache entries publicly. CMake 3.16.0 through 3.16.4 accidentally + made them visible as advanced cache entries. diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst index 30e6cc3..23dec84 100644 --- a/Help/release/3.17.rst +++ b/Help/release/3.17.rst @@ -179,7 +179,9 @@ Modules * The :module:`FindPython3` and :module:`FindPython` modules gained, respectively, variable ``Python3_SOABI`` and ``Python_SOABI`` giving - the standard extension suffix for modules. + the standard extension suffix for modules. Moreover, commands + ``Python3_add_library`` and ``Python_add_library`` gained the option + ``WITH_SOABI`` to prefix the library suffix with the value of ``SOABI``. * The :module:`FindLibXml2` module now provides an imported target for the ``xmllint`` executable diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index be272e1..9dfa222 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -297,9 +297,13 @@ This module defines the command ``Python_add_library`` (when when library type is ``MODULE``, to target ``Python::Module`` and takes care of Python module naming rules:: - Python_add_library (my_module MODULE src1.cpp) + Python_add_library (<name> [STATIC | SHARED | MODULE [WITH_SOABI]] + <source1> [<source2> ...]) -If library type is not specified, ``MODULE`` is assumed. +If the library type is not specified, ``MODULE`` is assumed. + +For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the +module suffix will include the ``Python_SOABI`` value, if any. #]=======================================================================] diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 0f52008..bf55bf5 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -2514,15 +2514,21 @@ 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" "" "") + "STATIC;SHARED;MODULE;WITH_SOABI" "" "") - unset (type) - if (NOT (PYTHON_ADD_LIBRARY_STATIC - OR PYTHON_ADD_LIBRARY_SHARED - OR PYTHON_ADD_LIBRARY_MODULE)) + 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) + set (type SHARED) + else() set (type MODULE) endif() - add_library (${name} ${type} ${ARGN}) + add_library (${name} ${type} ${PYTHON_ADD_LIBRARY_UNPARSED_ARGUMENTS}) get_property (type TARGET ${name} PROPERTY TYPE) @@ -2533,7 +2539,18 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set_property (TARGET ${name} PROPERTY SUFFIX ".pyd") endif() + + if (PYTHON_ADD_LIBRARY_WITH_SOABI AND ${prefix}_SOABI) + get_property (suffix TARGET ${name} PROPERTY SUFFIX) + if (NOT suffix) + set (suffix "${CMAKE_SHARED_MODULE_SUFFIX}") + endif() + set_property (TARGET ${name} PROPERTY SUFFIX ".${${prefix}_SOABI}${suffix}") + endif() else() + if (PYTHON_ADD_LIBRARY_WITH_SOABI) + message (AUTHOR_WARNING "Find${prefix}: Option `WITH_SOABI` is only supported for `MODULE` library type.") + endif() target_link_libraries (${name} PRIVATE ${prefix}::Python) endif() endfunction() diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 9d4eda2..af8ad39 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -240,13 +240,14 @@ setting the following variables: Commands ^^^^^^^^ -This module defines the command ``Python_add_library`` (when +This module defines the command ``Python2_add_library`` (when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as :command:`add_library` and adds a dependency to target ``Python2::Python`` or, when library type is ``MODULE``, to target ``Python2::Module`` and takes care of Python module naming rules:: - Python2_add_library (my_module MODULE src1.cpp) + Python2_add_library (<name> [STATIC | SHARED | MODULE] + <source1> [<source2> ...]) If library type is not specified, ``MODULE`` is assumed. #]=======================================================================] diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 00c354e..66f4f75 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -288,15 +288,19 @@ setting the following variables: Commands ^^^^^^^^ -This module defines the command ``Python_add_library`` (when +This module defines the command ``Python3_add_library`` (when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as :command:`add_library` and adds a dependency to target ``Python3::Python`` or, when library type is ``MODULE``, to target ``Python3::Module`` and takes care of Python module naming rules:: - Python3_add_library (my_module MODULE src1.cpp) + Python3_add_library (<name> [STATIC | SHARED | MODULE [WITH_SOABI]] + <source1> [<source2> ...]) -If library type is not specified, ``MODULE`` is assumed. +If the library type is not specified, ``MODULE`` is assumed. + +For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the +module suffix will include the ``Python3_SOABI`` value, if any. #]=======================================================================] diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index dc8dd6f..87ddfcd 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -141,7 +141,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" set(CMAKE_RC_PREPROCESSOR CMAKE_CXX_COMPILER) endif() if(DEFINED CMAKE_RC_PREPROCESSOR) - set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_COMMAND} -E cmake_llvm_rc <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -clang:-MD -clang:-MF -clang:<SOURCE>.d -E <SOURCE> -- <CMAKE_RC_COMPILER> <FLAGS> /fo <OBJECT> <OBJECT>.pp") + set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_COMMAND} -E cmake_llvm_rc <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -clang:-MD -clang:-MF -clang:<SOURCE>.d -E <SOURCE> -- <CMAKE_RC_COMPILER> <DEFINES> /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/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 5243c36..f4d102e 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1178,7 +1178,8 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure( cmNinjaOuts this_outs; // this will be the new cache entry for (auto const& dep_target : this->GetTargetDirectDepends(target)) { - if (dep_target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + if (dep_target->GetType() == cmStateEnums::INTERFACE_LIBRARY || + (this->EnableCrossConfigBuild() && !dep_target.IsCross())) { continue; } @@ -2600,6 +2601,9 @@ void cmGlobalNinjaMultiGenerator::GetQtAutoGenConfigs( bool cmGlobalNinjaMultiGenerator::InspectConfigTypeVariables() { + this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_DEFAULT_BUILD_TYPE"); + this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_CROSS_CONFIGS"); + this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_DEFAULT_CONFIGS"); return this->ReadCacheEntriesForBuild(*this->Makefiles.front()->GetState()); } diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt index aea2baf..4a6aea3 100644 --- a/Tests/FindPython/SOABI/CMakeLists.txt +++ b/Tests/FindPython/SOABI/CMakeLists.txt @@ -10,3 +10,13 @@ endif() if(NOT DEFINED Python3_SOABI) message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") endif() + +if (Python3_Development_FOUND AND Python3_SOABI) + Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c) + target_compile_definitions (spam3 PRIVATE PYTHON3) + + get_property (suffix TARGET spam3 PROPERTY SUFFIX) + if (NOT suffix MATCHES "^.${Python3_SOABI}") + message(FATAL_ERROR "Module suffix do not include Python3_SOABI") + endif() +endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake index f534319..167f5b9 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake @@ -23,12 +23,11 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_generatorobj_Release} - ${TARGET_OBJECT_FILES_emptyobj_Release} - EXCLUDE ${TARGET_OBJECT_FILES_generator_Debug} ${TARGET_OBJECT_FILES_generated_Release} + ${TARGET_OBJECT_FILES_emptyobj_Release} ${TARGET_OBJECT_FILES_generator_MinSizeRel} ${TARGET_OBJECT_FILES_generated_MinSizeRel} diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake index 5e30bfe..1e4cbe1 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake @@ -11,8 +11,6 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_generatorobj_Release} - ${TARGET_OBJECT_FILES_emptyobj_Release} - EXCLUDE ${TARGET_OBJECT_FILES_generator_Debug} ${TARGET_OBJECT_FILES_generated_Debug} @@ -21,6 +19,7 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_emptyobj_Debug} ${TARGET_OBJECT_FILES_generated_Release} + ${TARGET_OBJECT_FILES_emptyobj_Release} ${TARGET_OBJECT_FILES_generator_MinSizeRel} ${TARGET_OBJECT_FILES_generated_MinSizeRel} diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake index 9500cda..faf392e 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake @@ -12,8 +12,6 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_generatorobj_Debug} - ${TARGET_OBJECT_FILES_emptyobj_Debug} - ${TARGET_FILE_generator_Release} ${TARGET_OBJECT_FILES_generator_Release} @@ -30,6 +28,7 @@ check_files("${RunCMake_TEST_BINARY_DIR}" EXCLUDE ${TARGET_OBJECT_FILES_generated_Debug} + ${TARGET_OBJECT_FILES_emptyobj_Debug} ${TARGET_OBJECT_FILES_generator_MinSizeRel} ${TARGET_OBJECT_FILES_generated_MinSizeRel} diff --git a/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake b/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake new file mode 100644 index 0000000..bb7b160 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake @@ -0,0 +1 @@ +# Intentionally empty diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index b07b4f7..6472f46 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -78,8 +78,6 @@ endfunction() ############################################################################### -set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build) # IMPORTANT: Setting RelWithDebInfo as the first item in CMAKE_CONFIGURATION_TYPES # generates a build.ninja file with that configuration @@ -203,6 +201,7 @@ unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) run_cmake_build(FrameworkDependencyAutogen framework Release test2:Debug) +set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_CROSS_CONFIGS=all") run_cmake_configure(CustomCommandGenerator) @@ -219,6 +218,7 @@ run_cmake_command(CustomCommandGenerator-debug-in-release-graph-generated "${TAR run_ninja(CustomCommandGenerator debug-in-release-graph-clean build-Debug.ninja clean:Debug) run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja generated:Release) run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") +unset(RunCMake_TEST_NO_CLEAN) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandsAndTargets-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all") @@ -275,6 +275,16 @@ run_ninja(Install debug-in-release-graph-install build-Release.ninja install:Deb #run_cmake_configure(AutoMocExecutable) #run_cmake_build(AutoMocExecutable debug-in-release-graph Release exe) +# Need to test this manually because run_cmake() adds --no-warn-unused-cli +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoUnusedVariables-build) +run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} + -G "Ninja Multi-Config" + "-DRunCMake_TEST=NoUnusedVariables" + "-DCMAKE_CROSS_CONFIGS=all" + "-DCMAKE_DEFAULT_BUILD_TYPE=Debug" + "-DCMAKE_DEFAULT_CONFIGS=all" + ) + if(CMake_TEST_CUDA) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build) run_cmake_configure(CudaSimple) |