From 1101acd15ce7e1d0b772d72441e8424114e7ebb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20R=C3=B6hling?= Date: Fri, 14 Jul 2023 19:10:31 +0200 Subject: [PATCH] New upstream version 3.27.0~rc5 --- Auxiliary/vim/syntax/cmake.vim | 81 +++++++++ Help/manual/cmake-generator-expressions.7.rst | 172 +++++++++++------- Help/release/3.27.rst | 6 + Modules/CMakeDetermineHIPCompiler.cmake | 11 +- Modules/FindProtobuf.cmake | 16 +- Modules/Platform/Android.cmake | 2 + Source/CMakeVersion.cmake | 4 +- Source/cmDebuggerBreakpointManager.cxx | 21 ++- Source/cmDebuggerBreakpointManager.h | 2 + Source/cmDebuggerVariables.cxx | 39 ++-- Source/cmGeneratorExpressionNode.cxx | 4 +- Source/cmGlobalNinjaGenerator.cxx | 3 +- Source/cmNinjaTargetGenerator.cxx | 28 ++- Source/cmWorkerPool.cxx | 2 +- Source/cmcmd.cxx | 20 ++ Tests/CMakeLib/testDebugger.h | 12 +- .../testDebuggerBreakpointManager.cxx | 13 ++ Tests/CMakeLib/testDebuggerVariables.cxx | 29 +++ .../CMakeLib/testDebuggerVariablesHelper.cxx | 1 + Tests/RunCMake/CXXModules/RunCMakeTest.cmake | 5 + .../export-compile-commands-check.cmake | 25 +++ .../export-compile-commands-stderr.txt | 4 + .../export-compile-commands/CMakeLists.txt | 20 ++ .../export-compile-commands/importable.cxx | 6 + .../examples/export-compile-commands/main.cxx | 6 + ...EMOVE_DUPLICATES-empty-element-check.cmake | 6 + .../REMOVE_DUPLICATES-empty-element.cmake | 3 + .../GeneratorExpression/RunCMakeTest.cmake | 1 + Utilities/Sphinx/cmake.py | 2 +- 29 files changed, 428 insertions(+), 116 deletions(-) create mode 100644 Tests/RunCMake/CXXModules/examples/export-compile-commands-check.cmake create mode 100644 Tests/RunCMake/CXXModules/examples/export-compile-commands-stderr.txt create mode 100644 Tests/RunCMake/CXXModules/examples/export-compile-commands/CMakeLists.txt create mode 100644 Tests/RunCMake/CXXModules/examples/export-compile-commands/importable.cxx create mode 100644 Tests/RunCMake/CXXModules/examples/export-compile-commands/main.cxx create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index bc8b06a64..83f13d8ef 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -197,6 +197,10 @@ syn keyword cmakeProperty contained \ HAS_CXX \ HEADER_FILE_ONLY \ HELPSTRING + \ HIP_ARCHITECTURES + \ HIP_EXTENSIONS + \ HIP_STANDARD + \ HIP_STANDARD_REQUIRED \ IMPLICIT_DEPENDS_INCLUDE_TRANSFORM \ IMPORTED \ IMPORTED_COMMON_LANGUAGE_RUNTIME @@ -1150,6 +1154,74 @@ syn keyword cmakeVariable contained \ CMAKE_GLOBAL_AUTORCC_TARGET \ CMAKE_GLOBAL_AUTORCC_TARGET_NAME \ CMAKE_GNUtoMS + \ CMAKE_HIP + \ CMAKE_HIP_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_HIP_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_HIP_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_HIP_ARCHITECTURES + \ CMAKE_HIP_ARCHIVE_APPEND + \ CMAKE_HIP_ARCHIVE_CREATE + \ CMAKE_HIP_ARCHIVE_FINISH + \ CMAKE_HIP_CLANG_TIDY + \ CMAKE_HIP_COMPILER + \ CMAKE_HIP_COMPILER_ABI + \ CMAKE_HIP_COMPILER_AR + \ CMAKE_HIP_COMPILER_ARCHITECTURE_ID + \ CMAKE_HIP_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_HIP_COMPILER_ID + \ CMAKE_HIP_COMPILER_LAUNCHER + \ CMAKE_HIP_COMPILER_LOADED + \ CMAKE_HIP_COMPILER_PREDEFINES_COMMAND + \ CMAKE_HIP_COMPILER_RANLIB + \ CMAKE_HIP_COMPILER_TARGET + \ CMAKE_HIP_COMPILER_VERSION + \ CMAKE_HIP_COMPILER_VERSION_INTERNAL + \ CMAKE_HIP_COMPILE_FEATURES + \ CMAKE_HIP_COMPILE_OBJECT + \ CMAKE_HIP_CPPCHECK + \ CMAKE_HIP_CPPLINT + \ CMAKE_HIP_CREATE_SHARED_LIBRARY + \ CMAKE_HIP_CREATE_SHARED_MODULE + \ CMAKE_HIP_CREATE_STATIC_LIBRARY + \ CMAKE_HIP_EXTENSIONS + \ CMAKE_HIP_FLAGS + \ CMAKE_HIP_FLAGS_DEBUG + \ CMAKE_HIP_FLAGS_DEBUG_INIT + \ CMAKE_HIP_FLAGS_INIT + \ CMAKE_HIP_FLAGS_MINSIZEREL + \ CMAKE_HIP_FLAGS_MINSIZEREL_INIT + \ CMAKE_HIP_FLAGS_RELEASE + \ CMAKE_HIP_FLAGS_RELEASE_INIT + \ CMAKE_HIP_FLAGS_RELWITHDEBINFO + \ CMAKE_HIP_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_HIP_IGNORE_EXTENSIONS + \ CMAKE_HIP_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_LIBRARIES + \ CMAKE_HIP_INCLUDE_WHAT_YOU_USE + \ CMAKE_HIP_INIT + \ CMAKE_HIP_LIBRARY_ARCHITECTURE + \ CMAKE_HIP_LINKER_LAUNCHER + \ CMAKE_HIP_LINKER_PREFERENCE + \ CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_HIP_LINKER_WRAPPER_FLAG + \ CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_HIP_LINK_EXECUTABLE + \ CMAKE_HIP_LINK_LIBRARY_FILE_FLAG + \ CMAKE_HIP_LINK_LIBRARY_FLAG + \ CMAKE_HIP_LINK_LIBRARY_SUFFIX + \ CMAKE_HIP_OUTPUT_EXTENSION + \ CMAKE_HIP_PLATFORM_ID + \ CMAKE_HIP_SIMULATE_ID + \ CMAKE_HIP_SIMULATE_VERSION + \ CMAKE_HIP_SIZEOF_DATA_PTR + \ CMAKE_HIP_SOURCE_FILE_EXTENSIONS + \ CMAKE_HIP_STANDARD + \ CMAKE_HIP_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_HIP_STANDARD_LIBRARIES + \ CMAKE_HIP_STANDARD_REQUIRED + \ CMAKE_HIP_VISIBILITY_PRESET \ CMAKE_HOME_DIRECTORY \ CMAKE_HOST_APPLE \ CMAKE_HOST_SOLARIS @@ -1502,6 +1574,7 @@ syn keyword cmakeVariable contained \ CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA \ CMAKE_USER_MAKE_RULES_OVERRIDE_CXX \ CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran + \ CMAKE_USER_MAKE_RULES_OVERRIDE_HIP \ CMAKE_USER_MAKE_RULES_OVERRIDE_Java \ CMAKE_USER_MAKE_RULES_OVERRIDE_RC \ CMAKE_USER_MAKE_RULES_OVERRIDE_Swift @@ -2575,6 +2648,7 @@ syn keyword cmakeKWdoxygen_add_docs contained syn keyword cmakeKWenable_language contained \ ASM \ CUDA + \ HIP \ ISPC \ OBJC \ OBJCXX @@ -3317,6 +3391,7 @@ syn keyword cmakeKWproject contained \ CMAKE_PROJECT_ \ CUDA \ DESCRIPTION + \ HIP \ HOMEPAGE_URL \ ISPC \ LANGUAGES @@ -3630,6 +3705,9 @@ syn keyword cmakeKWtry_compile contained \ EXECUTABLE \ FALSE \ GHS + \ HIP_EXTENSIONS + \ HIP_STANDARD + \ HIP_STANDARD_REQUIRED \ INCLUDE_DIRECTORIES \ LANG \ LINK_DIRECTORIES @@ -3749,6 +3827,9 @@ syn keyword cmakeGeneratorExpressions contained \ GENERATE \ GENEX_EVAL \ GNU + \ HIP_COMPILER_ID + \ HIP_COMPILER_VERSION + \ HIP_STANDARD \ HOST_LINK \ IF \ IGNORE diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 473e8d7cf..8c3f2d7fd 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -333,6 +333,15 @@ Most of the expressions in this section are closely associated with the :command:`list` command, providing the same capabilities, but in the form of a generator expression. +In each of the following list-related generator expressions, the ``list`` +must not contain any commas if that generator expression expects something to +be provided after the ``list``. For example, the expression +``$`` requires a ``value`` after the ``list``. +Since a comma is used to separate the ``list`` and the ``value``, the ``list`` +cannot itself contain a comma. This restriction does not apply to the +:command:`list` command, it is specific to the list-handling generator +expressions only. + .. _GenEx List Comparisons: List Comparisons @@ -354,133 +363,151 @@ List Queries .. versionadded:: 3.27 - Returns the list's length. + The number of items in the ``list``. .. genex:: $ .. versionadded:: 3.27 - Returns the list of elements specified by indices from the list. + Expands to the list of items specified by indices from the ``list``. .. genex:: $ .. versionadded:: 3.27 - Returns a sublist of the given list. If is 0, an empty list will be - returned. If is -1 or the list is smaller than + then - the remaining elements of the list starting at will be returned. + A sublist of the given ``list``. If ``length`` is 0, an empty list + will be returned. If ``length`` is -1 or the list is smaller than + ``begin + length``, the remaining items of the list starting at + ``begin`` will be returned. .. genex:: $ .. versionadded:: 3.27 - Returns the index of the element specified in the list or -1 if it wasn't - found. + The index of the first item in ``list`` with the specified ``value``, + or -1 if ``value`` is not in the ``list``. .. _GenEx List Transformations: List Transformations ^^^^^^^^^^^^^^^^^^^^ +.. _GenEx LIST-JOIN: + .. genex:: $ .. versionadded:: 3.27 - Returns a string which joins the list with the content of the ``glue`` string - inserted between each item. + Converts ``list`` to a single string with the content of the ``glue`` string + inserted between each item. This is conceptually the same operation as + :genex:`$`, but the two have different behavior with regard + to empty items. ``$`` preserves all empty items, + whereas :genex:`$` drops all empty items from the list. -.. genex:: $ +.. genex:: $ .. versionadded:: 3.27 - Returns a list with the elements appended. + The ``list`` with each ``item`` appended. Multiple items should be + separated by commas. -.. genex:: $ +.. genex:: $ .. versionadded:: 3.27 - Returns a list with the elements inserted at the beginning of the list. + The ``list`` with each ``item`` inserted at the beginning. If there are + multiple items, they should be separated by commas, and the order of the + prepended items will be preserved. -.. genex:: $ +.. genex:: $ .. versionadded:: 3.27 - Returns a list with the elements inserted at the specified index. It is an - error to specify an out-of-range index. Valid indexes are 0 to N where N is - the length of the list, inclusive. An empty list has length 0. + The ``list`` with the ``item`` (or multiple items) inserted at the specified + ``index``. Multiple items should be separated by commas. + + It is an error to specify an out-of-range ``index``. Valid indexes are 0 to N, + where N is the length of the list, inclusive. An empty list has length 0. .. genex:: $ .. versionadded:: 3.27 - Returns a list with the last element was removed. + The ``list`` with the last item removed. .. genex:: $ .. versionadded:: 3.27 - Returns a list with the first element was removed. + The ``list`` with the first item removed. .. genex:: $ .. versionadded:: 3.27 - Returns a list with all instances of the given values were removed. + The ``list`` with all instances of the given ``value`` (or values) removed. + If multiple values are given, they should be separated by commas. .. genex:: $ .. versionadded:: 3.27 - Returns a list with all values at given indices were removed. + The ``list`` with the item at each given ``index`` removed. + +.. _GenEx LIST-REMOVE_DUPLICATES: .. genex:: $ .. versionadded:: 3.27 - Returns a list where duplicated items were removed. The relative order of + The ``list`` with all duplicated items removed. The relative order of items is preserved, but if duplicates are encountered, only the first - instance is preserved. + instance is preserved. The result is the same as + :genex:`$`. + +.. _GenEx LIST-FILTER: .. genex:: $ .. versionadded:: 3.27 - Returns a list with the items that match the regular expression ``regex`` - were included or removed. + A list of items from the ``list`` which match (``INCLUDE``) or do not match + (``EXCLUDE``) the regular expression ``regex``. The result is the same as + :genex:`$`. .. genex:: $ .. versionadded:: 3.27 - Returns the list transformed by applying an ``ACTION`` to all or, by - specifying a ``SELECTOR``, to the selected elements of the list. + The ``list`` transformed by applying an ``ACTION`` to all or, by + specifying a ``SELECTOR``, to the selected list items. .. note:: - The ``TRANSFORM`` sub-command does not change the number of elements in the - list. If a ``SELECTOR`` is specified, only some elements will be changed, + The ``TRANSFORM`` sub-command does not change the number of items in the + list. If a ``SELECTOR`` is specified, only some items will be changed, the other ones will remain the same as before the transformation. - ``ACTION`` specifies the action to apply to the elements of the list. - The actions have exactly the same semantics as of the + ``ACTION`` specifies the action to apply to the items of the list. + The actions have exactly the same semantics as for the :command:`list(TRANSFORM)` command. ``ACTION`` must be one of the following: :command:`APPEND `, :command:`PREPEND ` - Append, prepend specified value to each element of the list. + Append, prepend specified value to each item of the list. .. code-block:: cmake $ :command:`TOLOWER `, :command:`TOUPPER ` - Convert each element of the list to lower, upper characters. + Convert each item of the list to lower, upper characters. .. code-block:: cmake $ :command:`STRIP ` - Remove leading and trailing spaces from each element of the list. + Remove leading and trailing spaces from each item of the list. .. code-block:: cmake @@ -488,13 +515,13 @@ List Transformations :command:`REPLACE `: Match the regular expression as many times as possible and substitute - the replacement expression for the match for each element of the list. + the replacement expression for the match for each item of the list. .. code-block:: cmake $ - ``SELECTOR`` determines which elements of the list will be transformed. + ``SELECTOR`` determines which items of the list will be transformed. Only one type of selector can be specified at a time. When given, ``SELECTOR`` must be one of the following: @@ -515,7 +542,7 @@ List Transformations ``REGEX`` Specify a regular expression. - Only elements matching the regular expression will be transformed. + Only items matching the regular expression will be transformed. .. code-block:: cmake @@ -523,23 +550,29 @@ List Transformations .. genex:: $ - Joins the list with the content of the ``glue`` string inserted between each - item. + Joins the ``list`` with the content of the ``glue`` string inserted between + each item. This is conceptually the same operation as + :ref:`$\ `, but the two have + different behavior with regard to empty items. + :ref:`$\ ` preserves all empty items, + whereas ``$`` drops all empty items from the list. .. genex:: $ .. versionadded:: 3.15 Removes duplicated items in the given ``list``. The relative order of items - is preserved, but if duplicates are encountered, only the first instance is - preserved. + is preserved, and if duplicates are encountered, only the first instance is + retained. The result is the same as + :ref:`$\ `. .. genex:: $ .. versionadded:: 3.15 Includes or removes items from ``list`` that match the regular expression - ``regex``. + ``regex``. The result is the same as + :ref:`$\ `. .. _GenEx List Ordering: @@ -550,13 +583,13 @@ List Ordering .. versionadded:: 3.27 - Returns the list with the elements in reverse order. + The ``list`` with the items in reverse order. .. genex:: $ .. versionadded:: 3.27 - Returns the list sorted according the specified options. + The ``list`` sorted according to the specified options. Use one of the ``COMPARE`` options to select the comparison method for sorting: @@ -566,26 +599,25 @@ List Ordering This is the default behavior if the ``COMPARE`` option is not given. ``FILE_BASENAME`` - Sorts a list of pathnames of files by their basenames. + Sorts a list of file paths by their basenames. ``NATURAL`` - Sorts a list of strings using natural order - (see ``strverscmp(3)`` manual), i.e. such that contiguous digits - are compared as whole numbers. - For example: the following list `10.0 1.1 2.1 8.0 2.0 3.1` - will be sorted as `1.1 2.0 2.1 3.1 8.0 10.0` if the ``NATURAL`` - comparison is selected where it will be sorted as - `1.1 10.0 2.0 2.1 3.1 8.0` with the ``STRING`` comparison. + Sorts a list of strings using natural order (see the man page for + ``strverscmp(3)``), such that contiguous digits are compared as whole + numbers. For example, the following list ``10.0 1.1 2.1 8.0 2.0 3.1`` + will be sorted as ``1.1 2.0 2.1 3.1 8.0 10.0`` if the ``NATURAL`` + comparison is selected, whereas it will be sorted as + ``1.1 10.0 2.0 2.1 3.1 8.0`` with the ``STRING`` comparison. - Use one of the ``CASE`` options to select a case sensitive or case - insensitive sort mode: + Use one of the ``CASE`` options to select a case-sensitive or + case-insensitive sort mode: ``SENSITIVE`` List items are sorted in a case-sensitive manner. This is the default behavior if the ``CASE`` option is not given. ``INSENSITIVE`` - List items are sorted case insensitively. The order of + List items are sorted in a case-insensitive manner. The order of items which differ only by upper/lowercase is not specified. To control the sort order, one of the ``ORDER`` options can be given: @@ -597,8 +629,8 @@ List Ordering ``DESCENDING`` Sorts the list in descending order. - This is an error to specify multiple times the same option. Various options - can be specified in any order: + Options can be specified in any order, but it is an error to specify the + same option multiple times. .. code-block:: cmake @@ -1789,20 +1821,20 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.27 Full path to the linker import file. On DLL platforms, it would be the - ``.lib`` file. On AIX, for the executables, and on macOS, for the shared - libraries, it could be, respectively, the ``.imp`` or ``.tbd`` import file, - depending of the value of :prop_tgt:`ENABLE_EXPORTS` property. + ``.lib`` file. For executables on AIX, and for shared libraries on macOS, + it could be, respectively, the ``.imp`` or ``.tbd`` import file, + depending on the value of the :prop_tgt:`ENABLE_EXPORTS` property. - An empty string is returned when there is no import file associated with the - target. + This expands to an empty string when there is no import file associated + with the target. .. genex:: $ .. versionadded:: 3.27 - Base name of file linker import file of the target ``tgt`` without prefix and - suffix. For example, if target file name is ``libbase.tbd``, the base name is - ``base``. + Base name of the linker import file of the target ``tgt`` without prefix or + suffix. For example, if the target file name is ``libbase.tbd``, the base + name is ``base``. See also the :prop_tgt:`OUTPUT_NAME` and :prop_tgt:`ARCHIVE_OUTPUT_NAME` target properties and their configuration specific variants @@ -1831,7 +1863,7 @@ In the following, the phrase "the ``tgt`` filename" means the name of the Suffix of the import file of the target ``tgt``. - The suffix corresponds to the file extension (such as ".lib" or ".tbd"). + The suffix corresponds to the file extension (such as ``.lib`` or ``.tbd``). See also the :prop_tgt:`IMPORT_SUFFIX` target property. @@ -1842,13 +1874,15 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.27 - Name of the import file of the target target ``tgt``. + Name of the import file of the target ``tgt``. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. .. genex:: $ + .. versionadded:: 3.27 + Directory of the import file of the target ``tgt``. Note that ``tgt`` is not added as a dependency of the target this @@ -1863,11 +1897,11 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.27 On macOS, it could be the ``.tbd`` import file associated with the shared - library, depending of the value of :prop_tgt:`ENABLE_EXPORTS` property. + library, depending on the value of the :prop_tgt:`ENABLE_EXPORTS` property. This generator expression is equivalent to :genex:`$` or - :genex:`$` generator expressions, depending of the + :genex:`$` generator expressions, depending on the characteristics of the target and the platform. .. genex:: $ diff --git a/Help/release/3.27.rst b/Help/release/3.27.rst index 930a0dc13..52768d10e 100644 --- a/Help/release/3.27.rst +++ b/Help/release/3.27.rst @@ -157,6 +157,12 @@ Generator Expressions :ref:`transformation ` operations learned to process :ref:`lists ` of paths element-wise. +* The :genex:`TARGET_IMPORT_FILE`, :genex:`TARGET_IMPORT_FILE_BASE_NAME`, + :genex:`TARGET_IMPORT_FILE_PREFIX`, :genex:`TARGET_IMPORT_FILE_SUFFIX`, + :genex:`TARGET_IMPORT_FILE_NAME`, and :genex:`TARGET_IMPORT_FILE_DIR` + generator expressions were added. These expand to details about the + linker import file for a target. + * The :genex:`TARGET_RUNTIME_DLL_DIRS` generator expression was added. It expands to a list of the directories containing DLLs in :genex:`TARGET_RUNTIME_DLLS`. diff --git a/Modules/CMakeDetermineHIPCompiler.cmake b/Modules/CMakeDetermineHIPCompiler.cmake index 5e5450207..9a40e829b 100644 --- a/Modules/CMakeDetermineHIPCompiler.cmake +++ b/Modules/CMakeDetermineHIPCompiler.cmake @@ -124,7 +124,10 @@ unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS) unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG) if(NOT CMAKE_HIP_COMPILER_ROCM_LIB) - set(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib") + set(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS + "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib" + "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib64" + ) if(CMAKE_HIP_LIBRARY_ARCHITECTURE) list(APPEND _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/${CMAKE_HIP_LIBRARY_ARCHITECTURE}") endif() @@ -146,6 +149,12 @@ if(NOT CMAKE_HIP_COMPILER_ROCM_LIB) endif() unset(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS) endif() +if(CMAKE_HIP_COMPILER_ROCM_LIB MATCHES "/lib64$" AND NOT DEFINED CMAKE_SIZEOF_VOID_P) + # We have not yet determined the target ABI but we need 'find_package' to + # search lib64 directories to find hip-lang CMake package dependencies. + # This will be replaced by ABI detection later. + set(CMAKE_HIP_SIZEOF_DATA_PTR 8) +endif() if (NOT _CMAKE_TOOLCHAIN_LOCATION) get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_HIP_COMPILER}" PATH) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index b046fcc73..a92fb52a3 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -499,11 +499,7 @@ if(Protobuf_INCLUDE_DIR) math(EXPR _PROTOBUF_MAJOR_VERSION "${Protobuf_LIB_VERSION} / 1000000") math(EXPR _PROTOBUF_MINOR_VERSION "${Protobuf_LIB_VERSION} / 1000 % 1000") math(EXPR _PROTOBUF_SUBMINOR_VERSION "${Protobuf_LIB_VERSION} % 1000") - if (_PROTOBUF_MINOR_VERSION GREATER_EQUAL "21") - set(Protobuf_VERSION "${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}") - else() - set(Protobuf_VERSION "${_PROTOBUF_MAJOR_VERSION}.${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}") - endif() + set(Protobuf_VERSION "${_PROTOBUF_MAJOR_VERSION}.${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}") if(Protobuf_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " @@ -524,7 +520,9 @@ if(Protobuf_INCLUDE_DIR) "${Protobuf_PROTOC_EXECUTABLE} reveals version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}") endif() - if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}") + # protoc version 22 and up don't print the major version any more + if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}" AND + NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}") message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" " doesn't match library version ${Protobuf_VERSION}") endif() @@ -556,7 +554,7 @@ if(Protobuf_INCLUDE_DIR) INTERFACE_COMPILE_FEATURES cxx_std_11 ) endif() - if (MSVC AND NOT Protobuf_USE_STATIC_LIBS) + if (WIN32 AND NOT Protobuf_USE_STATIC_LIBS) set_property(TARGET protobuf::libprotobuf APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS" ) @@ -589,7 +587,7 @@ if(Protobuf_INCLUDE_DIR) set_target_properties(protobuf::libprotobuf-lite PROPERTIES IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}") endif() - if (MSVC AND NOT Protobuf_USE_STATIC_LIBS) + if (WIN32 AND NOT Protobuf_USE_STATIC_LIBS) set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS" ) @@ -627,7 +625,7 @@ if(Protobuf_INCLUDE_DIR) INTERFACE_COMPILE_FEATURES cxx_std_11 ) endif() - if (MSVC AND NOT Protobuf_USE_STATIC_LIBS) + if (WIN32 AND NOT Protobuf_USE_STATIC_LIBS) set_property(TARGET protobuf::libprotoc APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS" ) diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake index f490f0e54..a240aff3b 100644 --- a/Modules/Platform/Android.cmake +++ b/Modules/Platform/Android.cmake @@ -4,6 +4,8 @@ if(CMAKE_ANDROID_NDK) include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android.cmake OPTIONAL) endif() +include(Platform/Linux) + # Natively compiling on an Android host doesn't need these flags to be reset. if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") return() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a3d2d7c73..5008c60c5 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,7 +2,7 @@ set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 4) +set(CMake_VERSION_RC 5) set(CMake_VERSION_IS_DIRTY 0) # Start with the full version number used in tags. It has no dev info. @@ -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 [==[b384058e4b CMake 3.27.0-rc4]==]) + set(git_info [==[8bcba75b1c CMake 3.27.0-rc5]==]) # 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/cmDebuggerBreakpointManager.cxx b/Source/cmDebuggerBreakpointManager.cxx index 152f0f591..4ae6728d4 100644 --- a/Source/cmDebuggerBreakpointManager.cxx +++ b/Source/cmDebuggerBreakpointManager.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -78,12 +79,14 @@ cmDebuggerBreakpointManager::HandleSetBreakpointsRequest( cmSystemTools::GetActualCaseForPath(request.source.path.value()); const dap::array defaultValue{}; const auto& breakpoints = request.breakpoints.value(defaultValue); + + if (Breakpoints.find(sourcePath) != Breakpoints.end()) { + Breakpoints[sourcePath].clear(); + } + response.breakpoints.resize(breakpoints.size()); + if (ListFileFunctionLines.find(sourcePath) != ListFileFunctionLines.end()) { // The file has loaded, we can validate breakpoints. - if (Breakpoints.find(sourcePath) != Breakpoints.end()) { - Breakpoints[sourcePath].clear(); - } - response.breakpoints.resize(breakpoints.size()); for (size_t i = 0; i < breakpoints.size(); i++) { int64_t correctedLine = CalibrateBreakpointLine(sourcePath, breakpoints[i].line); @@ -106,7 +109,6 @@ cmDebuggerBreakpointManager::HandleSetBreakpointsRequest( // The file has not loaded, validate breakpoints later. ListFilePendingValidations.emplace(sourcePath); - response.breakpoints.resize(breakpoints.size()); for (size_t i = 0; i < breakpoints.size(); i++) { Breakpoints[sourcePath].emplace_back(NextBreakpointId++, breakpoints[i].line); @@ -191,6 +193,15 @@ std::vector cmDebuggerBreakpointManager::GetBreakpoints( return breakpoints; } +size_t cmDebuggerBreakpointManager::GetBreakpointCount() const +{ + size_t count = 0; + for (auto const& pair : Breakpoints) { + count += pair.second.size(); + } + return count; +} + void cmDebuggerBreakpointManager::ClearAll() { std::unique_lock lock(Mutex); diff --git a/Source/cmDebuggerBreakpointManager.h b/Source/cmDebuggerBreakpointManager.h index a4e5df5f4..747722f23 100644 --- a/Source/cmDebuggerBreakpointManager.h +++ b/Source/cmDebuggerBreakpointManager.h @@ -4,6 +4,7 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include #include #include #include @@ -55,6 +56,7 @@ public: std::vector const& functions); std::vector GetBreakpoints(std::string const& sourcePath, int64_t line); + size_t GetBreakpointCount() const; void ClearAll(); }; diff --git a/Source/cmDebuggerVariables.cxx b/Source/cmDebuggerVariables.cxx index 40fe41f75..8acce346c 100644 --- a/Source/cmDebuggerVariables.cxx +++ b/Source/cmDebuggerVariables.cxx @@ -78,15 +78,16 @@ dap::array cmDebuggerVariables::HandleVariablesRequest() entry.Value.empty()) { continue; } - variables.push_back(dap::Variable{ {}, - {}, - {}, - entry.Name, - {}, - PrivateDataHint, - entry.Type, - entry.Value, - 0 }); + variables.push_back(dap::Variable{ + {}, + {}, + {}, + entry.Name, + {}, + PrivateDataHint, + SupportsVariableType ? entry.Type : dap::optional(), + entry.Value, + 0 }); } } @@ -106,16 +107,16 @@ void cmDebuggerVariables::EnumerateSubVariablesIfAny( { dap::array ret; for (auto const& variables : SubVariables) { - toBeReturned.emplace_back( - dap::Variable{ {}, - {}, - {}, - variables->GetName(), - {}, - PrivatePropertyHint, - SupportsVariableType ? "collection" : nullptr, - variables->GetValue(), - variables->GetId() }); + toBeReturned.emplace_back(dap::Variable{ + {}, + {}, + {}, + variables->GetName(), + {}, + PrivatePropertyHint, + SupportsVariableType ? "collection" : dap::optional(), + variables->GetValue(), + variables->GetId() }); } } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index bb4fc7e27..7fe814ae3 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -384,7 +384,9 @@ static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode "$ expression requires one parameter"); } - return cmList{ parameters.front() }.remove_duplicates().to_string(); + return cmList{ parameters.front(), cmList::EmptyElements::Yes } + .remove_duplicates() + .to_string(); } } removeDuplicatesNode; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e20f157c5..97c9b708b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2733,7 +2733,8 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( auto mm = CxxModuleMapContent(*modmap_fmt, locs, object, usages); // XXX(modmap): If changing this path construction, change - // `cmNinjaTargetGenerator::WriteObjectBuildStatements` to generate the + // `cmNinjaTargetGenerator::WriteObjectBuildStatements` and + // `cmNinjaTargetGenerator::ExportObjectCompileCommand` to generate the // corresponding file path. cmGeneratedFileStream mmf(cmStrCat(object.PrimaryOutput, ".modmap")); mmf << mm; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 85733e12b..d712d7195 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1428,8 +1428,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( if (!modmapFormat.empty()) { // XXX(modmap): If changing this path construction, change - // `cmGlobalNinjaGenerator::WriteDyndep` to expect the corresponding file - // path. + // `cmGlobalNinjaGenerator::WriteDyndep` and + // `cmNinjaTargetGenerator::ExportObjectCompileCommand` to expect the + // corresponding file path. std::string ddModmapFile = cmStrCat(objectFileName, ".modmap"); vars["DYNDEP_MODULE_MAP_FILE"] = ddModmapFile; objBuild.OrderOnlyDeps.push_back(ddModmapFile); @@ -1688,11 +1689,32 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( escapedSourceFileName = this->LocalGenerator->ConvertToOutputFormat( escapedSourceFileName, cmOutputConverter::SHELL); + std::string fullFlags = flags; + { + bool const needDyndep = + this->GetGeneratorTarget()->NeedDyndep(language, outputConfig); + std::string const modmapFormatVar = + cmStrCat("CMAKE_EXPERIMENTAL_", language, "_MODULE_MAP_FORMAT"); + std::string const modmapFormat = + this->Makefile->GetSafeDefinition(modmapFormatVar); + if (needDyndep && !modmapFormat.empty()) { + std::string modmapFlags = this->GetMakefile()->GetRequiredDefinition( + cmStrCat("CMAKE_EXPERIMENTAL_", language, "_MODULE_MAP_FLAG")); + // XXX(modmap): If changing this path construction, change + // `cmGlobalNinjaGenerator::WriteDyndep` and + // `cmNinjaTargetGenerator::WriteObjectBuildStatement` to expect the + // corresponding file path. + cmSystemTools::ReplaceString(modmapFlags, "", + cmStrCat(objectFileName, ".modmap")); + fullFlags += cmStrCat(' ', modmapFlags); + } + } + compileObjectVars.Source = escapedSourceFileName.c_str(); compileObjectVars.Object = objectFileName.c_str(); compileObjectVars.ObjectDir = objectDir.c_str(); compileObjectVars.ObjectFileDir = objectFileDir.c_str(); - compileObjectVars.Flags = flags.c_str(); + compileObjectVars.Flags = fullFlags.c_str(); compileObjectVars.Defines = defines.c_str(); compileObjectVars.Includes = includes.c_str(); diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx index 1d15c27ad..27cdbba09 100644 --- a/Source/cmWorkerPool.cxx +++ b/Source/cmWorkerPool.cxx @@ -309,7 +309,7 @@ void cmUVReadOnlyProcess::UVExit(uv_process_t* handle, int64_t exitStatus, // Set error message on demand proc.Result()->ExitStatus = exitStatus; proc.Result()->TermSignal = termSignal; - if (!proc.Result()->error()) { + if (proc.Result()->ErrorMessage.empty()) { if (termSignal != 0) { proc.Result()->ErrorMessage = cmStrCat( "Process was terminated by signal ", proc.Result()->TermSignal); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9929e8590..0c8d8dbf4 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -2502,6 +2502,26 @@ int cmVSLink::LinkIncremental() int cmVSLink::LinkNonIncremental() { + // The MSVC link tool expects 'rc' to be in the PATH if it needs to embed + // manifests, but the user might explicitly set 'CMAKE_RC_COMPILER' instead. + // Add its location as a fallback at the end of PATH. + if (cmSystemTools::FileIsFullPath(this->RcPath)) { + std::string rcDir = cmSystemTools::GetFilenamePath(this->RcPath); +#ifdef _WIN32 + std::replace(rcDir.begin(), rcDir.end(), '/', '\\'); + char const pathSep = ';'; +#else + char const pathSep = ':'; +#endif + cm::optional path = cmSystemTools::GetEnvVar("PATH"); + if (path) { + path = cmStrCat(*path, pathSep, rcDir); + } else { + path = rcDir; + } + cmSystemTools::PutEnv(cmStrCat("PATH=", *path)); + } + // Sort out any manifests. if (this->LinkGeneratesManifest || !this->UserManifests.empty()) { std::string opt = diff --git a/Tests/CMakeLib/testDebugger.h b/Tests/CMakeLib/testDebugger.h index 8ba21f6e2..d8d2caaba 100644 --- a/Tests/CMakeLib/testDebugger.h +++ b/Tests/CMakeLib/testDebugger.h @@ -19,11 +19,15 @@ do { \ ASSERT_TRUE(x.name == expectedName); \ ASSERT_TRUE(x.value == expectedValue); \ - ASSERT_TRUE(x.type.value() == expectedType); \ - ASSERT_TRUE(x.evaluateName.has_value() == false); \ - if (std::string(expectedType) == "collection") { \ - ASSERT_TRUE(x.variablesReference != 0); \ + if (expectedType == nullptr) { \ + ASSERT_TRUE(x.type == dap::optional()); \ + } else { \ + ASSERT_TRUE(x.type == dap::optional(expectedType)); \ + if (std::string(expectedType) == "collection") { \ + ASSERT_TRUE(x.variablesReference != 0); \ + } \ } \ + ASSERT_TRUE(x.evaluateName.has_value() == false); \ } while (false) #define ASSERT_VARIABLE_REFERENCE(x, expectedName, expectedValue, \ diff --git a/Tests/CMakeLib/testDebuggerBreakpointManager.cxx b/Tests/CMakeLib/testDebuggerBreakpointManager.cxx index 83734ea93..f654442aa 100644 --- a/Tests/CMakeLib/testDebuggerBreakpointManager.cxx +++ b/Tests/CMakeLib/testDebuggerBreakpointManager.cxx @@ -51,6 +51,13 @@ static bool testHandleBreakpointRequestBeforeFileIsLoaded() sourcePath, false); ASSERT_BREAKPOINT(response.breakpoints[2], 2, sourceBreakpoints[2].line, sourcePath, false); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 3); + + // setBreakpoints should override any existing breakpoints + setBreakpointRequest.breakpoints.value().clear(); + helper.Client->send(setBreakpointRequest).get(); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 0); + return true; } @@ -103,6 +110,12 @@ static bool testHandleBreakpointRequestAfterFileIsLoaded() sourcePath, true); ASSERT_TRUE(notExpectBreakpointEvents.load()); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 5); + + // setBreakpoints should override any existing breakpoints + setBreakpointRequest.breakpoints.value().clear(); + helper.Client->send(setBreakpointRequest).get(); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 0); return true; } diff --git a/Tests/CMakeLib/testDebuggerVariables.cxx b/Tests/CMakeLib/testDebuggerVariables.cxx index 6c19baa61..0d8d18d87 100644 --- a/Tests/CMakeLib/testDebuggerVariables.cxx +++ b/Tests/CMakeLib/testDebuggerVariables.cxx @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -174,6 +175,33 @@ static bool testSortTheResult() return true; } +static bool testNoSupportsVariableType() +{ + auto variablesManager = + std::make_shared(); + + auto vars = std::make_shared( + variablesManager, "Variables", false, []() { + return std::vector{ { "test", + "value" } }; + }); + + auto subvars = std::make_shared( + variablesManager, "Children", false); + + vars->AddSubVariables(subvars); + + dap::array variables = + variablesManager->HandleVariablesRequest( + CreateVariablesRequest(vars->GetId())); + + ASSERT_TRUE(variables.size() == 2); + ASSERT_VARIABLE(variables[0], "Children", "", nullptr); + ASSERT_VARIABLE(variables[1], "test", "value", nullptr); + + return true; +} + int testDebuggerVariables(int, char*[]) { return runTests(std::vector>{ @@ -181,5 +209,6 @@ int testDebuggerVariables(int, char*[]) testConstructors, testIgnoreEmptyStringEntries, testSortTheResult, + testNoSupportsVariableType, }); } diff --git a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx index e0bbdf092..d61b73b32 100644 --- a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx +++ b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index ada0c65e6..1009ce482 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -152,6 +152,11 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(scan_properties) endif () +# Tests which require compile commands support. +if ("compile_commands" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(export-compile-commands) +endif () + # Tests which require collation work. if ("collation" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(public-req-private) diff --git a/Tests/RunCMake/CXXModules/examples/export-compile-commands-check.cmake b/Tests/RunCMake/CXXModules/examples/export-compile-commands-check.cmake new file mode 100644 index 000000000..5d7224b13 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-compile-commands-check.cmake @@ -0,0 +1,25 @@ +if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + list(APPEND RunCMake_TEST_FAILED + "No compile commands database detected.") +endif () + +file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" compile_commands) + +string(JSON length + LENGTH "${compile_commands}") +math(EXPR length "${length} - 1") +foreach (item RANGE "${length}") + string(JSON entry + GET "${compile_commands}" + "${item}") + string(JSON command + GET "${entry}" + "command") + if (NOT command MATCHES "(@|-fmodule-mapper=).*\\.modmap") + string(JSON output + GET "${entry}" + "output") + list(APPEND RunCMake_TEST_FAILED + "Missing `.modmap` argument for '${output}'") + endif () +endforeach () diff --git a/Tests/RunCMake/CXXModules/examples/export-compile-commands-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-compile-commands-stderr.txt new file mode 100644 index 000000000..e86878721 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-compile-commands-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at CMakeLists.txt:9 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-compile-commands/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-compile-commands/CMakeLists.txt new file mode 100644 index 000000000..2eb4d5f16 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-compile-commands/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_compile_commands CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +add_executable(export-compile-commands) +target_sources(export-compile-commands + PRIVATE + main.cxx + PRIVATE + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export-compile-commands PUBLIC cxx_std_20) + +add_test(NAME export-compile-commands COMMAND export-compile-commands) diff --git a/Tests/RunCMake/CXXModules/examples/export-compile-commands/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-compile-commands/importable.cxx new file mode 100644 index 000000000..607680a07 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-compile-commands/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-compile-commands/main.cxx b/Tests/RunCMake/CXXModules/examples/export-compile-commands/main.cxx new file mode 100644 index 000000000..feb38d22e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-compile-commands/main.cxx @@ -0,0 +1,6 @@ +import importable; + +int main(int argc, char* argv[]) +{ + return from_import(); +} diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake new file mode 100644 index 000000000..a996e53e1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "1;;2;3") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake new file mode 100644 index 000000000..9d5944ff2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$$2$$3>") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 3fd994721..2a0c89302 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -36,6 +36,7 @@ run_cmake(TARGET_NAME_IF_EXISTS-alias-target) run_cmake(TARGET_NAME_IF_EXISTS-imported-target) run_cmake(TARGET_NAME_IF_EXISTS-imported-global-target) run_cmake(REMOVE_DUPLICATES-empty) +run_cmake(REMOVE_DUPLICATES-empty-element) run_cmake(REMOVE_DUPLICATES-1) run_cmake(REMOVE_DUPLICATES-2) run_cmake(REMOVE_DUPLICATES-3) diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 60bfb339c..66954dfb3 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -737,7 +737,7 @@ class CMakeDomain(Domain): def get_objects(self): for refname, obj in self.data['objects'].items(): - yield (refname, obj.name, obj.objtype, obj.docname, obj.node_id, 1) + yield (refname, refname, obj.objtype, obj.docname, obj.node_id, 1) def setup(app):