diff options
28 files changed, 198 insertions, 65 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c7d139b..18b8d7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,7 +367,7 @@ macro (CMAKE_BUILD_UTILITIES) # Setup third-party libraries. # Everything in the tree should be able to include files from the # Utilities directory. - if (CMAKE_SYSTEM_NAME STREQUAL "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if ((CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400") AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # using -isystem option generate error "template with C linkage" include_directories("${CMake_SOURCE_DIR}/Utilities/std") else() diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 576ed5b..69d6e9a 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -112,26 +112,42 @@ The options are: build time. ``DEPENDS`` - Specify files on which the command depends. Entries in the ``DEPENDS`` - argument list which may also be target names are assumed to be target names, - so only entries which contain a path separator are detected as file paths. + Specify files on which the command depends. Each argument is converted + to a dependency as follows: + + 1. If the argument is the name of a target (created by the + :command:`add_custom_target`, :command:`add_executable`, or + :command:`add_library` command) a target-level dependency is + created to make sure the target is built before any target + using this custom command. Additionally, if the target is an + executable or library, a file-level dependency is created to + cause the custom command to re-run whenever the target is + recompiled. + + 2. If the argument is an absolute path, a file-level dependency + is created on that path. + + 3. If the argument is the name of a source file that has been + added to a target or on which a source file property has been set, + a file-level dependency is created on that source file. + + 4. If the argument is a relative path and it exists in the current + source directory, a file-level dependency is created on that + file in the current source directory. + + 5. Otherwise, a file-level dependency is created on that path relative + to the current binary directory. + If any dependency is an ``OUTPUT`` of another custom command in the same - directory (``CMakeLists.txt`` file) CMake automatically brings the other + directory (``CMakeLists.txt`` file), CMake automatically brings the other custom command into the target in which this command is built. A target-level dependency is added if any dependency is listed as ``BYPRODUCTS`` of a target or any of its build events in the same directory to ensure the byproducts will be available. - If ``DEPENDS`` is not specified the command will run whenever + + If ``DEPENDS`` is not specified, the command will run whenever the ``OUTPUT`` is missing; if the command does not actually - create the ``OUTPUT`` then the rule will always run. - If ``DEPENDS`` specifies any target (created by the - :command:`add_custom_target`, :command:`add_executable`, or - :command:`add_library` command) a target-level dependency is - created to make sure the target is built before any target - using this custom command. Additionally, if the target is an - executable or library a file-level dependency is created to - cause the custom command to re-run whenever the target is - recompiled. + create the ``OUTPUT``, the rule will always run. Arguments to ``DEPENDS`` may use :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 92b6519..060a072 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -389,7 +389,6 @@ Properties on Targets /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN /prop_tgt/XCODE_SCHEME_ARGUMENTS - /prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY /prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT /prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING /prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER @@ -406,6 +405,7 @@ Properties on Targets /prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP /prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER /prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + /prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY /prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS /prop_tgt/XCTEST diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index a639b5d..fc27739 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -247,7 +247,6 @@ Variables that Change Behavior /variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN - /variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY /variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING /variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS @@ -262,6 +261,7 @@ Variables that Change Behavior /variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP /variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER /variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + /variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY /variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS /variable/PackageName_ROOT 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 00af308..c2cfdf0 100644 --- a/Help/release/3.17.rst +++ b/Help/release/3.17.rst @@ -47,12 +47,12 @@ Command-Line ------------ * :manual:`cmake(1)` gained a ``--debug-find`` command-line option to - enable additional human-readable output on where find commands search. + enable additional human-readable output on where ``find_*`` commands search. * :manual:`cmake(1)` gained a ``--trace-format`` command-line option that can be used to set the ``--trace`` output format. Currently, the old human readable and the new JSON format are supported. The new JSON format - is easier to parse automatically, than the existing format. + is easier to parse automatically than the existing format. * :manual:`cmake(1)` gained a ``-E rm`` command-line tool that can be used to remove directories and files. This supersedes the existing @@ -65,7 +65,7 @@ Commands ``DEPENDS`` arguments that are specified relative to the current binary directory. -* The :command:`foreach` learned a new option ``ZIP_LISTS`` to iterate +* The :command:`foreach` command learned a new ``ZIP_LISTS`` option to iterate over multiple lists simultaneously. * The :command:`load_cache(READ_WITH_PREFIX)` command mode is now allowed @@ -79,7 +79,7 @@ Commands * The :command:`message` command gained new keywords ``CHECK_START``, ``CHECK_PASS`` and ``CHECK_FAIL``. -* :command:`target_compile_options` command now honors the ``BEFORE`` +* The :command:`target_compile_options` command now honors the ``BEFORE`` keyword more consistently. See policy :policy:`CMP0101`. Variables @@ -102,7 +102,7 @@ Variables use CUDA. * The :variable:`CMAKE_FIND_DEBUG_MODE` variable was introduced to - print extra find call information during the cmake run to standard + print extra ``find_*`` call information during the cmake run to standard error. Output is designed for human consumption and not for parsing. * The :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable now takes its @@ -117,17 +117,20 @@ Variables to persist a log level between CMake runs, unlike the ``--log-level`` command line option which only applies to that particular run. -* The :variable:`CMAKE_XCODE_SCHEME_ENVIRONMENT` variable and - :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` target property were added to - tell the :generator:`Xcode` generator to set the value of the - ``Custom Working Directory`` schema option. +* The :variable:`CMAKE_XCODE_SCHEME_ENVIRONMENT` variable was added + to initialize the :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` target property. + +* The :variable:`CMAKE_XCODE_SCHEME_WORKING_DIRECTORY` variable and + associated :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY` target property + were added to tell the :generator:`Xcode` generator to set the value of + the ``Custom Working Directory`` schema option. Properties ---------- * The :prop_tgt:`AIX_EXPORT_ALL_SYMBOLS` target property and associated :variable:`CMAKE_AIX_EXPORT_ALL_SYMBOLS` variable were created to - optionally explicitly disbale automatic export of symbols from shared + optionally explicitly disable automatic export of symbols from shared libraries on AIX. * The :prop_tgt:`DEPRECATION` target property was added to mark @@ -179,10 +182,12 @@ 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 + ``xmllint`` executable. Autogen ------- @@ -196,7 +201,7 @@ CTest * The :variable:`CTEST_CONFIGURATION_TYPE` variable is now set from the command line when :manual:`ctest(1)` is invoked with ``-C <cfg>``. -* The :manual:`ctest(1)` gained support for Dr. Memory to run +* The :manual:`ctest(1)` tool gained support for Dr. Memory to run memcheck runs. * The :manual:`ctest(1)` tool gained a ``--no-tests=<[error|ignore]>`` option @@ -244,9 +249,9 @@ CPack :variable:`CPACK_NSIS_FINISH_TITLE_3LINES`. These can be used to specify the finish page title and display it in 3 lines. -* The :cpack_gen:`CPack productbuild Generator` gained option - :variable:`CPACK_PRODUCTBUILD_BACKGROUND` to specify a background image - for the macOS installer. +* The :cpack_gen:`CPack productbuild Generator` gained support for a + :variable:`CPACK_PRODUCTBUILD_BACKGROUND` variable to specify a background + image for the macOS installer. Other ----- @@ -291,7 +296,7 @@ Other Changes See policy :policy:`CMP0099`. * When using MinGW tools, the :command:`find_library` command no longer - finds ``.dll`` files by default. Instead it expects ``.dll.a`` import + finds ``.dll`` files by default. Instead, it expects ``.dll.a`` import libraries to be available. * The :generator:`MinGW Makefiles` generator no longer issues an error if diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake index 9aafe48..688133f 100644 --- a/Modules/CMakeDetermineSwiftCompiler.cmake +++ b/Modules/CMakeDetermineSwiftCompiler.cmake @@ -16,7 +16,7 @@ if("${CMAKE_GENERATOR}" STREQUAL "Xcode") endif() set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift) _cmake_find_compiler_path(Swift) -elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja") +elseif("${CMAKE_GENERATOR}" MATCHES "^Ninja") if(CMAKE_Swift_COMPILER) _cmake_find_compiler_path(Swift) else() diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index f251b41..4b14ddc 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -477,6 +477,7 @@ if(CMAKE_CUDA_COMPILER_LOADED AND NOT CUDAToolkit_BIN_DIR) get_filename_component(cuda_dir "${CMAKE_CUDA_COMPILER}" DIRECTORY) # use the already detected cuda compiler set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "") + mark_as_advanced(CUDAToolkit_BIN_DIR) unset(cuda_dir) endif() @@ -631,6 +632,7 @@ endif() if(NOT CUDAToolkit_BIN_DIR AND CUDAToolkit_NVCC_EXECUTABLE) get_filename_component(cuda_dir "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY) set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "" FORCE) + mark_as_advanced(CUDAToolkit_BIN_DIR) unset(cuda_dir) endif() @@ -732,6 +734,10 @@ find_package_handle_standard_args(CUDAToolkit VERSION_VAR CUDAToolkit_VERSION ) +mark_as_advanced(CUDA_CUDART + CUDAToolkit_INCLUDE_DIR + CUDAToolkit_NVCC_EXECUTABLE + ) #----------------------------------------------------------------------------- # Construct result variables @@ -749,7 +755,6 @@ if(CUDAToolkit_FOUND) set(search_names ${lib_name} ${arg_ALT}) - message(STATUS "arg_EXTRA_PATH_SUFFIXES: ${arg_EXTRA_PATH_SUFFIXES}") find_library(CUDA_${lib_name}_LIBRARY NAMES ${search_names} HINTS ${CUDAToolkit_LIBRARY_DIR} @@ -757,6 +762,7 @@ if(CUDAToolkit_FOUND) PATH_SUFFIXES nvidia/current lib64 lib64/stubs lib/x64 lib lib/stubs ${arg_EXTRA_PATH_SUFFIXES} ) + mark_as_advanced(CUDA_${lib_name}_LIBRARY) if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY) add_library(CUDA::${lib_name} IMPORTED INTERFACE) @@ -798,6 +804,7 @@ if(CUDAToolkit_FOUND) if(UNIX AND NOT APPLE) # On Linux, you must link against librt when using the static cuda runtime. find_library(CUDAToolkit_rt_LIBRARY rt) + mark_as_advanced(CUDAToolkit_rt_LIBRARY) if(NOT CUDAToolkit_rt_LIBRARY) message(WARNING "Could not find librt library, needed by CUDA::cudart_static") else() 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/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 3b00dfb..c16286c 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -32,6 +32,8 @@ function(cm_check_cxx_feature name) string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}") # Filter out ld warnings. string(REGEX REPLACE "[^\n]*ld: warning: [^\n]*" "" check_output "${check_output}") + # Filter out CUDA installation warnings. + string(REGEX REPLACE "[^\n]*clang: warning: Unknown CUDA version[^\n]*" "" check_output "${check_output}") # If using the feature causes warnings, treat it as broken/unavailable. if(check_output MATCHES "(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]") set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 19da2a0..c0ac551 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -139,7 +139,7 @@ template <typename ForwardIterator> ForwardIterator cmRemoveDuplicates(ForwardIterator first, ForwardIterator last) { using Value = typename std::iterator_traits<ForwardIterator>::value_type; - using Hash = struct + struct Hash { std::size_t operator()(ForwardIterator it) const { @@ -147,7 +147,7 @@ ForwardIterator cmRemoveDuplicates(ForwardIterator first, ForwardIterator last) } }; - using Equal = struct + struct Equal { bool operator()(ForwardIterator it1, ForwardIterator it2) const { 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/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 0a6da91..885703f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -873,11 +873,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( cmOutputConverter::SHELL); }(vars["SWIFT_MODULE_NAME"]); + const std::string map = cmStrCat(gt->GetSupportDirectory(), '/', config, + '/', "output-file-map.json"); vars["SWIFT_OUTPUT_FILE_MAP"] = this->GetLocalGenerator()->ConvertToOutputFormat( - this->ConvertToNinjaPath(gt->GetSupportDirectory() + - "/output-file-map.json"), - cmOutputConverter::SHELL); + this->ConvertToNinjaPath(map), cmOutputConverter::SHELL); vars["SWIFT_SOURCES"] = [this, config]() -> std::string { std::vector<cmSourceFile const*> sources; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 0e74678..abf12f8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -953,7 +953,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( if (!this->Configs[config].SwiftOutputMap.empty()) { std::string const mapFilePath = - this->GeneratorTarget->GetSupportDirectory() + "/output-file-map.json"; + cmStrCat(this->GeneratorTarget->GetSupportDirectory(), '/', config, '/', + "output-file-map.json"); std::string const targetSwiftDepsPath = [this, config]() -> std::string { cmGeneratorTarget const* target = this->GeneratorTarget; if (const char* name = target->GetProperty("Swift_DEPENDENCIES_FILE")) { 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) diff --git a/Tests/RunCMake/Swift/L.swift b/Tests/RunCMake/Swift/L.swift new file mode 100644 index 0000000..79ff87e --- /dev/null +++ b/Tests/RunCMake/Swift/L.swift @@ -0,0 +1 @@ +public let ThirtyTwo: Int = 32 diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake index 918df0b..1db202e 100644 --- a/Tests/RunCMake/Swift/RunCMakeTest.cmake +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -12,6 +12,12 @@ elseif(RunCMake_GENERATOR STREQUAL Ninja) run_cmake(SwiftMultiArch) unset(RunCMake_TEST_OPTIONS) endif() +elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config") + if(CMAKE_Swift_COMPILER) + set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release") + run_cmake(SwiftSimple) + unset(RunCMake_TEST_OPTIONS) + endif() else() run_cmake(NotSupported) endif() diff --git a/Tests/RunCMake/Swift/SwiftSimple.cmake b/Tests/RunCMake/Swift/SwiftSimple.cmake new file mode 100644 index 0000000..1f2702d --- /dev/null +++ b/Tests/RunCMake/Swift/SwiftSimple.cmake @@ -0,0 +1,2 @@ +enable_language(Swift) +add_library(L L.swift) diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index fe2ef75..7625cf6 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -137,6 +137,25 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") ) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "OS400") + list(APPEND uv_headers + include/uv/posix.h + ) + list(APPEND uv_defines + _ALL_SOURCE + _XOPEN_SOURCE=500 + _LINUX_SOURCE_COMPAT + _THREAD_SAFE + ) + list(APPEND uv_sources + src/unix/aix-common.c + src/unix/ibmi.c + src/unix/posix-poll.c + src/unix/no-fsevents.c + src/unix/no-proctitle.c + ) +endif() + if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN") list(APPEND uv_libraries ) |