diff options
author | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:13 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:13 +0900 |
commit | bcea046fa852d4ec00c158b9610ca5d1434a72a4 (patch) | |
tree | 184c59e331c1239bc105ddcbc92f71190736341f | |
parent | 09b92c34460b1f05dcea435bca10a0f1c99e9285 (diff) | |
download | cmake-bcea046fa852d4ec00c158b9610ca5d1434a72a4.tar.gz cmake-bcea046fa852d4ec00c158b9610ca5d1434a72a4.tar.bz2 cmake-bcea046fa852d4ec00c158b9610ca5d1434a72a4.zip |
Imported Upstream version 3.23.1upstream/3.23.1
63 files changed, 541 insertions, 241 deletions
diff --git a/Help/command/install.rst b/Help/command/install.rst index 14f7ff791..1a9dfd70c 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -828,7 +828,7 @@ of the ``Development`` component in the package metadata, ensuring that the library is always installed if the headers and CMake export file are present. .. versionadded:: 3.7 - In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode maybe + In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode may be used to specify an export to the android ndk build system. This mode accepts the same options as the normal export mode. The Android NDK supports the use of prebuilt libraries, both static and shared. This diff --git a/Help/command/string.rst b/Help/command/string.rst index 9b707eb83..b1ca2cb80 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -612,7 +612,7 @@ Requires an element of object type. .. code-block:: cmake string(JSON <out-var> [ERROR_VARIABLE <error-variable>] - LENGTH <json-string> <member|index> [<member|index> ...]) + LENGTH <json-string> [<member|index> ...]) Get the length of an element in ``<json-string>`` at the location given by the list of ``<member|index>`` arguments. diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index 6ad86e3f8..1ad6c373e 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -77,7 +77,7 @@ have zero or more named file sets. Each file set has a name, a type, a scope of ``INTERFACE``, ``PUBLIC``, or ``PRIVATE``, one or more base directories, and files within those directories. The only acceptable type is ``HEADERS``. The optional default file sets are named after their type. The target may not be a -custom target. +custom target or :prop_tgt:`FRAMEWORK` target. Files in a ``PRIVATE`` or ``PUBLIC`` file set are marked as source files for the purposes of IDE integration. Additionally, files in ``HEADERS`` file sets diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst index 151ea5a1b..53be91f00 100644 --- a/Help/dev/maint.rst +++ b/Help/dev/maint.rst @@ -245,20 +245,6 @@ Commit with a message such as:: Release versions do not have the development topic section of the CMake Release Notes index page. -Update ``.gitlab-ci.yml`` to drop the upload jobs from the -packaging pipeline by renaming them to start in ``.``: - -.. code-block:: shell - - sed -i 's/^u:/.u:/' .gitlab-ci.yml - -Commit with a message such as:: - - gitlab-ci: Drop package pipeline upload jobs for release branch - - The package pipeline for release versions should not upload packages - automatically to our archive of nightly development versions. - Update ``Source/CMakeVersion.cmake`` to set the version to ``$major.$minor.0-rc0``: @@ -290,15 +276,13 @@ Merge the ``release-$ver`` branch to ``master``: git merge --no-ff release-$ver Begin post-release development by restoring the development branch release -note infrastructure, the nightly package pipeline upload jobs, and -the version date from ``origin/master``: +note infrastructure, and the version date from ``origin/master``: .. code-block:: shell git checkout origin/master -- \ Source/CMakeVersion.cmake Help/release/dev/0-sample-topic.rst sed -i $'/^Releases/ i\\\n.. include:: dev.txt\\\n' Help/release/index.rst - sed -i 's/^\.u:/u:/' .gitlab-ci.yml Update ``Source/CMakeVersion.cmake`` to set the version to ``$major.$minor.$date``: diff --git a/Help/policy/CMP0112.rst b/Help/policy/CMP0112.rst index 313a51e82..5b00d0710 100644 --- a/Help/policy/CMP0112.rst +++ b/Help/policy/CMP0112.rst @@ -24,7 +24,9 @@ file name components no longer add a dependency on the evaluated target. In CMake 3.18 and lower a dependency on the evaluated target of the above generator expressions would always be added. CMake 3.19 and above prefer to not add this dependency. This policy provides compatibility for projects -that have not been updated to expect the new behavior. +that have not been updated to expect the new behavior. The policy setting +is recorded on each target when it is created, and decides whether generator +expressions referencing that target imply a dependency on it. The ``OLD`` behavior for this policy is to add a dependency on the evaluated target for the above generator expressions. The ``NEW`` behavior of diff --git a/Help/prop_tgt/HEADER_SETS.rst b/Help/prop_tgt/HEADER_SETS.rst index fcf723e41..ceb1df506 100644 --- a/Help/prop_tgt/HEADER_SETS.rst +++ b/Help/prop_tgt/HEADER_SETS.rst @@ -3,14 +3,13 @@ HEADER_SETS .. versionadded:: 3.23 -List of the target's ``PRIVATE`` and ``PUBLIC`` header sets (i.e. all -file sets with the type ``HEADERS``). Files listed in these file sets -are treated as source files for the purpose of IDE integration. -The files also have their :prop_sf:`HEADER_FILE_ONLY` property set to -``TRUE``. +Read-only list of the target's ``PRIVATE`` and ``PUBLIC`` header sets (i.e. +all file sets with the type ``HEADERS``). Files listed in these file sets are +treated as source files for the purpose of IDE integration. The files also +have their :prop_sf:`HEADER_FILE_ONLY` property set to ``TRUE``. -This property is normally only set by :command:`target_sources(FILE_SET)` -rather than being manipulated directly. +Header sets may be defined using the :command:`target_sources` command +``FILE_SET`` option with type ``HEADERS``. See also :prop_tgt:`HEADER_SET_<NAME>`, :prop_tgt:`HEADER_SET` and :prop_tgt:`INTERFACE_HEADER_SETS`. diff --git a/Help/prop_tgt/INTERFACE_HEADER_SETS.rst b/Help/prop_tgt/INTERFACE_HEADER_SETS.rst index 62db5b304..2d3bdacfc 100644 --- a/Help/prop_tgt/INTERFACE_HEADER_SETS.rst +++ b/Help/prop_tgt/INTERFACE_HEADER_SETS.rst @@ -3,12 +3,12 @@ INTERFACE_HEADER_SETS .. versionadded:: 3.23 -List of the target's ``INTERFACE`` and ``PUBLIC`` header sets (i.e. all -file sets with the type ``HEADERS``). Files listed in these header sets +Read-only list of the target's ``INTERFACE`` and ``PUBLIC`` header sets (i.e. +all file sets with the type ``HEADERS``). Files listed in these header sets can be installed with :command:`install(TARGETS)` and exported with :command:`install(EXPORT)` and :command:`export`. -This property is normally only set by :command:`target_sources(FILE_SET)` -rather than being manipulated directly. +Header sets may be defined using the :command:`target_sources` command +``FILE_SET`` option with type ``HEADERS``. See also :prop_tgt:`HEADER_SETS`. diff --git a/Help/release/3.22.rst b/Help/release/3.22.rst index 1f773e66c..00e93f62a 100644 --- a/Help/release/3.22.rst +++ b/Help/release/3.22.rst @@ -143,12 +143,17 @@ Other Changes * The :cpack_gen:`CPack NSIS Generator` now requires NSIS 3.03 or later. +Updates +======= + +Changes made since CMake 3.22.0 include the following. + 3.22.1 ------ -This version made no changes to documented features or interfaces. -Some implementation updates were made to support ecosystem changes -and/or fix regressions. +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. 3.22.2 ------ @@ -164,3 +169,10 @@ and/or fix regressions. errors in existing projects. The fix has been reverted to restore compatibility. The fix may be restored in a future version of CMake via a policy. + +3.22.4 +------ + +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. diff --git a/Help/release/3.23.rst b/Help/release/3.23.rst index 1a3f53ecc..2febbec3c 100644 --- a/Help/release/3.23.rst +++ b/Help/release/3.23.rst @@ -114,8 +114,8 @@ Variables Properties ---------- -* The :prop_tgt:`HEADER_SETS` and :prop_tgt:`INTERFACE_HEADER_SETS` target - properties were added to list header sets associated with a target. +* The :prop_tgt:`HEADER_SETS` and :prop_tgt:`INTERFACE_HEADER_SETS` read-only + target properties were added to list header sets associated with a target. * The :prop_tgt:`HEADER_SET` and :prop_tgt:`HEADER_SET_<NAME>` target properties were added to list files in the default header set @@ -264,3 +264,21 @@ Other Changes * :manual:`ccmake(1)` may now be enabled on Windows when building CMake from source. This is experimental, and so is not included in official distributions. + +Updates +======= + +Changes made since CMake 3.23.0 include the following. + +3.23.1 +------ + +* The :command:`target_sources` ``FILE_SET`` feature added in CMake 3.23.0 + does not yet place header files properly in Apple :prop_tgt:`FRAMEWORK` + targets. Pending further work in a future version of CMake, it is now + an error to add a ``FILE_SET`` of type ``HEADERS`` to such targets on + Apple platforms. + +* The :prop_tgt:`HEADER_SETS` and :prop_tgt:`INTERFACE_HEADER_SETS` target + properties added in CMake 3.23.0 are now read-only records of the header + sets created by the :command:`target_sources` command. diff --git a/Help/variable/CMAKE_CACHEFILE_DIR.rst b/Help/variable/CMAKE_CACHEFILE_DIR.rst index 8604d0e8c..3fee09f37 100644 --- a/Help/variable/CMAKE_CACHEFILE_DIR.rst +++ b/Help/variable/CMAKE_CACHEFILE_DIR.rst @@ -1,7 +1,6 @@ CMAKE_CACHEFILE_DIR ------------------- -The directory with the ``CMakeCache.txt`` file. - -This is the full path to the directory that has the ``CMakeCache.txt`` -file in it. This is the same as :variable:`CMAKE_BINARY_DIR`. +This variable is used internally by CMake, and may not be set during +the first configuration of a build tree. When it is set, it has the +same value as :variable:`CMAKE_BINARY_DIR`. Use that variable instead. diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake index b7c478f64..ac0e2624a 100644 --- a/Modules/CMakeDependentOption.cmake +++ b/Modules/CMakeDependentOption.cmake @@ -16,13 +16,18 @@ conditions are true. cmake_dependent_option(<option> "<help_text>" <value> <depends> <force>) - Makes ``<option>`` available to the user if ``<depends>`` is true. When - ``<option>`` is available, the given ``<help_text>`` and initial ``<value>`` - are used. If the ``<depends>`` condition is not true, ``<option>`` will not be - presented and will always have the value given by ``<force>``. Any value set by - the user is preserved for when the option is presented again. In case ``<depends>`` - is a :ref:`semicolon-separated list <CMake Language Lists>`, all elements must - be true in order to initialize ``<option>`` with ``<value>``. + Makes ``<option>`` available to the user if the + :ref:`semicolon-separated list <CMake Language Lists>` of conditions in + ``<depends>`` are all true. Otherwise, a local variable named ``<option>`` + is set to ``<force>``. + + When ``<option>`` is available, the given ``<help_text>`` and initial + ``<value>`` are used. Otherwise, any value set by the user is preserved for + when ``<depends>`` is satisfied in the future. + + Note that the ``<option>`` variable only has a value which satisfies the + ``<depends>`` condition within the scope of the caller because it is a local + variable. Example invocation: diff --git a/Modules/CheckPIESupported.cmake b/Modules/CheckPIESupported.cmake index 642447252..452348bf9 100644 --- a/Modules/CheckPIESupported.cmake +++ b/Modules/CheckPIESupported.cmake @@ -22,10 +22,13 @@ property for executables will be honored at link time. Options are: ``OUTPUT_VARIABLE <output>`` - Set ``<output>`` variable with details about any error. + Set ``<output>`` variable with details about any error. If the check is + bypassed because it uses cached results from a previous call, the output + will be empty even if errors were present in the previous call. ``LANGUAGES <lang>...`` Check the linkers used for each of the specified languages. + If this option is not provided, the command checks all enabled languages. ``C``, ``CXX``, ``Fortran`` are supported. @@ -43,9 +46,9 @@ Variables For each language checked, two boolean cache variables are defined. ``CMAKE_<lang>_LINK_PIE_SUPPORTED`` - Set to ``YES`` if ``PIE`` is supported by the linker and ``NO`` otherwise. + Set to true if ``PIE`` is supported by the linker and false otherwise. ``CMAKE_<lang>_LINK_NO_PIE_SUPPORTED`` - Set to ``YES`` if ``NO_PIE`` is supported by the linker and ``NO`` otherwise. + Set to true if ``NO_PIE`` is supported by the linker and false otherwise. Examples ^^^^^^^^ @@ -139,7 +142,7 @@ function (check_pie_supported) # no support at link time. Set cache variables to NO set(CMAKE_${lang}_LINK_PIE_SUPPORTED NO CACHE INTERNAL "PIE (${lang})") set(CMAKE_${lang}_LINK_NO_PIE_SUPPORTED NO CACHE INTERNAL "NO_PIE (${lang})") - string (APPEND outputs "PIE and NO_PIE are not supported by linker for ${lang}") + string (APPEND outputs "PIE and NO_PIE are not supported by linker for ${lang}\n") endif() endforeach() diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 25c5c09fa..2233aa05f 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -53,7 +53,7 @@ is set regardless of the presence of the ``Server`` component in find_package ca # In Windows the default installation of PostgreSQL uses that as part of the path. # E.g C:\Program Files\PostgreSQL\8.4. # Currently, the following version numbers are known to this module: -# "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" +# "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" # # To use this variable just do something like this: # set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") @@ -102,7 +102,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") + "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") # Define additional search paths for root directories. set( PostgreSQL_ROOT_DIRECTORIES diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 4e7f87b92..bd7290194 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -55,7 +55,7 @@ where ``<dir>`` is one of: object code libraries (``lib`` or ``lib64``) On Debian, this may be ``lib/<multiarch-tuple>`` when - :variable:`CMAKE_INSTALL_PREFIX` is ``/``, ``/usr``, or ``/usr/local``. + :variable:`CMAKE_INSTALL_PREFIX` is ``/usr``. ``INCLUDEDIR`` C header files (``include``) ``OLDINCLUDEDIR`` @@ -273,9 +273,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set if(__system_type_for_install STREQUAL "debian") if(CMAKE_LIBRARY_ARCHITECTURE) - if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/" - OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$" - OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$") + if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") endif() if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX diff --git a/Modules/Internal/CheckFlagCommonConfig.cmake b/Modules/Internal/CheckFlagCommonConfig.cmake index 3934c0249..c011c2423 100644 --- a/Modules/Internal/CheckFlagCommonConfig.cmake +++ b/Modules/Internal/CheckFlagCommonConfig.cmake @@ -59,8 +59,8 @@ macro(CMAKE_CHECK_FLAG_COMMON_INIT _FUNC _LANG _SRC _PATTERNS) return() endif() # Normalize locale during test compilation. - set(_locale_vars LC_ALL LC_MESSAGES LANG) - foreach(v IN LISTS _locale_vars) + set(_CFCC_locale_vars LC_ALL LC_MESSAGES LANG) + foreach(v IN LISTS _CFCC_locale_vars) set(_CMAKE_CHECK_FLAG_COMMON_CONFIG_locale_vars_saved_${v} "$ENV{${v}}") set(ENV{${v}} C) endforeach() diff --git a/Modules/Internal/HeaderpadWorkaround.cmake b/Modules/Internal/HeaderpadWorkaround.cmake new file mode 100644 index 000000000..9a7f9f57e --- /dev/null +++ b/Modules/Internal/HeaderpadWorkaround.cmake @@ -0,0 +1,69 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# Do NOT include this module directly into any of your code. It is used by +# the try_compile() implementation to work around a specific issue with +# conflicting flags when building for Apple platforms. +if(NOT APPLE) + return() +endif() + +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced + +function(__cmake_internal_workaround_headerpad_flag_conflict _LANG) + + # Until we can avoid hard-coding -Wl,-headerpad_max_install_names in the + # linker flags, we need to remove it here for cases where we know it will + # conflict with other flags, generate a warning and be ignored. + set(regex "(^| )(-fembed-bitcode(-marker|=(all|bitcode|marker))?|-bundle_bitcode)($| )") + set(remove_headerpad NO) + + # Check arbitrary flags that the user or project has set. These compiler + # flags get added to the linker command line. + if("${CMAKE_${_LANG}_FLAGS}" MATCHES "${regex}") + set(remove_headerpad YES) + endif() + if(NOT remove_headerpad) + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + # Only one of these config-specific variables will be set by try_compile() + # and the rest will be unset, but we can't easily tell which one is set. + # No harm to just add them all here, empty ones won't add flags to check. + foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES) + if("${CMAKE_${_LANG}_FLAGS_${config}}" MATCHES "${regex}") + set(remove_headerpad YES) + break() + endif() + endforeach() + else() + if("${CMAKE_${_LANG}_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}") + set(remove_headerpad YES) + endif() + endif() + endif() + + # The try_compile() command passes compiler flags to check in a way that + # results in them being added to add_definitions(). Those don't end up on + # the linker command line, so we don't need to check them here. + + if(remove_headerpad) + foreach(flag IN ITEMS + CMAKE_${_LANG}_LINK_FLAGS + CMAKE_SHARED_LIBRARY_CREATE_${_LANG}_FLAGS + CMAKE_SHARED_MODULE_CREATE_${_LANG}_FLAGS) + string(REPLACE "-Wl,-headerpad_max_install_names" "" ${flag} "${${flag}}") + set(${flag} "${${flag}}" PARENT_SCOPE) + endforeach() + endif() +endfunction() + +get_property(__enabled_languages GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(__lang IN LISTS __enabled_languages) + __cmake_internal_workaround_headerpad_flag_conflict(${__lang}) +endforeach() +unset(__lang) +unset(__enabled_languages) + +cmake_policy(POP) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6bc1293d6..55700750f 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 23) -set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_PATCH 1) #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 [==[00677703d0 CMake 3.23.0]==]) + set(git_info [==[efe08e2894 CMake 3.23.1]==]) # 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/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 84fa89779..324ce87c2 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -831,6 +831,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, ? "NEW" : "OLD"); + // Workaround for -Wl,-headerpad_max_install_names issue until we can avoid + // adding that flag in the platform and compiler language files + fprintf(fout, + "include(\"${CMAKE_ROOT}/Modules/Internal/" + "HeaderpadWorkaround.cmake\")\n"); + if (targetType == cmStateEnums::EXECUTABLE) { /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", diff --git a/Source/cmFileSet.cxx b/Source/cmFileSet.cxx index 2c06dc6f6..1d1d29e44 100644 --- a/Source/cmFileSet.cxx +++ b/Source/cmFileSet.cxx @@ -7,19 +7,79 @@ #include <utility> #include <vector> +#include <cmext/string_view> + #include "cmsys/RegularExpression.hxx" #include "cmGeneratorExpression.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" +#include "cmMakefile.h" #include "cmMessageType.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmake.h" -cmFileSet::cmFileSet(std::string name, std::string type) +cm::static_string_view cmFileSetVisibilityToName(cmFileSetVisibility vis) +{ + switch (vis) { + case cmFileSetVisibility::Interface: + return "INTERFACE"_s; + case cmFileSetVisibility::Public: + return "PUBLIC"_s; + case cmFileSetVisibility::Private: + return "PRIVATE"_s; + } + return ""_s; +} + +cmFileSetVisibility cmFileSetVisibilityFromName(cm::string_view name, + cmMakefile* mf) +{ + if (name == "INTERFACE"_s) { + return cmFileSetVisibility::Interface; + } + if (name == "PUBLIC"_s) { + return cmFileSetVisibility::Public; + } + if (name == "PRIVATE"_s) { + return cmFileSetVisibility::Private; + } + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("File set visibility \"", name, "\" is not valid.")); + return cmFileSetVisibility::Private; +} + +bool cmFileSetVisibilityIsForSelf(cmFileSetVisibility vis) +{ + switch (vis) { + case cmFileSetVisibility::Interface: + return false; + case cmFileSetVisibility::Public: + case cmFileSetVisibility::Private: + return true; + } + return false; +} + +bool cmFileSetVisibilityIsForInterface(cmFileSetVisibility vis) +{ + switch (vis) { + case cmFileSetVisibility::Interface: + case cmFileSetVisibility::Public: + return true; + case cmFileSetVisibility::Private: + return false; + } + return false; +} + +cmFileSet::cmFileSet(std::string name, std::string type, + cmFileSetVisibility visibility) : Name(std::move(name)) , Type(std::move(type)) + , Visibility(visibility) { } diff --git a/Source/cmFileSet.h b/Source/cmFileSet.h index 3aad75f9f..5357e77e7 100644 --- a/Source/cmFileSet.h +++ b/Source/cmFileSet.h @@ -7,20 +7,38 @@ #include <string> #include <vector> +#include <cm/string_view> +#include <cmext/string_view> + #include "cmListFileCache.h" class cmCompiledGeneratorExpression; struct cmGeneratorExpressionDAGChecker; class cmGeneratorTarget; class cmLocalGenerator; +class cmMakefile; + +enum class cmFileSetVisibility +{ + Private, + Public, + Interface, +}; +cm::static_string_view cmFileSetVisibilityToName(cmFileSetVisibility vis); +cmFileSetVisibility cmFileSetVisibilityFromName(cm::string_view name, + cmMakefile* mf); +bool cmFileSetVisibilityIsForSelf(cmFileSetVisibility vis); +bool cmFileSetVisibilityIsForInterface(cmFileSetVisibility vis); class cmFileSet { public: - cmFileSet(std::string name, std::string type); + cmFileSet(std::string name, std::string type, + cmFileSetVisibility visibility); const std::string& GetName() const { return this->Name; } const std::string& GetType() const { return this->Type; } + cmFileSetVisibility GetVisibility() const { return this->Visibility; } void ClearDirectoryEntries(); void AddDirectoryEntry(BT<std::string> directories); @@ -61,6 +79,7 @@ public: private: std::string Name; std::string Type; + cmFileSetVisibility Visibility; std::vector<BT<std::string>> DirectoryEntries; std::vector<BT<std::string>> FileEntries; }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2adb232ca..e39309cb8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2469,12 +2469,12 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC", "OBJCXX" } }; - bool haveAnyPch = false; + std::set<std::string> pchLangSet; if (this->GetGlobalGenerator()->IsXcode()) { for (const std::string& lang : langs) { const std::string pchHeader = target->GetPchHeader(config, lang, ""); if (!pchHeader.empty()) { - haveAnyPch = true; + pchLangSet.emplace(lang); } } } @@ -2519,9 +2519,11 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) const std::string pchHeader = target->GetPchHeader(config, lang, arch); if (pchSource.empty() || pchHeader.empty()) { - if (this->GetGlobalGenerator()->IsXcode() && haveAnyPch) { + if (this->GetGlobalGenerator()->IsXcode() && !pchLangSet.empty()) { for (auto* sf : sources) { - sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON"); + if (pchLangSet.find(sf->GetLanguage()) == pchLangSet.end()) { + sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON"); + } } } continue; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index dd7d24463..e61b4b6e6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1678,28 +1678,32 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( compileObjectVars.Includes = includes.c_str(); // Rule for compiling object file. - std::vector<std::string> compileCmds; + std::string cudaCompileMode; if (language == "CUDA") { - std::string cmdVar; if (this->GeneratorTarget->GetPropertyAsBool( "CUDA_SEPARABLE_COMPILATION")) { - cmdVar = "CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION"; - } else if (this->GeneratorTarget->GetPropertyAsBool( - "CUDA_PTX_COMPILATION")) { - cmdVar = "CMAKE_CUDA_COMPILE_PTX_COMPILATION"; + const std::string& rdcFlag = + this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG"); + cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, " "); + } + if (this->GeneratorTarget->GetPropertyAsBool("CUDA_PTX_COMPILATION")) { + const std::string& ptxFlag = + this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_PTX_FLAG"); + cudaCompileMode = cmStrCat(cudaCompileMode, ptxFlag); } else { - cmdVar = "CMAKE_CUDA_COMPILE_WHOLE_COMPILATION"; + const std::string& wholeFlag = + this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG"); + cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag); } - const std::string& compileCmd = - this->GetMakefile()->GetRequiredDefinition(cmdVar); - cmExpandList(compileCmd, compileCmds); - } else { - const std::string cmdVar = cmStrCat("CMAKE_", language, "_COMPILE_OBJECT"); - const std::string& compileCmd = - this->GetMakefile()->GetRequiredDefinition(cmdVar); - cmExpandList(compileCmd, compileCmds); + compileObjectVars.CudaCompileMode = cudaCompileMode.c_str(); } + std::vector<std::string> compileCmds; + const std::string cmdVar = cmStrCat("CMAKE_", language, "_COMPILE_OBJECT"); + const std::string& compileCmd = + this->Makefile->GetRequiredDefinition(cmdVar); + cmExpandList(compileCmd, compileCmds); + std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( this->GetLocalGenerator()->CreateRulePlaceholderExpander()); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e1a966772..57e31b949 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1456,37 +1456,14 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value) BT<std::string>(value, this->impl->Makefile->GetBacktrace())); } } else if (prop == propHEADER_SETS) { - if (value) { - for (auto const& name : cmExpandedList(value)) { - if (!this->GetFileSet(name)) { - this->impl->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("Header set \"", name, "\" has not yet been created.")); - return; - } - } - } - this->impl->HeaderSetsEntries.clear(); - if (!StringIsEmpty(value)) { - this->impl->HeaderSetsEntries.emplace_back( - value, this->impl->Makefile->GetBacktrace()); - } + this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, + "HEADER_SETS property is read-only\n"); + return; } else if (prop == propINTERFACE_HEADER_SETS) { - if (value) { - for (auto const& name : cmExpandedList(value)) { - if (!this->GetFileSet(name)) { - this->impl->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("Header set \"", name, "\" has not yet been created.")); - return; - } - } - } - this->impl->InterfaceHeaderSetsEntries.clear(); - if (!StringIsEmpty(value)) { - this->impl->InterfaceHeaderSetsEntries.emplace_back( - value, this->impl->Makefile->GetBacktrace()); - } + this->impl->Makefile->IssueMessage( + MessageType::FATAL_ERROR, + "INTERFACE_HEADER_SETS property is read-only\n"); + return; } else { this->impl->Properties.SetProperty(prop, value); } @@ -1641,27 +1618,14 @@ void cmTarget::AppendProperty(const std::string& prop, fileSet->AddFileEntry( BT<std::string>(value, this->impl->Makefile->GetBacktrace())); } else if (prop == "HEADER_SETS") { - for (auto const& name : cmExpandedList(value)) { - if (!this->GetFileSet(name)) { - this->impl->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("Header set \"", name, "\" has not yet been created.")); - return; - } - } - this->impl->HeaderSetsEntries.emplace_back( - value, this->impl->Makefile->GetBacktrace()); + this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, + "HEADER_SETS property is read-only\n"); + return; } else if (prop == "INTERFACE_HEADER_SETS") { - for (auto const& name : cmExpandedList(value)) { - if (!this->GetFileSet(name)) { - this->impl->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("Header set \"", name, "\" has not yet been created.")); - return; - } - } - this->impl->InterfaceHeaderSetsEntries.emplace_back( - value, this->impl->Makefile->GetBacktrace()); + this->impl->Makefile->IssueMessage( + MessageType::FATAL_ERROR, + "INTERFACE_HEADER_SETS property is read-only\n"); + return; } else { this->impl->Properties.AppendProperty(prop, value, asString); } @@ -2038,13 +2002,26 @@ cmValue cmTarget::GetProperty(const std::string& prop) const return cmValue(output); } if (prop == propHEADER_SETS) { + std::vector<std::string> set_names; + for (auto const& file_set : this->impl->FileSets) { + if (cmFileSetVisibilityIsForSelf(file_set.second.GetVisibility())) { + set_names.push_back(file_set.second.GetName()); + } + } static std::string output; - output = cmJoin(this->impl->HeaderSetsEntries, ";"_s); + output = cmJoin(set_names, ";"_s); return cmValue(output); } if (prop == propINTERFACE_HEADER_SETS) { + std::vector<std::string> set_names; + for (auto const& file_set : this->impl->FileSets) { + if (cmFileSetVisibilityIsForInterface( + file_set.second.GetVisibility())) { + set_names.push_back(file_set.second.GetName()); + } + } static std::string output; - output = cmJoin(this->impl->InterfaceHeaderSetsEntries, ";"_s); + output = cmJoin(set_names, ";"_s); return cmValue(output); } } @@ -2342,10 +2319,20 @@ cmFileSet* cmTarget::GetFileSet(const std::string& name) } std::pair<cmFileSet*, bool> cmTarget::GetOrCreateFileSet( - const std::string& name, const std::string& type) + const std::string& name, const std::string& type, cmFileSetVisibility vis) { - auto result = - this->impl->FileSets.emplace(std::make_pair(name, cmFileSet(name, type))); + auto result = this->impl->FileSets.emplace( + std::make_pair(name, cmFileSet(name, type, vis))); + if (result.second) { + if (cmFileSetVisibilityIsForSelf(vis)) { + this->impl->HeaderSetsEntries.emplace_back( + name, this->impl->Makefile->GetBacktrace()); + } + if (cmFileSetVisibilityIsForInterface(vis)) { + this->impl->InterfaceHeaderSetsEntries.emplace_back( + name, this->impl->Makefile->GetBacktrace()); + } + } return std::make_pair(&result.first->second, result.second); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1bbd0b0df..362385496 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -12,6 +12,7 @@ #include <vector> #include "cmAlgorithms.h" +#include "cmFileSet.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -19,7 +20,6 @@ #include "cmValue.h" class cmCustomCommand; -class cmFileSet; class cmGlobalGenerator; class cmInstallTargetGenerator; class cmListFileBacktrace; @@ -285,7 +285,8 @@ public: const cmFileSet* GetFileSet(const std::string& name) const; cmFileSet* GetFileSet(const std::string& name); std::pair<cmFileSet*, bool> GetOrCreateFileSet(const std::string& name, - const std::string& type); + const std::string& type, + cmFileSetVisibility vis); std::vector<std::string> GetAllInterfaceFileSets() const; diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index 43a9b3ab3..b1367e184 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetSourcesCommand.h" -#include <algorithm> #include <sstream> #include <utility> @@ -230,12 +229,20 @@ bool TargetSourcesImpl::HandleOneFileSet( this->SetError("FILE_SETs may not be added to custom targets"); return false; } + if (this->Target->IsFrameworkOnApple()) { + this->SetError("FILE_SETs may not be added to FRAMEWORK targets"); + return false; + } bool const isDefault = args.Type == args.FileSet || (args.Type.empty() && args.FileSet[0] >= 'A' && args.FileSet[0] <= 'Z'); std::string type = isDefault ? args.FileSet : args.Type; - auto fileSet = this->Target->GetOrCreateFileSet(args.FileSet, type); + cmFileSetVisibility visibility = + cmFileSetVisibilityFromName(scope, this->Makefile); + + auto fileSet = + this->Target->GetOrCreateFileSet(args.FileSet, type, visibility); if (fileSet.second) { if (!isDefault) { if (!cmFileSet::IsValidName(args.FileSet)) { @@ -257,15 +264,6 @@ bool TargetSourcesImpl::HandleOneFileSet( if (args.BaseDirs.empty()) { args.BaseDirs.emplace_back(this->Makefile->GetCurrentSourceDirectory()); } - - if (scope == "PRIVATE"_s || scope == "PUBLIC"_s) { - this->Target->AppendProperty(cmTarget::GetFileSetsPropertyName(type), - args.FileSet); - } - if (scope == "INTERFACE"_s || scope == "PUBLIC"_s) { - this->Target->AppendProperty( - cmTarget::GetInterfaceFileSetsPropertyName(type), args.FileSet); - } } else { type = fileSet.first->GetType(); if (!args.Type.empty() && args.Type != type) { @@ -275,37 +273,11 @@ bool TargetSourcesImpl::HandleOneFileSet( return false; } - std::string existingScope = "PRIVATE"; - - auto const fileSetsProperty = cmTarget::GetFileSetsPropertyName(type); - auto const interfaceFileSetsProperty = - cmTarget::GetInterfaceFileSetsPropertyName(type); - std::vector<std::string> fileSets; - std::vector<std::string> interfaceFileSets; - cmExpandList(this->Target->GetSafeProperty(fileSetsProperty), fileSets); - cmExpandList(this->Target->GetSafeProperty(interfaceFileSetsProperty), - interfaceFileSets); - - if (std::find(interfaceFileSets.begin(), interfaceFileSets.end(), - args.FileSet) != interfaceFileSets.end()) { - existingScope = "INTERFACE"; - } - if (std::find(fileSets.begin(), fileSets.end(), args.FileSet) != - fileSets.end()) { - if (existingScope == "INTERFACE"_s) { - existingScope = "PUBLIC"; - } - } else if (existingScope != "INTERFACE"_s) { - this->SetError(cmStrCat("File set \"", args.FileSet, "\" is not in ", - fileSetsProperty, " or ", - interfaceFileSetsProperty)); - return false; - } - - if (scope != existingScope) { + if (visibility != fileSet.first->GetVisibility()) { this->SetError( cmStrCat("Scope ", scope, " for file set \"", args.FileSet, - "\" does not match original scope ", existingScope)); + "\" does not match original scope ", + cmFileSetVisibilityToName(fileSet.first->GetVisibility()))); return false; } } @@ -326,11 +298,11 @@ bool TargetSourcesImpl::HandleOneFileSet( for (auto const& dir : cmExpandedList(baseDirectories)) { auto interfaceDirectoriesGenex = cmStrCat("$<BUILD_INTERFACE:", dir, ">"); - if (scope == "PRIVATE"_s || scope == "PUBLIC"_s) { + if (cmFileSetVisibilityIsForSelf(visibility)) { this->Target->AppendProperty("INCLUDE_DIRECTORIES", interfaceDirectoriesGenex); } - if (scope == "INTERFACE"_s || scope == "PUBLIC"_s) { + if (cmFileSetVisibilityIsForInterface(visibility)) { this->Target->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES", interfaceDirectoriesGenex); } diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 0554c3e3e..76055b4ad 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -306,10 +306,11 @@ int do_cmake(int ac, char const* const* av) parsedArgs.emplace_back("--find-package"); return true; } }, - CommandArgument{ "--list-presets", CommandArgument::Values::Zero, - [&](std::string const&) -> bool { + CommandArgument{ "--list-presets", CommandArgument::Values::ZeroOrOne, + [&](std::string const& value) -> bool { workingMode = cmake::HELP_MODE; parsedArgs.emplace_back("--list-presets"); + parsedArgs.emplace_back(value); return true; } }, }; diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 02f043f36..39bcd918f 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.18) project(WithDefs CUDA) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + set(release_compile_defs DEFREL) #Goal for this example: diff --git a/Tests/RunCMake/CMakePresets/ListConfigurePresetsWorkingDir-stdout.txt b/Tests/RunCMake/CMakePresets/ListConfigurePresetsWorkingDir-stdout.txt new file mode 100644 index 000000000..97eedae7c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListConfigurePresetsWorkingDir-stdout.txt @@ -0,0 +1,7 @@ +^Not searching for unused variables given on the command line\. +Available configure presets: + + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm" + "no-generator"$ diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 449132ab4..5867efd25 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -71,13 +71,18 @@ function(run_cmake_presets name) set(_unused_cli) endif() + set(_preset "--preset=${name}") + if(CMakePresets_NO_PRESET) + set(_preset) + endif() + set(RunCMake_TEST_COMMAND ${CMAKE_COMMAND} ${_source_args} -DRunCMake_TEST=${name} -DRunCMake_GENERATOR=${RunCMake_GENERATOR} -DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM} ${_unused_cli} - --preset=${name} + ${_preset} ${ARGN} ) run_cmake(${name}) @@ -288,7 +293,10 @@ run_cmake_presets(ListPresets --list-presets) set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir") set(RunCMake_TEST_NO_CLEAN 1) set(CMakePresets_NO_SOURCE_ARGS 1) +set(CMakePresets_NO_PRESET 1) run_cmake_presets(ListPresetsWorkingDir --list-presets) +run_cmake_presets(ListConfigurePresetsWorkingDir --list-presets=configure) +unset(CMakePresets_NO_PRESET) unset(CMakePresets_NO_SOURCE_ARGS) unset(RunCMake_TEST_NO_CLEAN) unset(RunCMake_TEST_BINARY_DIR) diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake index 79d67e531..276158ce0 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake @@ -4,6 +4,10 @@ include(CheckCompilerFlag) set(C 1) # test that this is tolerated +# test that the check uses an isolated locale +set(_env_LC_ALL "${LC_ALL}") +set(ENV{LC_ALL} "BAD") + check_compiler_flag(C "-_this_is_not_a_flag_" SHOULD_FAIL) if(SHOULD_FAIL) message(SEND_ERROR "invalid C compile flag didn't fail.") @@ -22,3 +26,8 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti i message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed") endif() endif() + +if(NOT "$ENV{LC_ALL}" STREQUAL "BAD") + message(SEND_ERROR "ENV{LC_ALL} was not preserved by check_compiler_flag") +endif() +set(ENV{LC_ALL} ${_env_LC_ALL}) diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake index 4b20ebd1b..dec31ec3a 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake @@ -4,6 +4,10 @@ include(CheckCompilerFlag) set(CXX 1) # test that this is tolerated +# test that the check uses an isolated locale +set(_env_LC_ALL "${LC_ALL}") +set(ENV{LC_ALL} "BAD") + check_compiler_flag(CXX "-_this_is_not_a_flag_" SHOULD_FAIL) if(SHOULD_FAIL) message(SEND_ERROR "invalid CXX compile flag didn't fail.") @@ -15,3 +19,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") endif() endif() + +if(NOT "$ENV{LC_ALL}" STREQUAL "BAD") + message(SEND_ERROR "ENV{LC_ALL} was not preserved by check_compiler_flag") +endif() +set(ENV{LC_ALL} ${_env_LC_ALL}) diff --git a/Tests/RunCMake/CheckCompilerFlag/HeaderpadWorkaround.cmake b/Tests/RunCMake/CheckCompilerFlag/HeaderpadWorkaround.cmake new file mode 100644 index 000000000..128f9dbf8 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/HeaderpadWorkaround.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +include(CheckCompilerFlag) + +# Confirm we can check the conflicting flag directly. This should pass with +# or without the workaround. +check_compiler_flag(C "-fembed-bitcode" result1) +if(NOT result1) + message(FATAL_ERROR "False negative when -fembed-bitcode tested directly") +endif() + +# Check conflicting flag set by user or project won't cause a false negative +# when testing a valid flag. This only passes with the workaround. +set(CMAKE_C_FLAGS -fembed-bitcode) +check_compiler_flag(C "-O" result2) +if(NOT result2) + message(FATAL_ERROR "False negative when -fembed-bitcode set in CMAKE_C_FLAGS") +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake index 7ef1860c6..df2b667cc 100644 --- a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake @@ -26,3 +26,7 @@ endif() if(CMake_TEST_HIP) run_cmake(CheckHIPCompilerFlag) endif() + +if(APPLE) + run_cmake_with_options(HeaderpadWorkaround --debug-trycompile) +endif() diff --git a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt index 2019459d7..25f80d3f6 100644 --- a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt @@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='usr/share' CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' CMAKE_INSTALL_INCLUDEDIR='usr/include' CMAKE_INSTALL_INFODIR='usr/share/info' -CMAKE_INSTALL_LIBDIR='usr/lib/arch' +CMAKE_INSTALL_LIBDIR='usr/lib' CMAKE_INSTALL_LIBEXECDIR='usr/libexec' CMAKE_INSTALL_LOCALEDIR='usr/share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' @@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' -CMAKE_INSTALL_FULL_LIBDIR='/usr/lib/arch' +CMAKE_INSTALL_FULL_LIBDIR='/usr/lib' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt index 08301380e..30795c8a9 100644 --- a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt @@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='share' CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' CMAKE_INSTALL_INCLUDEDIR='include' CMAKE_INSTALL_INFODIR='share/info' -CMAKE_INSTALL_LIBDIR='lib/arch' +CMAKE_INSTALL_LIBDIR='lib' CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' @@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info' -CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib/arch' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' diff --git a/Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake new file mode 100644 index 000000000..dd582aca8 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.16) +project(PchIncludedAllLanguages C CXX) + +if(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH) + add_definitions(-DHAVE_PCH_SUPPORT) +endif() + +add_executable(main + main.cpp + empty.c + pch-included.cpp +) + +target_precompile_headers(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/pch.h>) + +enable_testing() +add_test(NAME main COMMAND main) diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake index a7b3126fd..fd41e2f8e 100644 --- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake +++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake @@ -30,4 +30,5 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") endif() run_test(PchReuseFromObjLib) run_test(PchIncludedAllLanguages) +run_test(PchIncludedOneLanguage) run_test(PchLibObjLibExe) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 9f692eea3..26b4bae9a 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -165,7 +165,7 @@ function(run_cmake test) "|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:" "|[^\n]*xcodebuild[^\n]*DVTPlugInManager" "|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type" - "|[^\n]*objc[^\n]*: Class AMSupportURL[^\n]* One of the two will be used. Which one is undefined." + "|[^\n]*objc[^\n]*: Class [^\n]* One of the two will be used. Which one is undefined." "|[^\n]*is a member of multiple groups" "|[^\n]*offset in archive not a multiple of 8" "|[^\n]*from Time Machine by path" diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt b/Tests/RunCMake/target_sources/FileSetFramework-result.txt index d00491fd7..d00491fd7 100644 --- a/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt +++ b/Tests/RunCMake/target_sources/FileSetFramework-result.txt diff --git a/Tests/RunCMake/target_sources/FileSetFramework-stderr.txt b/Tests/RunCMake/target_sources/FileSetFramework-stderr.txt new file mode 100644 index 000000000..ae7026a0e --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFramework-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetFramework\.cmake:[0-9]+ \(target_sources\): + target_sources FILE_SETs may not be added to FRAMEWORK targets +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetFramework.cmake b/Tests/RunCMake/target_sources/FileSetFramework.cmake new file mode 100644 index 000000000..d8a924fe3 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFramework.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(lib1 SHARED lib1.c) +set_property(TARGET lib1 PROPERTY FRAMEWORK ON) +target_sources(lib1 + PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h + ) diff --git a/Tests/RunCMake/target_sources/FileSetImport.cmake b/Tests/RunCMake/target_sources/FileSetImport.cmake index 9c7358a30..7e790c710 100644 --- a/Tests/RunCMake/target_sources/FileSetImport.cmake +++ b/Tests/RunCMake/target_sources/FileSetImport.cmake @@ -17,7 +17,7 @@ include("${export_build_dir}/export.cmake") include("${export_build_dir}/install/lib/cmake/export.cmake") assert_prop_eq(export::lib1 HEADER_SETS "") -assert_prop_eq(export::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3") +assert_prop_eq(export::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;dir3;e;f;g") assert_prop_eq(export::lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/error.c") assert_prop_eq(export::lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") assert_prop_eq(export::lib1 HEADER_SET_b "${CMAKE_CURRENT_SOURCE_DIR}/h2.h") @@ -35,7 +35,7 @@ assert_prop_eq(export::lib1 HEADER_DIRS_g "${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CM assert_prop_eq(export::lib1 INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR};$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CMAKE_CURRENT_SOURCE_DIR}/dir2;${CMAKE_CURRENT_SOURCE_DIR}/dir3;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir1>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir2>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir3>") assert_prop_eq(install::lib1 HEADER_SETS "") -assert_prop_eq(install::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3") +assert_prop_eq(install::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;dir3;e;f;g") assert_prop_eq(install::lib1 HEADER_SET "${export_build_dir}/install/include/error.c") assert_prop_eq(install::lib1 HEADER_DIRS "${export_build_dir}/install/include") assert_prop_eq(install::lib1 HEADER_SET_b "${export_build_dir}/install/include/h2.h") diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt deleted file mode 100644 index 3972c89ef..000000000 --- a/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at FileSetNoExistInterface\.cmake:[0-9]+ \(set_property\): - Header set "a" has not yet been created\. -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt deleted file mode 100644 index 336bafe00..000000000 --- a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at FileSetNoExistPrivate\.cmake:[0-9]+ \(set_property\): - Header set "a" has not yet been created\. -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake b/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake deleted file mode 100644 index f501912d1..000000000 --- a/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake +++ /dev/null @@ -1,7 +0,0 @@ -enable_language(C) - -add_library(lib1 STATIC empty.c) -set_property(TARGET lib1 PROPERTY HEADER_SETS "a") - -# Error happens at configure-time, so this doesn't help. -target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS) diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt deleted file mode 100644 index 835ffe7b5..000000000 --- a/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at FileSetNoScope\.cmake:[0-9]+ \(target_sources\): - target_sources File set "a" is not in HEADER_SETS or INTERFACE_HEADER_SETS -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoScope.cmake b/Tests/RunCMake/target_sources/FileSetNoScope.cmake deleted file mode 100644 index 79ff34150..000000000 --- a/Tests/RunCMake/target_sources/FileSetNoScope.cmake +++ /dev/null @@ -1,6 +0,0 @@ -enable_language(C) - -add_library(lib1 STATIC empty.c) -target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) -set_property(TARGET lib1 PROPERTY HEADER_SETS) -target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS FILES h2.h) diff --git a/Tests/RunCMake/target_sources/FileSetProperties.cmake b/Tests/RunCMake/target_sources/FileSetProperties.cmake index a671ab34e..74487fe90 100644 --- a/Tests/RunCMake/target_sources/FileSetProperties.cmake +++ b/Tests/RunCMake/target_sources/FileSetProperties.cmake @@ -57,14 +57,14 @@ assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURC assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") target_sources(lib1 PUBLIC FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h) -assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a;c;d;HEADERS") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "HEADERS;a;c;d") assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h") assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") target_sources(lib1 PUBLIC FILE_SET HEADERS FILES h2.h) -assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a;c;d;HEADERS") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "HEADERS;a;c;d") assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h") assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt b/Tests/RunCMake/target_sources/FileSetReadOnlyInterface-result.txt index d00491fd7..d00491fd7 100644 --- a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt +++ b/Tests/RunCMake/target_sources/FileSetReadOnlyInterface-result.txt diff --git a/Tests/RunCMake/target_sources/FileSetReadOnlyInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetReadOnlyInterface-stderr.txt new file mode 100644 index 000000000..2307d132a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetReadOnlyInterface-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetReadOnlyInterface\.cmake:[0-9]+ \(set_property\): + INTERFACE_HEADER_SETS property is read-only + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake b/Tests/RunCMake/target_sources/FileSetReadOnlyInterface.cmake index 266bc6161..468ef912a 100644 --- a/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake +++ b/Tests/RunCMake/target_sources/FileSetReadOnlyInterface.cmake @@ -2,6 +2,3 @@ enable_language(C) add_library(lib1 STATIC empty.c) set_property(TARGET lib1 PROPERTY INTERFACE_HEADER_SETS "a") - -# Error happens at configure-time, so this doesn't help. -target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS) diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-result.txt b/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate-result.txt index d00491fd7..d00491fd7 100644 --- a/Tests/RunCMake/target_sources/FileSetNoScope-result.txt +++ b/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate-result.txt diff --git a/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate-stderr.txt b/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate-stderr.txt new file mode 100644 index 000000000..5f955da50 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetReadOnlyPrivate\.cmake:[0-9]+ \(set_property\): + HEADER_SETS property is read-only + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate.cmake b/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate.cmake new file mode 100644 index 000000000..eda92c16b --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetReadOnlyPrivate.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +set_property(TARGET lib1 PROPERTY HEADER_SETS "a") diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index d23bce19f..8429c967b 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -33,13 +33,15 @@ run_cmake(FileSetWrongBaseDirsRelative) run_cmake(FileSetOverlappingBaseDirs) run_cmake(FileSetInstallMissingSetsPrivate) run_cmake(FileSetInstallMissingSetsInterface) -run_cmake(FileSetNoScope) -run_cmake(FileSetNoExistPrivate) -run_cmake(FileSetNoExistInterface) +run_cmake(FileSetReadOnlyPrivate) +run_cmake(FileSetReadOnlyInterface) run_cmake(FileSetNoExistInstall) run_cmake(FileSetDirectories) run_cmake(FileSetCustomTarget) run_cmake(FileSetBadName) +if(APPLE) + run_cmake(FileSetFramework) +endif() set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW) run_cmake(FileSetFileNoExist) diff --git a/Utilities/Release/linux/aarch64/cache.txt b/Utilities/Release/linux/aarch64/cache.txt index 0c2d9954f..ebfed73dd 100644 --- a/Utilities/Release/linux/aarch64/cache.txt +++ b/Utilities/Release/linux/aarch64/cache.txt @@ -32,7 +32,7 @@ SPHINX_EXECUTABLE:FILEPATH=/usr/local/bin/sphinx-build SPHINX_HTML:BOOL=ON SPHINX_MAN:BOOL=ON SPHINX_QTHELP:BOOL=ON -QCOLLECTIONGENERATOR_EXECUTABLE:PATH=/opt/qt/bin/qhelpgenerator +QHELPGENERATOR_EXECUTABLE:PATH=/opt/qt/bin/qhelpgenerator # We bootstrap as part of the build so skip its test. CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE diff --git a/Utilities/Release/linux/x86_64/cache.txt b/Utilities/Release/linux/x86_64/cache.txt index e1f9fe337..a422af3d2 100644 --- a/Utilities/Release/linux/x86_64/cache.txt +++ b/Utilities/Release/linux/x86_64/cache.txt @@ -32,7 +32,7 @@ SPHINX_EXECUTABLE:FILEPATH=/opt/rh/rh-python36/root/usr/bin/sphinx-build SPHINX_HTML:BOOL=ON SPHINX_MAN:BOOL=ON SPHINX_QTHELP:BOOL=ON -QCOLLECTIONGENERATOR_EXECUTABLE:PATH=/opt/qt/bin/qhelpgenerator +QHELPGENERATOR_EXECUTABLE:PATH=/opt/qt/bin/qhelpgenerator # We bootstrap as part of the build so skip its test. CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE diff --git a/Utilities/Release/win/x86/cache-i386.txt b/Utilities/Release/win/x86/cache-i386.txt index 2dcd4dd3a..31c89ce56 100644 --- a/Utilities/Release/win/x86/cache-i386.txt +++ b/Utilities/Release/win/x86/cache-i386.txt @@ -24,7 +24,7 @@ SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe SPHINX_HTML:BOOL=ON SPHINX_MAN:BOOL=ON SPHINX_QTHELP:BOOL=ON -QCOLLECTIONGENERATOR_EXECUTABLE:PATH=C:/qt-i386/bin/qhelpgenerator.exe +QHELPGENERATOR_EXECUTABLE:PATH=C:/qt-i386/bin/qhelpgenerator.exe # No bootstrap with MSVC tools. CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE diff --git a/Utilities/Release/win/x86/cache-x86_64.txt b/Utilities/Release/win/x86/cache-x86_64.txt index 3c5593e15..b1e8dc143 100644 --- a/Utilities/Release/win/x86/cache-x86_64.txt +++ b/Utilities/Release/win/x86/cache-x86_64.txt @@ -24,7 +24,7 @@ SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe SPHINX_HTML:BOOL=ON SPHINX_MAN:BOOL=ON SPHINX_QTHELP:BOOL=ON -QCOLLECTIONGENERATOR_EXECUTABLE:PATH=C:/qt-x86_64/bin/qhelpgenerator.exe +QHELPGENERATOR_EXECUTABLE:PATH=C:/qt-x86_64/bin/qhelpgenerator.exe # No bootstrap with MSVC tools. CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 073e5ff1a..d2bfb6197 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -50,6 +50,12 @@ else() set(conf_copyright "Kitware, Inc.") endif() +if(CMake_SPHINX_CMAKE_ORG) + set(conf_baseurl "https://cmake.org/cmake/help/latest") +else() + set(conf_baseurl "") +endif() + set(conf_docs "${CMake_SOURCE_DIR}/Help") set(conf_path "${CMAKE_CURRENT_SOURCE_DIR}") set(conf_version "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") @@ -97,12 +103,12 @@ endif() if(SPHINX_QTHELP) find_package(PythonInterp REQUIRED) - find_program(QCOLLECTIONGENERATOR_EXECUTABLE - NAMES qcollectiongenerator-qt5 qcollectiongenerator - DOC "qcollectiongenerator tool" + find_program(QHELPGENERATOR_EXECUTABLE + NAMES qhelpgenerator-qt5 qhelpgenerator + DOC "qhelpgenerator tool" ) - if (NOT QCOLLECTIONGENERATOR_EXECUTABLE) - message(FATAL_ERROR "QCOLLECTIONGENERATOR_EXECUTABLE (qcollectiongenerator) not found!") + if(NOT QHELPGENERATOR_EXECUTABLE) + message(FATAL_ERROR "QHELPGENERATOR_EXECUTABLE (qhelpgenerator) not found!") endif() list(APPEND doc_formats qthelp) @@ -122,7 +128,7 @@ if(SPHINX_QTHELP) "${CMAKE_CURRENT_SOURCE_DIR}/create_identifiers.py" "${CMAKE_CURRENT_BINARY_DIR}/qthelp/" - COMMAND ${QCOLLECTIONGENERATOR_EXECUTABLE} + COMMAND ${QHELPGENERATOR_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp ) endif() @@ -130,11 +136,35 @@ if(SPHINX_LATEXPDF) list(APPEND doc_formats latexpdf) endif() +set(doc_html_opts "") +if(CMake_SPHINX_CMAKE_ORG) + list(APPEND doc_html_opts + -A googleanalytics=1 + -A opensearch=1 + -A versionswitch=1 + ) + + if(CMake_SPHINX_CMAKE_ORG_OUTDATED) + list(APPEND doc_html_opts -A outdated=1) + endif() + + list(APPEND qthelp_extra_commands + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qch" + "${CMAKE_CURRENT_BINARY_DIR}/html/CMake.qch" + ) +endif() + set(doc_format_outputs "") set(doc_format_last "") foreach(format ${doc_formats}) set(doc_format_output "doc_format_${format}") set(doc_format_log "build-${format}.log") + if(CMake_SPHINX_CMAKE_ORG) + set(doctrees "doctrees/${format}") + else() + set(doctrees "doctrees") + endif() if(format STREQUAL "latexpdf") # This format does not use builder (-b) but make_mode (-M) which expects # arguments in peculiar order @@ -145,8 +175,9 @@ foreach(format ${doc_formats}) ${CMake_SOURCE_DIR}/Help ${CMAKE_CURRENT_BINARY_DIR}/${format} -c ${CMAKE_CURRENT_BINARY_DIR} - -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees + -d ${CMAKE_CURRENT_BINARY_DIR}/${doctrees} ${sphinx_flags} + ${doc_${format}_opts} > ${doc_format_log} # log stdout, pass stderr ${${format}_extra_commands} DEPENDS ${doc_format_last} @@ -159,9 +190,10 @@ foreach(format ${doc_formats}) OUTPUT ${doc_format_output} COMMAND ${SPHINX_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} - -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees + -d ${CMAKE_CURRENT_BINARY_DIR}/${doctrees} -b ${format} ${sphinx_flags} + ${doc_${format}_opts} ${CMake_SOURCE_DIR}/Help ${CMAKE_CURRENT_BINARY_DIR}/${format} > ${doc_format_log} # log stdout, pass stderr @@ -173,7 +205,9 @@ foreach(format ${doc_formats}) endif() set_property(SOURCE ${doc_format_output} PROPERTY SYMBOLIC 1) list(APPEND doc_format_outputs ${doc_format_output}) - set(doc_format_last ${doc_format_output}) + if(NOT CMake_SPHINX_CMAKE_ORG) + set(doc_format_last ${doc_format_output}) + endif() endforeach() add_custom_target(documentation ALL DEPENDS ${doc_format_outputs}) @@ -193,6 +227,10 @@ if(CMake_SPHINX_DEPEND_ON_EXECUTABLES) endforeach() endif() +if(CMake_SPHINX_CMAKE_ORG) + return() +endif() + if(SPHINX_INFO) CMake_OPTIONAL_COMPONENT(sphinx-info) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/texinfo/cmake.info diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in index c383828bd..2b3083b04 100644 --- a/Utilities/Sphinx/conf.py.in +++ b/Utilities/Sphinx/conf.py.in @@ -55,6 +55,7 @@ for fpath in cmake_manuals: man_show_urls = False man_make_section_directory = False +html_baseurl = '@conf_baseurl@' html_show_sourcelink = True html_static_path = ['@conf_path@/static'] html_style = 'cmake.css' diff --git a/Utilities/Sphinx/static/cmake.css b/Utilities/Sphinx/static/cmake.css index 029eb1b2f..4539cf96f 100644 --- a/Utilities/Sphinx/static/cmake.css +++ b/Utilities/Sphinx/static/cmake.css @@ -22,3 +22,15 @@ div.sphinxsidebarwrapper { dd > :first-child > p { margin-top: 0px; } + +div.outdated { + background-color: #f0f0c0; + color: black; + font-size: 90%; + padding-bottom: 5px; + padding-left: 2px; + padding-right: 2px; + padding-top: 5px; + text-align: center; + width: 100%; +} diff --git a/Utilities/Sphinx/templates/layout.html b/Utilities/Sphinx/templates/layout.html index be2660caa..8fb7c4273 100644 --- a/Utilities/Sphinx/templates/layout.html +++ b/Utilities/Sphinx/templates/layout.html @@ -17,10 +17,28 @@ </li> {% endblock %} +{%- block relbar1 %} +{{ super() }} +{%- if outdated is defined %} + <div class="outdated"> + This documents an old version of CMake. + <a href="https://cmake.org/cmake/help/latest/{{ pagename }}.html"> + Click here to see the latest release. + </a> + <span class="version_switch_note"></span> + </div> +{%- endif %} +{%- endblock %} + {% block extrahead %} - {% if versionswitch is defined %} - <script type="text/javascript" src="{{ pathto('../version_switch.js', 1) }}"></script> - {% endif %} + {%- if opensearch is defined %} + <link rel="search" type="application/opensearchdescription+xml" + title="Search within CMake Documentation of Latest Version" + href="{{ pathto('../latest-opensearch.xml', 1) }}"/> + {%- endif %} + {%- if versionswitch is defined %} + <script type="text/javascript" src="{{ pathto('../version_switch.js', 1) }}"></script> + {%- endif %} {{ super() }} {% endblock %} @@ -29,3 +47,19 @@ {% block htmltitle %} <title>{{ title|striptags|e }} {{ "—"|safe }} {{ docstitle|e }}</title> {% endblock %} + +{%- block footer %} +{{ super() }} +{%- if googleanalytics is defined %} +<script type="text/javascript"> +var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); +document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); +</script> +<script type="text/javascript"> +try { +var pageTracker = _gat._getTracker("UA-6042509-4"); +pageTracker._trackPageview(); +} catch(err) {} +</script> +{%- endif %} +{%- endblock %} |