Merge branch 'master' into invalid-configure-preset

This commit is contained in:
Kyle Edwards
2021-03-16 10:14:00 -04:00
271 changed files with 2692 additions and 629 deletions
+5 -5
View File
@@ -52,7 +52,7 @@ prep:doc-package:
- .cmake_doc_artifacts
- .run_only_for_package
.upload:source-package:
upload:source-package:
extends:
- .rsync_upload
- .run_only_for_package
@@ -199,7 +199,7 @@ build:linux-x86_64-package:
needs:
- prep:doc-package
.upload:linux-x86_64-package:
upload:linux-x86_64-package:
extends:
- .rsync_upload
- .run_only_for_package
@@ -223,7 +223,7 @@ build:linux-aarch64-package:
needs:
- prep:doc-package
.upload:linux-aarch64-package:
upload:linux-aarch64-package:
extends:
- .rsync_upload
- .run_only_for_package
@@ -335,7 +335,7 @@ build:macos-package:
needs:
- prep:doc-package
.upload:macos-package:
upload:macos-package:
extends:
- .rsync_upload
- .run_only_for_package
@@ -358,7 +358,7 @@ build:macos10.10-package:
needs:
- prep:doc-package
.upload:macos10.10-package:
upload:macos10.10-package:
extends:
- .rsync_upload
- .run_only_for_package
@@ -1,4 +1,7 @@
set(CMake_TEST_WIX_NO_VERIFY "ON" CACHE BOOL "")
set(CMake_TEST_GUI "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenGL "ON" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_common.cmake")
-9
View File
@@ -13,15 +13,6 @@ if (CTEST_CMAKE_GENERATOR MATCHES "Visual Studio")
"^ExternalProjectUpdateSetup$")
endif ()
if (CMAKE_HOST_WIN32)
list(APPEND test_exclusions
# This test often fails with an undiagnosed subtle race due to the test
# re-using the same objects for many files. Some copy operations fail
# to open their input with ERROR_SHARING_VIOLATION.
"^Module.ExternalData$"
)
endif()
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
if (test_exclusions)
set(test_exclusions "(${test_exclusions})")
+3
View File
@@ -133,6 +133,9 @@ if(CMake_INSTALL_COMPONENTS)
if(SPHINX_QTHELP)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
endif()
if(SPHINX_LATEXPDF)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-latexpdf)
endif()
if(CMake_BUILD_DEVELOPER_REFERENCE)
if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html)
+1 -1
View File
@@ -1,7 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.1...3.18 FATAL_ERROR)
cmake_minimum_required(VERSION 3.1...3.19 FATAL_ERROR)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake)
project(CMake)
+2 -2
View File
@@ -11,8 +11,8 @@ The general signature is:
|FIND_XXX| (
<VAR>
name | |NAMES|
[HINTS path1 [path2 ... ENV var]]
[PATHS path1 [path2 ... ENV var]]
[HINTS [path | ENV var]... ]
[PATHS [path | ENV var]... ]
[PATH_SUFFIXES suffix1 [suffix2 ...]]
[DOC "cache documentation string"]
[REQUIRED]
+38 -2
View File
@@ -38,7 +38,8 @@ Synopsis
`Filesystem`_
file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...])
file(`RENAME`_ <oldname> <newname>)
file(`RENAME`_ <oldname> <newname> [...])
file(`COPY_FILE`_ <oldname> <newname> [...])
file({`REMOVE`_ | `REMOVE_RECURSE`_ } [<files>...])
file(`MAKE_DIRECTORY`_ [<dir>...])
file({`COPY`_ | `INSTALL`_} <file>... DESTINATION <dir> [...])
@@ -665,11 +666,46 @@ Examples of recursive globbing include::
.. code-block:: cmake
file(RENAME <oldname> <newname>)
file(RENAME <oldname> <newname>
[RESULT <result>]
[NO_REPLACE])
Move a file or directory within a filesystem from ``<oldname>`` to
``<newname>``, replacing the destination atomically.
The options are:
``RESULT <result>``
Set ``<result>`` variable to ``0`` on success or an error message otherwise.
If ``RESULT`` is not specified and the operation fails, an error is emitted.
``NO_REPLACE``
If the ``<newname>`` path already exists, do not replace it.
If ``RESULT <result>`` is used, the result variable will be
set to ``NO_REPLACE``. Otherwise, an error is emitted.
.. _COPY_FILE:
.. code-block:: cmake
file(COPY_FILE <oldname> <newname>
[RESULT <result>]
[ONLY_IF_DIFFERENT])
Copy a file from ``<oldname>`` to ``<newname>``. Directories are not
supported. Symlinks are ignored and ``<oldfile>``'s content is read and
written to ``<newname>`` as a new file.
The options are:
``RESULT <result>``
Set ``<result>`` variable to ``0`` on success or an error message otherwise.
If ``RESULT`` is not specified and the operation fails, an error is emitted.
``ONLY_IF_DIFFERENT``
If the ``<newname>`` path already exists, do not replace it if it is the
same as ``<oldname>``. Otherwise, an error is emitted.
.. _REMOVE:
.. _REMOVE_RECURSE:
+6
View File
@@ -103,6 +103,12 @@ on macOS:
- Default: ``CPACK_PACKAGE_FILE_NAME-<component>``
.. variable:: CPACK_DMG_FILESYSTEM
The filesystem format. Common values are ``APFS`` and ``HFS+``.
See ``man hdiutil`` for a full list of supported formats.
Defaults to ``HFS+``.
.. variable:: CPACK_COMMAND_HDIUTIL
Path to the ``hdiutil(1)`` command used to operate on disk image files on
+6
View File
@@ -193,3 +193,9 @@ on Windows Nullsoft Scriptable Install System.
.. versionadded:: 3.20
If set, trim down the size of the control to the size of the branding text string.
.. variable:: CPACK_NSIS_EXECUTABLE
.. versionadded:: 3.21
If set, specify the name of the NSIS executable. Default is ``makensis``.
+4
View File
@@ -76,6 +76,10 @@
native build system to choose a compiler or SDK. See the
:variable:`CMAKE_GENERATOR_PLATFORM` variable for details.
``--install-prefix <directory>``
Specify the installation directory, used by the
:variable:`CMAKE_INSTALL_PREFIX` variable. Must be an absolute path.
``-Wno-dev``
Suppress developer warnings.
+18
View File
@@ -350,6 +350,24 @@ look.
PATHS ${PC_Foo_LIBRARY_DIRS}
)
Alternatively, if the library is available with multiple configurations, you can
use :module:`SelectLibraryConfigurations` to automatically set the
``Foo_LIBRARY`` variable instead:
.. code-block:: cmake
find_library(Foo_LIBRARY_RELEASE
NAMES foo
PATHS ${PC_Foo_LIBRARY_DIRS}/Release
)
find_library(Foo_LIBRARY_DEBUG
NAMES foo
PATHS ${PC_Foo_LIBRARY_DIRS}/Debug
)
include(SelectLibraryConfigurations)
select_library_configurations(Foo)
If you have a good way of getting the version (from a header file, for
example), you can use that information to set ``Foo_VERSION`` (although
note that find modules have traditionally used ``Foo_VERSION_STRING``,
@@ -938,6 +938,29 @@ which is just the string ``tgt``.
:ref:`Target Usage Requirements` this is the consuming target rather
than the target specifying the requirement.
.. genex:: $<TARGET_RUNTIME_DLLS:tgt>
List of DLLs that the target depends on at runtime. This is determined by
the locations of all the ``SHARED`` and ``MODULE`` targets in the target's
transitive dependencies. Using this generator expression on targets other
than executables, ``SHARED`` libraries, and ``MODULE`` libraries is an error.
On non-DLL platforms, it evaluates to an empty string.
This generator expression can be used to copy all of the DLLs that a target
depends on into its output directory in a ``POST_BUILD`` custom command. For
example:
.. code-block:: cmake
find_package(foo REQUIRED)
add_executable(exe main.c)
target_link_libraries(exe PRIVATE foo::foo foo::bar)
add_custom_command(TARGET exe POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:exe> $<TARGET_FILE_DIR:exe>
COMMAND_EXPAND_LISTS
)
.. genex:: $<INSTALL_PREFIX>
Content of the install prefix when the target is exported via
+8
View File
@@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
functions.
Policies Introduced by CMake 3.21
=================================
.. toctree::
:maxdepth: 1
CMP0121: The list command detects invalid indicies </policy/CMP0121>
Policies Introduced by CMake 3.20
=================================
+6
View File
@@ -183,6 +183,12 @@ that may contain the following fields:
specified, it must be inherited from the ``inherits`` preset (unless this
preset is ``hidden``).
``installDir``
An optional string representing the path to the installation directory.
This field supports `macro expansion`_. If a relative path is specified,
it is calculated relative to the source directory.
``cmakeExecutable``
An optional string representing the path to the CMake executable to use
+91 -3
View File
@@ -11,7 +11,7 @@
},
"cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"},
"vendor": { "$ref": "#/definitions/vendor" },
"configurePresets": { "$ref": "#/definitions/configurePresets"}
"configurePresets": { "$ref": "#/definitions/configurePresetsV1"}
},
"additionalProperties": false
},
@@ -19,11 +19,25 @@
"properties": {
"version": {
"const": 2,
"description": "A requVired integer representing the version of the JSON schema."
},
"cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"},
"vendor": { "$ref": "#/definitions/vendor" },
"configurePresets": { "$ref": "#/definitions/configurePresetsV1"},
"buildPresets": { "$ref": "#/definitions/buildPresets"},
"testPresets": { "$ref": "#/definitions/testPresets"}
},
"additionalProperties": false
},
{
"properties": {
"version": {
"const": 3,
"description": "A required integer representing the version of the JSON schema."
},
"cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"},
"vendor": { "$ref": "#/definitions/vendor" },
"configurePresets": { "$ref": "#/definitions/configurePresets"},
"configurePresets": { "$ref": "#/definitions/configurePresetsV3"},
"buildPresets": { "$ref": "#/definitions/buildPresets"},
"testPresets": { "$ref": "#/definitions/testPresets"}
},
@@ -58,7 +72,21 @@
"description": "An optional map containing vendor-specific information. CMake does not interpret the contents of this field except to verify that it is a map if it does exist. However, the keys should be a vendor-specific domain name followed by a /-separated path. For example, the Example IDE 1.0 could use example.com/ExampleIDE/1.0. The value of each field can be anything desired by the vendor, though will typically be a map.",
"properties": {}
},
"configurePresets": {
"configurePresetsItemsV3": {
"type": "array",
"description": "A configure preset object.",
"items": {
"type": "object",
"description": "A configure preset object.",
"properties": {
"installDir": {
"type": "string",
"description": "An optional string representing the path to the output binary directory. This field supports macro expansion. If a relative path is specified, it is calculated relative to the source directory. If binaryDir is not specified, it must be inherited from the inherits preset (unless this preset is hidden)."
}
}
}
},
"configurePresetsItemsV1": {
"type": "array",
"description": "An optional array of configure preset objects.",
"items": {
@@ -302,6 +330,66 @@
},
"additionalProperties": false
}
}
}
},
"configurePresetsV3": {
"type": "array",
"description": "An optional array of configure preset objects.",
"allOf": [
{ "$ref": "#/definitions/configurePresetsItemsV1" },
{ "$ref": "#/definitions/configurePresetsItemsV3" }
],
"items": {
"properties": {
"name": {},
"hidden": {},
"inherits": {},
"vendor": {},
"displayName": {},
"description": {},
"generator": {},
"architecture": {},
"toolset": {},
"binaryDir": {},
"installDir": {},
"cmakeExecutable": {},
"cacheVariables": {},
"environment": {},
"warnings": {},
"errors": {},
"debug": {}
},
"required": [
"name"
],
"additionalProperties": false
}
},
"configurePresetsV1": {
"type": "array",
"description": "An optional array of configure preset objects.",
"allOf": [
{ "$ref": "#/definitions/configurePresetsItemsV1" }
],
"items": {
"properties": {
"name": {},
"hidden": {},
"inherits": {},
"vendor": {},
"displayName": {},
"description": {},
"generator": {},
"architecture": {},
"toolset": {},
"binaryDir": {},
"cmakeExecutable": {},
"cacheVariables": {},
"environment": {},
"warnings": {},
"errors": {},
"debug": {}
},
"required": [
"name"
+21
View File
@@ -0,0 +1,21 @@
CMP0121
-------
.. versionadded:: 3.21
The :command:`list` command now detects invalid indicies.
Prior to CMake version 3.21, the :command:`list` command's ``GET``,
``INSERT``, ``SUBLIST``, and ``REMOVE_AT`` subcommands did not detect invalid
index arguments.
The ``OLD`` behavior of this policy is for invalid indicies to be treated as
their integer value (if any) at the start of the string. For example,
``2good4you`` is a ``2`` and ``not_an_integer`` is a ``0``. The ``NEW``
behavior is for invalid indicies to trigger an error.
This policy was introduced in CMake version 3.21. CMake version |release|
warns when the policy is not set and uses ``OLD`` behavior. Use the
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
.. include:: DEPRECATED.txt
+6
View File
@@ -24,6 +24,12 @@ The features known to this version of CMake are:
``c_std_11``
Compiler mode is at least C 11.
``c_std_17``
Compiler mode is at least C 17.
``c_std_23``
Compiler mode is at least C 23.
``c_function_prototypes``
Function prototypes, as defined in ``ISO/IEC 9899:1990``.
+1 -1
View File
@@ -11,7 +11,7 @@ flag such as ``-std=gnu11`` to the compile line. For compilers that
have no notion of a C standard level, such as Microsoft Visual C++ before
VS 16.7, this property has no effect.
Supported values are ``90``, ``99`` and ``11``.
Supported values are ``90``, ``99``, ``11``, ``17``, ``23``.
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
+7
View File
@@ -0,0 +1,7 @@
0-sample-topic
--------------
* This is a sample release note for the change in a topic.
Developers should add similar notes for each topic branch
making a noteworthy change. Each document should be named
and titled to match the topic name to avoid merge conflicts.
+4
View File
@@ -0,0 +1,4 @@
FindIconv-version
-----------------
* The :module:`FindIconv` module now has version support.
+4
View File
@@ -0,0 +1,4 @@
FindIntl-version
----------------
* The :module:`FindIntl` module now has version support.
+6
View File
@@ -0,0 +1,6 @@
c-std
-----
* :prop_tgt:`C_STANDARD` and the
:manual:`Compile Features <cmake-compile-features(7)>` functionality gained
support for C17 and C23.
@@ -0,0 +1,8 @@
cmake-install-prefix-command
----------------------------
* The :manual:`cmake(1)` command gained the ``--install-prefix <dir>``
command line option to specify the location of the install prefix.
* :manual:`cmake-presets(7)` configure preset gained support for specifying
the install prefix.
@@ -0,0 +1,5 @@
cpack-dmg-filesystem
--------------------
* The :cpack_gen:`CPack DragNDrop Generator` gained option
:variable:`CPACK_DMG_FILESYSTEM` to control the ``.dmg`` filesystem.
@@ -0,0 +1,6 @@
cpack-nsis-executable-name
--------------------------
* The :cpack_gen:`CPack NSIS Generator` gained a new variable
:variable:`CPACK_NSIS_EXECUTABLE` to specify the makensis
executable to use instead of the default one.
+4
View File
@@ -0,0 +1,4 @@
file-COPY_ONLY
--------------
* The :command:`file(COPY_FILE)` command was added to copy a file to another.
+6
View File
@@ -0,0 +1,6 @@
file-RENAME
-----------
* The :command:`file(RENAME)` command learned to optionally capture
failure in a result variable. It also gained a ``NO_REPLACE``
option to fail if the destination exists.
@@ -0,0 +1,7 @@
list-index-arg-parsing
----------------------
* The :command:`list` command's ``GET``, ``INSERT``, ``SUBLIST``, and
``REMOVE_AT`` subcommands now error with invalid (i.e., non-integer) values
are given as any of their index arguments based on the setting of policy
:policy:`CMP0121`.
+4
View File
@@ -0,0 +1,4 @@
runtime-dll-deps
----------------
* A new :genex:`TARGET_RUNTIME_DLLS` generator expression was added.
+2
View File
@@ -7,6 +7,8 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
.. include:: dev.txt
Releases
========
+9
View File
@@ -38,6 +38,15 @@ if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT)
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
endif()
set(CMAKE_DEPFILE_FLAGS_ASM_NASM "-MD <DEP_FILE> -MT <DEP_TARGET>")
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
# dependencies are computed by the compiler itself
set(CMAKE_ASM_NASM_DEPFILE_FORMAT gcc)
set(CMAKE_ASM_NASM_DEPENDS_USE_COMPILER TRUE)
endif()
# Load the generic ASMInformation file:
set(ASM_DIALECT "_NASM")
include(CMakeASMInformation)
+2
View File
@@ -9,6 +9,8 @@ set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
set(CMAKE_C11_COMPILE_FEATURES "@CMAKE_C11_COMPILE_FEATURES@")
set(CMAKE_C17_COMPILE_FEATURES "@CMAKE_C17_COMPILE_FEATURES@")
set(CMAKE_C23_COMPILE_FEATURES "@CMAKE_C23_COMPILE_FEATURES@")
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
+6 -3
View File
@@ -33,13 +33,16 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
#if !defined(__STDC__)
# if (defined(_MSC_VER) && !defined(__clang__)) \
|| (defined(__ibmxl__) || defined(__IBMC__))
#if !defined(__STDC__) && !defined(__clang__)
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
# define C_DIALECT "90"
# else
# define C_DIALECT
# endif
#elif __STDC_VERSION__ > 201710L
# define C_DIALECT "23"
#elif __STDC_VERSION__ >= 201710L
# define C_DIALECT "17"
#elif __STDC_VERSION__ >= 201000L
# define C_DIALECT "11"
#elif __STDC_VERSION__ >= 199901L
+16 -16
View File
@@ -9,15 +9,15 @@ endif()
set(CMAKE_INCLUDE_FLAG_CUDA "-I")
# Set implicit links early so compiler-specific modules can use them.
set(__IMPLICT_LINKS )
set(__IMPLICIT_LINKS)
foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
string(APPEND __IMPLICT_LINKS " -L\"${dir}\"")
string(APPEND __IMPLICIT_LINKS " -L\"${dir}\"")
endforeach()
foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES})
if(${lib} MATCHES "/")
string(APPEND __IMPLICT_LINKS " \"${lib}\"")
string(APPEND __IMPLICIT_LINKS " \"${lib}\"")
else()
string(APPEND __IMPLICT_LINKS " -l${lib}")
string(APPEND __IMPLICIT_LINKS " -l${lib}")
endif()
endforeach()
@@ -117,7 +117,7 @@ endif()
# create a shared library
if(NOT CMAKE_CUDA_CREATE_SHARED_LIBRARY)
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
endif()
# create a shared module copy the shared library rule by default
@@ -157,32 +157,32 @@ endif()
# compile a cu file into an executable
if(NOT CMAKE_CUDA_LINK_EXECUTABLE)
set(CMAKE_CUDA_LINK_EXECUTABLE
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
endif()
# Add implicit host link directories that contain device libraries
# to the device link line.
set(__IMPLICT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if(__IMPLICT_DLINK_DIRS)
list(REMOVE_ITEM __IMPLICT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
set(__IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if(__IMPLICIT_DLINK_DIRS)
list(REMOVE_ITEM __IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
endif()
set(__IMPLICT_DLINK_FLAGS )
foreach(dir ${__IMPLICT_DLINK_DIRS})
set(__IMPLICIT_DLINK_FLAGS)
foreach(dir ${__IMPLICIT_DLINK_DIRS})
if(EXISTS "${dir}/libcurand_static.a")
string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
string(APPEND __IMPLICIT_DLINK_FLAGS " -L\"${dir}\"")
endif()
endforeach()
unset(__IMPLICT_DLINK_DIRS)
unset(__IMPLICIT_DLINK_DIRS)
#These are used when linking relocatable (dc) cuda code
if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY)
set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}")
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_DLINK_FLAGS}")
endif()
if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE)
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}")
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_DLINK_FLAGS}")
endif()
# Used when device linking is handled by CMake.
@@ -190,6 +190,6 @@ if(NOT CMAKE_CUDA_DEVICE_LINK_COMPILE)
set(CMAKE_CUDA_DEVICE_LINK_COMPILE "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> -D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ -D__NV_EXTRA_INITIALIZATION=\"\" -D__NV_EXTRA_FINALIZATION=\"\" -DREGISTERLINKBINARYFILE=\\\"<REGISTER_FILE>\\\" -DFATBINFILE=\\\"<FATBINARY>\\\" ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c \"${CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT}/bin/crt/link.stub\" -o <OBJECT>")
endif()
unset(__IMPLICT_DLINK_FLAGS)
unset(__IMPLICIT_DLINK_FLAGS)
set(CMAKE_CUDA_INFORMATION_LOADED 1)
@@ -10,6 +10,8 @@ function(cmake_determine_compile_features lang)
set(CMAKE_C90_COMPILE_FEATURES)
set(CMAKE_C99_COMPILE_FEATURES)
set(CMAKE_C11_COMPILE_FEATURES)
set(CMAKE_C17_COMPILE_FEATURES)
set(CMAKE_C23_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@@ -20,6 +22,12 @@ function(cmake_determine_compile_features lang)
return()
endif()
if (CMAKE_C17_COMPILE_FEATURES AND CMAKE_C23_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_C23_COMPILE_FEATURES ${CMAKE_C17_COMPILE_FEATURES})
endif()
if (CMAKE_C11_COMPILE_FEATURES AND CMAKE_C17_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_C17_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES})
endif()
if (CMAKE_C99_COMPILE_FEATURES AND CMAKE_C11_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_C11_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES})
endif()
@@ -32,6 +40,8 @@ function(cmake_determine_compile_features lang)
${CMAKE_C90_COMPILE_FEATURES}
${CMAKE_C99_COMPILE_FEATURES}
${CMAKE_C11_COMPILE_FEATURES}
${CMAKE_C17_COMPILE_FEATURES}
${CMAKE_C23_COMPILE_FEATURES}
)
endif()
@@ -39,6 +49,8 @@ function(cmake_determine_compile_features lang)
set(CMAKE_C90_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_C99_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_C11_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_C17_COMPILE_FEATURES ${CMAKE_C17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_C23_COMPILE_FEATURES ${CMAKE_C23_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done")
+4 -1
View File
@@ -101,7 +101,10 @@ function(cmake_print_properties)
if(CPP_CACHE_ENTRIES)
set(items ${CPP_CACHE_ENTRIES})
set(mode ${mode} CACHE_ENTRIES)
set(keyword CACHE)
# This is a workaround for the fact that passing `CACHE` as an argument to
# set() causes a cache variable to be set.
set(keyword "")
string(APPEND keyword CACHE)
endif()
if(NOT mode)
@@ -64,6 +64,12 @@ endmacro()
# Define to allow compile features to be automatically determined
macro(cmake_record_c_compile_features)
set(_result 0)
if(_result EQUAL 0 AND DEFINED CMAKE_C23_STANDARD_COMPILE_OPTION)
_has_compiler_features_c(23)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_C17_STANDARD_COMPILE_OPTION)
_has_compiler_features_c(17)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_C11_STANDARD_COMPILE_OPTION)
if(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT)
_has_compiler_features_c(11)
+42 -19
View File
@@ -25,37 +25,60 @@ elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
endif()
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)
set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
endif()
else()
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "/std:c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "/std:c11")
set(CMAKE_C17_STANDARD_COMPILE_OPTION "/std:c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "/std:c17")
else()
# clang-cl doesn't have any of these
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
endif()
endif()
if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
__compiler_check_default_language_standard(C 3.4 99 3.6 11)
else()
set(CMAKE_C_STANDARD_DEFAULT "")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1)
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
endif()
__compiler_check_default_language_standard(C 2.1 99 3.5.2 11 11.0 17)
+2 -2
View File
@@ -22,8 +22,8 @@ set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S")
set(_CMAKE_CUDA_DEVICE_CODE "-fgpu-rdc -c")
# RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default.
set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
+11 -1
View File
@@ -36,4 +36,14 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
__compiler_check_default_language_standard(C 3.4 90 5.0 11)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1)
set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c23")
set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu23")
endif()
__compiler_check_default_language_standard(C 3.4 90 5.0 11 8.1 17)
+7 -3
View File
@@ -37,6 +37,9 @@ if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
else()
# clang-cl doesn't have any of these
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
@@ -47,12 +50,13 @@ else()
set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C17_STANDARD_COMPILE_OPTION "")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
endif()
if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
# FIXME: The compiler actually defaults to C17, but
# CMake does not yet model or detect that standard.
__compiler_check_default_language_standard(C 2020 11)
__compiler_check_default_language_standard(C 2020 17)
else()
set(CMAKE_C_STANDARD_DEFAULT "")
endif()
+8 -1
View File
@@ -1101,7 +1101,14 @@ function(_ExternalData_download_object name hash algo var_obj var_success var_er
set(success 1)
if(found)
file(RENAME "${tmp}" "${obj}")
# Atomically create the object. If we lose a race with another process,
# do not replace it. Content-addressing ensures it has what we expect.
file(RENAME "${tmp}" "${obj}" NO_REPLACE RESULT result)
if (result STREQUAL "NO_REPLACE")
file(REMOVE "${tmp}")
elseif (result)
message(FATAL_ERROR "Failed to rename:\n \"${tmp}\"\nto:\n \"${obj}\"\nwith error:\n ${result}")
endif()
message(STATUS "Downloaded object: \"${obj}\"")
elseif(EXISTS "${staged}")
set(obj "${staged}")
+12 -7
View File
@@ -34,7 +34,7 @@ The following shows a typical example of declaring content details:
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.0
GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0
)
For most typical cases, populating the content can then be done with a single
@@ -126,13 +126,13 @@ Declaring Content Details
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.0
GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0
)
FetchContent_Declare(
myCompanyIcons
URL https://intranet.mycompany.com/assets/iconset_1.12.tar.gz
URL_HASH 5588a7b18261c20068beabfb4f530b87
URL_HASH MD5=5588a7b18261c20068beabfb4f530b87
)
FetchContent_Declare(
@@ -141,6 +141,11 @@ Declaring Content Details
SVN_REVISION -r12345
)
Where contents are being fetched from a remote location and you do not
control that server, it is advisable to use a hash for ``GIT_TAG`` rather
than a branch or tag name. A commit hash is more secure and helps to
confirm that the downloaded contents are what you expected.
Populating The Content
""""""""""""""""""""""
@@ -456,12 +461,12 @@ frameworks are available to the main build:
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.0
GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0
)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.5.0
GIT_TAG de6fe184a9ac1a06895cdd1c9b437f0a0bdf14ad # v2.13.4
)
# After the following call, the CMake targets defined by googletest and
@@ -480,7 +485,7 @@ it into the main build:
FetchContent_Declare(
protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG v3.12.0
GIT_TAG ae50d9b9902526efd6c7a1907d09739f959c6297 # v3.15.0
SOURCE_SUBDIR cmake
)
set(protobuf_BUILD_TESTS OFF)
@@ -517,7 +522,7 @@ that all five projects are available on a company git server. The
FetchContent_Declare(
projE
GIT_REPOSITORY git@mycompany.com:git/projE.git
GIT_TAG origin/release/2.3-rc1
GIT_TAG v2.3-rc1
)
# Order is important, see notes in the discussion further below
+1 -1
View File
@@ -189,7 +189,7 @@ This module defines the following :prop_tgt:`IMPORTED` targets:
(adds ``-DBOOST_ALL_NO_LIB``).
``Boost::dynamic_linking``
Interface target to enable dynamic linking linking with MSVC
Interface target to enable dynamic linking with MSVC
(adds ``-DBOOST_ALL_DYN_LINK``).
Implicit dependencies such as ``Boost::filesystem`` requiring
+1
View File
@@ -395,6 +395,7 @@ Deprecated Hint Variables
#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW) # quoted if arguments
cmake_policy(SET CMP0057 NEW) # if IN_LIST
# For backwards compatibility support
+43 -1
View File
@@ -25,6 +25,24 @@ The following variables are provided to indicate iconv support:
The iconv libraries to be linked.
.. variable:: Iconv_VERSION
.. versionadded:: 3.21
The version of iconv found (x.y)
.. variable:: Iconv_VERSION_MAJOR
.. versionadded:: 3.21
The major version of iconv
.. variable:: Iconv_VERSION_MINOR
.. versionadded:: 3.21
The minor version of iconv
.. variable:: Iconv_IS_BUILT_IN
A variable indicating whether iconv support is stemming from the
@@ -51,6 +69,10 @@ The following cache variables may also be set:
On POSIX platforms, iconv might be part of the C library and the cache
variables ``Iconv_INCLUDE_DIR`` and ``Iconv_LIBRARY`` might be empty.
.. note::
Some libiconv implementations don't embed the version number in their header files.
In this case the variables ``Iconv_VERSION*`` will be empty.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
@@ -118,9 +140,29 @@ find_library(Iconv_LIBRARY
mark_as_advanced(Iconv_INCLUDE_DIR)
mark_as_advanced(Iconv_LIBRARY)
# NOTE: glibc's iconv.h does not define _LIBICONV_VERSION
if(Iconv_INCLUDE_DIR AND NOT Iconv_IS_BUILT_IN)
file(STRINGS ${Iconv_INCLUDE_DIR}/iconv.h Iconv_VERSION_DEFINE REGEX "_LIBICONV_VERSION (.*)")
if(Iconv_VERSION_DEFINE MATCHES "(0x[A-Fa-f0-9]+)")
set(Iconv_VERSION_NUMBER "${CMAKE_MATCH_1}")
# encoding -> version number: (major<<8) + minor
math(EXPR Iconv_VERSION_MAJOR "${Iconv_VERSION_NUMBER} >> 8" OUTPUT_FORMAT HEXADECIMAL)
math(EXPR Iconv_VERSION_MINOR "${Iconv_VERSION_NUMBER} - (${Iconv_VERSION_MAJOR} << 8)" OUTPUT_FORMAT HEXADECIMAL)
math(EXPR Iconv_VERSION_MAJOR "${Iconv_VERSION_MAJOR}" OUTPUT_FORMAT DECIMAL)
math(EXPR Iconv_VERSION_MINOR "${Iconv_VERSION_MINOR}" OUTPUT_FORMAT DECIMAL)
set(Iconv_VERSION "${Iconv_VERSION_MAJOR}.${Iconv_VERSION_MINOR}")
endif()
unset(Iconv_VERSION_DEFINE)
unset(Iconv_VERSION_NUMBER)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
if(NOT Iconv_IS_BUILT_IN)
find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY Iconv_INCLUDE_DIR)
find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY Iconv_INCLUDE_DIR
VERSION_VAR Iconv_VERSION)
else()
find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY)
endif()
+96 -21
View File
@@ -10,27 +10,75 @@ FindIntl
Find the Gettext libintl headers and libraries.
This module reports information about the Gettext libintl
installation in several variables. General variables::
installation in several variables.
Intl_FOUND - true if the libintl headers and libraries were found
Intl_INCLUDE_DIRS - the directory containing the libintl headers
Intl_LIBRARIES - libintl libraries to be linked
.. variable:: Intl_FOUND
True if libintl is found.
.. variable:: Intl_INCLUDE_DIRS
The directory containing the libintl headers.
.. variable:: Intl_LIBRARIES
The intl libraries to be linked.
.. variable:: Intl_VERSION
.. versionadded:: 3.21
The version of intl found (x.y.z)
.. variable:: Intl_VERSION_MAJOR
.. versionadded:: 3.21
The major version of intl
.. variable:: Intl_VERSION_MINOR
.. versionadded:: 3.21
The minor version of intl
.. variable:: Intl_VERSION_PATCH
.. versionadded:: 3.21
The patch version of intl
.. versionadded:: 3.20
This module defines :prop_tgt:`IMPORTED` target ``Intl::Intl``.
The following cache variables may also be set::
The following cache variables may also be set:
Intl_INCLUDE_DIR - the directory containing the libintl headers
Intl_LIBRARY - the libintl library (if any)
Intl_HAVE_GETTEXT_BUILTIN - check if gettext is in the C library
Intl_HAVE_DCGETTEXT_BUILTIN - check if dcgettext is in the C library
Intl_IS_BUILTIN - whether intl is a part of the C library determined
from the result of Intl_HAVE_GETTEXT_BUILTIN and Intl_HAVE_DCGETTEXT_BUILTIN
.. variable:: Intl_INCLUDE_DIR
.. versionadded:: 3.20
Added the ``Intl_HAVE_GETTEXT_BUILTIN``, ``Intl_HAVE_DCGETTEXT_BUILTIN`` and
``Intl_IS_BUILTIN`` variables.
The directory containing the libintl headers
.. variable:: Intl_LIBRARY
The libintl library (if any)
.. variable:: Intl_HAVE_GETTEXT_BUILTIN
.. versionadded:: 3.20
True if gettext is in the C library
.. variable:: Intl_HAVE_DCGETTEXT_BUILTIN
.. versionadded:: 3.20
True if dcgettext is in the C library
.. variable:: Intl_IS_BUILTIN
.. versionadded:: 3.20
whether intl is a part of the C library determined from the result of
Intl_HAVE_GETTEXT_BUILTIN and Intl_HAVE_DCGETTEXT_BUILTIN
.. note::
On some platforms, such as Linux with GNU libc, the gettext
@@ -38,6 +86,10 @@ The following cache variables may also be set::
is not required. ``Intl_LIBRARIES`` will be empty in this
case.
.. note::
Some libintl implementations don't embed the version number in their header files.
In this case the variables ``Intl_VERSION*`` will be empty.
.. note::
If you wish to use the Gettext tools (``msgmerge``,
``msgfmt``, etc.), use :module:`FindGettext`.
@@ -69,20 +121,43 @@ find_path(Intl_INCLUDE_DIR
mark_as_advanced(Intl_INCLUDE_DIR)
# Find all Intl libraries
set(Intl_REQUIRED_VARS)
if(NOT Intl_IS_BUILTIN)
find_library(Intl_LIBRARY "intl" "libintl" NAMES_PER_DIR
DOC "libintl libraries (if not in the C library)")
mark_as_advanced(Intl_LIBRARY)
list(APPEND Intl_REQUIRED_VARS Intl_LIBRARY)
set(Intl_LIBRARY_NAMES "intl" "libintl")
else()
set(Intl_LIBRARY_NAMES "c")
endif()
find_library(Intl_LIBRARY ${Intl_LIBRARY_NAMES} NAMES_PER_DIR
DOC "intl library (potentially the C library)")
mark_as_advanced(Intl_LIBRARY)
# NOTE: glibc's libintl.h does not define LIBINTL_VERSION
if(Intl_INCLUDE_DIR AND NOT Intl_IS_BUILTIN)
file(STRINGS ${Intl_INCLUDE_DIR}/libintl.h Intl_VERSION_DEFINE REGEX "LIBINTL_VERSION (.*)")
if(Intl_VERSION_DEFINE MATCHES "(0x[A-Fa-f0-9]+)")
set(Intl_VERSION_NUMBER "${CMAKE_MATCH_1}")
# encoding -> version number: (major<<16) + (minor<<8) + patch
math(EXPR Intl_VERSION_MAJOR "${Intl_VERSION_NUMBER} >> 16" OUTPUT_FORMAT HEXADECIMAL)
math(EXPR Intl_VERSION_MINOR "(${Intl_VERSION_NUMBER} - (${Intl_VERSION_MAJOR} << 16)) >> 8" OUTPUT_FORMAT HEXADECIMAL)
math(EXPR Intl_VERSION_PATCH "${Intl_VERSION_NUMBER} - ((${Intl_VERSION_MAJOR} << 16) + (${Intl_VERSION_MINOR} << 8))" OUTPUT_FORMAT HEXADECIMAL)
math(EXPR Intl_VERSION_MAJOR "${Intl_VERSION_MAJOR}" OUTPUT_FORMAT DECIMAL)
math(EXPR Intl_VERSION_MINOR "${Intl_VERSION_MINOR}" OUTPUT_FORMAT DECIMAL)
math(EXPR Intl_VERSION_PATCH "${Intl_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL)
set(Intl_VERSION "${Intl_VERSION_MAJOR}.${Intl_VERSION_MINOR}.${Intl_VERSION_PATCH}")
endif()
unset(Intl_VERSION_DEFINE)
unset(Intl_VERSION_NUMBER)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
FOUND_VAR Intl_FOUND
REQUIRED_VARS Intl_INCLUDE_DIR ${Intl_REQUIRED_VARS}
REQUIRED_VARS Intl_LIBRARY Intl_INCLUDE_DIR
VERSION_VAR Intl_VERSION
FAIL_MESSAGE "Failed to find Gettext libintl")
unset(Intl_REQUIRED_VARS)
if(Intl_FOUND)
set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
+11 -8
View File
@@ -6,14 +6,17 @@ configure_file(${FortranCInterface_SOURCE_DIR}/Input.cmake.in
# Detect the Fortran/C interface on the first run or when the
# configuration changes.
if(${FortranCInterface_BINARY_DIR}/Input.cmake
IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
OR ${FortranCInterface_SOURCE_DIR}/Output.cmake.in
IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
OR ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt
IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
OR ${CMAKE_CURRENT_LIST_FILE}
IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
if(NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake
OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Input.cmake
OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake.in
OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Input.cmake
OR NOT ${FortranCInterface_SOURCE_DIR}/Output.cmake
IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake.in
OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt
OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
IS_NEWER_THAN ${CMAKE_CURRENT_LIST_FILE}
)
message(CHECK_START "Detecting Fortran/C Interface")
else()
+2 -1
View File
@@ -504,7 +504,8 @@ function(gtest_discover_tests TARGET)
string(CONCAT ctest_include_content
"if(EXISTS \"$<TARGET_FILE:${TARGET}>\")" "\n"
" if(\"$<TARGET_FILE:${TARGET}>\" IS_NEWER_THAN \"${ctest_tests_file}\")" "\n"
" if(NOT EXISTS \"${ctest_tests_file}\" OR" "\n"
" NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"$<TARGET_FILE:${TARGET}>\")" "\n"
" include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n"
" gtest_discover_tests_impl(" "\n"
" TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n"
+6 -6
View File
@@ -1,19 +1,19 @@
include(Platform/Darwin)
set(__IMPLICT_LINKS )
set(__IMPLICIT_LINKS)
foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
string(APPEND __IMPLICT_LINKS " -L\"${dir}\"")
string(APPEND __IMPLICIT_LINKS " -L\"${dir}\"")
endforeach()
foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES})
if(${lib} MATCHES "/")
string(APPEND __IMPLICT_LINKS " \"${lib}\"")
string(APPEND __IMPLICIT_LINKS " \"${lib}\"")
else()
string(APPEND __IMPLICT_LINKS " -l${lib}")
string(APPEND __IMPLICIT_LINKS " -l${lib}")
endif()
endforeach()
set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_MODULE "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_MODULE "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
+17 -25
View File
@@ -7,49 +7,49 @@ set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
set(__IMPLICT_LINKS )
set(__IMPLICIT_LINKS)
foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
string(APPEND __IMPLICT_LINKS " -LIBPATH:\"${dir}\"")
string(APPEND __IMPLICIT_LINKS " -LIBPATH:\"${dir}\"")
endforeach()
foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES})
string(APPEND __IMPLICT_LINKS " \"${lib}\"")
string(APPEND __IMPLICIT_LINKS " \"${lib}\"")
endforeach()
set(CMAKE_CUDA_LINK_EXECUTABLE
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}")
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICIT_LINKS} ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CUDA_CREATE_SHARED_MODULE ${CMAKE_CUDA_CREATE_SHARED_LIBRARY})
set(CMAKE_CUDA_CREATE_STATIC_LIBRARY "<CMAKE_AR> ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
set(CMAKE_CUDA_LINKER_SUPPORTS_PDB ON)
set(CMAKE_CUDA_LINK_EXECUTABLE
"${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}")
unset(_CMAKE_VS_LINK_EXE)
"${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICIT_LINKS} ${CMAKE_END_TEMP_FILE}")
unset(_CMAKE_VS_LINK_DLL)
unset(_CMAKE_VS_LINK_EXE)
# Add implicit host link directories that contain device libraries
# to the device link line.
set(__IMPLICT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if(__IMPLICT_DLINK_DIRS)
list(REMOVE_ITEM __IMPLICT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
set(__IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if(__IMPLICIT_DLINK_DIRS)
list(REMOVE_ITEM __IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
endif()
set(__IMPLICT_DLINK_FLAGS )
foreach(dir ${__IMPLICT_DLINK_DIRS})
set(__IMPLICIT_DLINK_FLAGS)
foreach(dir ${__IMPLICIT_DLINK_DIRS})
if(EXISTS "${dir}/curand_static.lib")
string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
string(APPEND __IMPLICIT_DLINK_FLAGS " -L\"${dir}\"")
endif()
endforeach()
unset(__IMPLICT_DLINK_DIRS)
unset(__IMPLICIT_DLINK_DIRS)
set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}")
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICIT_DLINK_FLAGS}")
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}")
unset(__IMPLICT_DLINK_FLAGS)
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICIT_DLINK_FLAGS}")
unset(__IMPLICIT_DLINK_FLAGS)
string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
@@ -69,14 +69,6 @@ else()
endif()
unset(_cmp0092)
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
if(UNIX)
list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
endif()
string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"")
string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"${_MDd}-Zi -Ob0 -Od ${_RTC1}\"")
string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"${_MD}-O2 -Ob2\" -DNDEBUG")
+8 -15
View File
@@ -338,20 +338,11 @@ as well as ``SWIG``:
initialized with the value of this variable.
#]=======================================================================]
cmake_policy(GET CMP0078 target_name_policy)
cmake_policy(GET CMP0086 module_name_policy)
cmake_policy (VERSION 3.12)
if (target_name_policy)
# respect user choice regarding CMP0078 policy
cmake_policy(SET CMP0078 ${target_name_policy})
endif()
if (module_name_policy)
# respect user choice regarding CMP0086 policy
cmake_policy(SET CMP0086 ${module_name_policy})
endif()
unset(target_name_policy)
unset(module_name_policy)
cmake_policy(PUSH)
# numbers and boolean constants
cmake_policy (SET CMP0012 NEW)
# IN_LIST operator
cmake_policy (SET CMP0057 NEW)
set(SWIG_CXX_EXTENSION "cxx")
set(SWIG_EXTRA_LIBRARIES "")
@@ -911,7 +902,7 @@ function(SWIG_ADD_LIBRARY name)
if (APPLE)
set_target_properties (${target_name} PROPERTIES SUFFIX ".jnilib")
endif()
if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL MSYS)
if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL "MSYS")
set_target_properties(${target_name} PROPERTIES PREFIX "")
endif()
elseif (swig_lowercase_language STREQUAL "lua")
@@ -1007,3 +998,5 @@ function(SWIG_LINK_LIBRARIES name)
endif()
endif()
endfunction()
cmake_policy(POP)
-2
View File
@@ -785,8 +785,6 @@ if (WIN32)
cmVisualStudioGeneratorOptions.cxx
cmVisualStudio10TargetGenerator.h
cmVisualStudio10TargetGenerator.cxx
cmVisualStudio10ToolsetOptions.h
cmVisualStudio10ToolsetOptions.cxx
cmLocalVisualStudio10Generator.cxx
cmLocalVisualStudio10Generator.h
cmGlobalVisualStudio10Generator.h
+2 -2
View File
@@ -1,8 +1,8 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 20)
set(CMake_VERSION_PATCH 0)
set(CMake_VERSION_RC 4)
set(CMake_VERSION_PATCH 20210316)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
# Start with the full version number used in tags. It has no dev info.
+6 -1
View File
@@ -273,6 +273,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
? this->GetOption("CPACK_DMG_FORMAT")
: "UDZO";
const std::string cpack_dmg_filesystem =
this->GetOption("CPACK_DMG_FILESYSTEM")
? this->GetOption("CPACK_DMG_FILESYSTEM")
: "HFS+";
// Get optional arguments ...
std::string cpack_license_file =
this->GetOption("CPACK_RESOURCE_FILE_LICENSE")
@@ -418,7 +423,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
temp_image_command << " -ov";
temp_image_command << " -srcfolder \"" << staging.str() << "\"";
temp_image_command << " -volname \"" << cpack_dmg_volume_name << "\"";
temp_image_command << " -fs HFS+";
temp_image_command << " -fs \"" << cpack_dmg_filesystem << "\"";
temp_image_command << " -format " << temp_image_format;
temp_image_command << " \"" << temp_image << "\"";
+2 -1
View File
@@ -384,7 +384,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
for (std::string const& gf : this->files) {
bool skip = false;
std::string inFile = gf;
if (cmSystemTools::FileIsDirectory(gf)) {
if (cmSystemTools::FileIsDirectory(gf) &&
!cmSystemTools::FileIsSymlink(gf)) {
inFile += '/';
}
for (cmsys::RegularExpression& reg : ignoreFilesRegex) {
+3 -1
View File
@@ -430,7 +430,9 @@ int cmCPackNSISGenerator::InitializeInternal()
}
#endif
nsisPath = cmSystemTools::FindProgram("makensis", path, false);
this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLE", "makensis");
nsisPath = cmSystemTools::FindProgram(
this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false);
if (nsisPath.empty()) {
cmCPackLogger(
+24 -1
View File
@@ -57,7 +57,7 @@ using TestPreset = cmCMakePresetsFile::TestPreset;
using ArchToolsetStrategy = cmCMakePresetsFile::ArchToolsetStrategy;
constexpr int MIN_VERSION = 1;
constexpr int MAX_VERSION = 2;
constexpr int MAX_VERSION = 3;
struct CMakeVersion
{
@@ -327,6 +327,8 @@ auto const ConfigurePresetHelper =
.Bind("toolset"_s, ToolsetHelper, false)
.Bind("binaryDir"_s, &ConfigurePreset::BinaryDir, PresetStringHelper,
false)
.Bind("installDir"_s, &ConfigurePreset::InstallDir, PresetStringHelper,
false)
.Bind<std::string>("cmakeExecutable"_s, nullptr, PresetStringHelper, false)
.Bind("cacheVariables"_s, &ConfigurePreset::CacheVariables,
VariablesHelper, false)
@@ -872,6 +874,17 @@ bool ExpandMacros(const cmCMakePresetsFile& file,
out->BinaryDir = cmSystemTools::CollapseFullPath(binaryDir);
cmSystemTools::ConvertToUnixSlashes(out->BinaryDir);
if (!preset.InstallDir.empty()) {
std::string installDir = preset.InstallDir;
CHECK_EXPAND(out, installDir, macroExpanders)
if (!cmSystemTools::FileIsFullPath(installDir)) {
installDir = cmStrCat(file.SourceDir, '/', installDir);
}
out->InstallDir = cmSystemTools::CollapseFullPath(installDir);
cmSystemTools::ConvertToUnixSlashes(out->InstallDir);
}
for (auto& variable : out->CacheVariables) {
if (variable.second) {
CHECK_EXPAND(out, variable.second->Value, macroExpanders)
@@ -1174,6 +1187,7 @@ cmCMakePresetsFile::ConfigurePreset::VisitPresetInherit(
preset.ToolsetStrategy = parent.ToolsetStrategy;
}
InheritString(preset.BinaryDir, parent.BinaryDir);
InheritString(preset.InstallDir, parent.InstallDir);
InheritOptionalValue(preset.WarnDev, parent.WarnDev);
InheritOptionalValue(preset.ErrorDev, parent.ErrorDev);
InheritOptionalValue(preset.WarnDeprecated, parent.WarnDeprecated);
@@ -1510,6 +1524,9 @@ const char* cmCMakePresetsFile::ResultToString(ReadFileResult result)
"support.";
case ReadFileResult::INVALID_CONFIGURE_PRESET:
return "Invalid \"configurePreset\" field";
case ReadFileResult::INSTALL_PREFIX_UNSUPPORTED:
return "File version must be 3 or higher for installDir preset "
"support.";
}
return "Unknown error";
@@ -1579,6 +1596,12 @@ cmCMakePresetsFile::ReadFileResult cmCMakePresetsFile::ReadJSONFile(
.second) {
return ReadFileResult::DUPLICATE_PRESETS;
}
// Support for installDir presets added in version 3.
if (v < 3 && !preset.InstallDir.empty()) {
return ReadFileResult::INSTALL_PREFIX_UNSUPPORTED;
}
this->ConfigurePresetOrder.push_back(preset.Name);
}
+2
View File
@@ -33,6 +33,7 @@ public:
INVALID_MACRO_EXPANSION,
BUILD_TEST_PRESETS_UNSUPPORTED,
INVALID_CONFIGURE_PRESET,
INSTALL_PREFIX_UNSUPPORTED,
};
enum class ArchToolsetStrategy
@@ -103,6 +104,7 @@ public:
std::string Toolset;
cm::optional<ArchToolsetStrategy> ToolsetStrategy;
std::string BinaryDir;
std::string InstallDir;
std::map<std::string, cm::optional<CacheVariable>> CacheVariables;
+4
View File
@@ -110,6 +110,10 @@ struct cmCommandLineArgument
}
}
if (parseState == ParseMode::Valid) {
if (possible_value[0] == ' ') {
possible_value.remove_prefix(1);
}
parseState = this->StoreCall(std::string(possible_value),
std::forward<CallState>(state)...)
? ParseMode::Valid
+19
View File
@@ -701,6 +701,10 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
this->AddTargetItem(lib, tgt);
this->AddLibraryRuntimeInfo(lib.Value, tgt);
if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
this->Target->IsDLLPlatform()) {
this->AddRuntimeDLL(tgt);
}
}
} else {
// This is not a CMake target. Use the name given.
@@ -728,6 +732,13 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
void cmComputeLinkInformation::AddSharedDepItem(BT<std::string> const& item,
const cmGeneratorTarget* tgt)
{
// Record dependencies on DLLs.
if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
this->Target->IsDLLPlatform() &&
this->SharedDependencyMode != SharedDepModeLink) {
this->AddRuntimeDLL(tgt);
}
// If dropping shared library dependencies, ignore them.
if (this->SharedDependencyMode == SharedDepModeNone) {
return;
@@ -799,6 +810,14 @@ void cmComputeLinkInformation::AddSharedDepItem(BT<std::string> const& item,
}
}
void cmComputeLinkInformation::AddRuntimeDLL(cmGeneratorTarget const* tgt)
{
if (std::find(this->RuntimeDLLs.begin(), this->RuntimeDLLs.end(), tgt) ==
this->RuntimeDLLs.end()) {
this->RuntimeDLLs.emplace_back(tgt);
}
}
void cmComputeLinkInformation::ComputeLinkTypeInfo()
{
// Check whether archives may actually be shared libraries.
+6
View File
@@ -64,6 +64,10 @@ public:
std::string GetRPathString(bool for_install) const;
std::string GetChrpathString() const;
std::set<cmGeneratorTarget const*> const& GetSharedLibrariesLinked() const;
std::vector<cmGeneratorTarget const*> const& GetRuntimeDLLs() const
{
return this->RuntimeDLLs;
}
std::string const& GetLibLinkFileFlag() const
{
@@ -81,6 +85,7 @@ private:
void AddItem(BT<std::string> const& item, const cmGeneratorTarget* tgt);
void AddSharedDepItem(BT<std::string> const& item,
cmGeneratorTarget const* tgt);
void AddRuntimeDLL(cmGeneratorTarget const* tgt);
// Output information.
ItemVector Items;
@@ -89,6 +94,7 @@ private:
std::vector<std::string> FrameworkPaths;
std::vector<std::string> RuntimeSearchPath;
std::set<cmGeneratorTarget const*> SharedLibrariesLinked;
std::vector<cmGeneratorTarget const*> RuntimeDLLs;
// Context information.
cmGeneratorTarget const* const Target;
+8 -3
View File
@@ -90,10 +90,15 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
std::replace(func_name.begin(), func_name.end(), ' ', '_');
std::replace(func_name.begin(), func_name.end(), '/', '_');
std::replace(func_name.begin(), func_name.end(), ':', '_');
bool already_declared =
std::find(tests_func_name.begin(), tests_func_name.end(), func_name) !=
tests_func_name.end();
tests_func_name.push_back(func_name);
forwardDeclareCode += "int ";
forwardDeclareCode += func_name;
forwardDeclareCode += "(int, char*[]);\n";
if (!already_declared) {
forwardDeclareCode += "int ";
forwardDeclareCode += func_name;
forwardDeclareCode += "(int, char*[]);\n";
}
}
std::string functionMapCode;
+2 -2
View File
@@ -924,13 +924,13 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
// Isolate the file policy level.
// Support CMake versions as far back as 2.6 but also support using NEW
// policy settings for up to CMake 3.18 (this upper limit may be reviewed
// policy settings for up to CMake 3.19 (this upper limit may be reviewed
// and increased from time to time). This reduces the opportunity for CMake
// warnings when an older export file is later used with newer CMake
// versions.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
<< "cmake_policy(VERSION 2.6...3.18)\n";
<< "cmake_policy(VERSION 2.6...3.19)\n";
/* clang-format on */
}
+2 -1
View File
@@ -435,7 +435,8 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes(
lg->GetIncludeDirectories(includes, target, language, config);
std::string includesString =
lg->GetIncludeFlags(includes, target, language, true, false, config);
lg->GetIncludeFlags(includes, target, language, config, false,
cmLocalGenerator::IncludePathStyle::Absolute);
return includesString;
}
+139 -7
View File
@@ -1313,8 +1313,9 @@ bool HandleRelativePathCommand(std::vector<std::string> const& args,
bool HandleRename(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
if (args.size() != 3) {
status.SetError("RENAME given incorrect number of arguments.");
if (args.size() < 3) {
status.SetError("RENAME must be called with at least two additional "
"arguments");
return false;
}
@@ -1330,13 +1331,143 @@ bool HandleRename(std::vector<std::string> const& args,
cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', args[2]);
}
if (!cmSystemTools::RenameFile(oldname, newname)) {
std::string err = cmSystemTools::GetLastSystemError();
status.SetError(cmStrCat("RENAME failed to rename\n ", oldname,
"\nto\n ", newname, "\nbecause: ", err, "\n"));
struct Arguments
{
bool NoReplace = false;
std::string Result;
};
static auto const parser = cmArgumentParser<Arguments>{}
.Bind("NO_REPLACE"_s, &Arguments::NoReplace)
.Bind("RESULT"_s, &Arguments::Result);
std::vector<std::string> unconsumedArgs;
Arguments const arguments =
parser.Parse(cmMakeRange(args).advance(3), &unconsumedArgs);
if (!unconsumedArgs.empty()) {
status.SetError("RENAME unknown argument:\n " + unconsumedArgs.front());
return false;
}
return true;
std::string err;
switch (cmSystemTools::RenameFile(oldname, newname,
arguments.NoReplace
? cmSystemTools::Replace::No
: cmSystemTools::Replace::Yes,
&err)) {
case cmSystemTools::RenameResult::Success:
if (!arguments.Result.empty()) {
status.GetMakefile().AddDefinition(arguments.Result, "0");
}
return true;
case cmSystemTools::RenameResult::NoReplace:
if (!arguments.Result.empty()) {
err = "NO_REPLACE";
} else {
err = "path not replaced";
}
CM_FALLTHROUGH;
case cmSystemTools::RenameResult::Failure:
if (!arguments.Result.empty()) {
status.GetMakefile().AddDefinition(arguments.Result, err);
return true;
}
break;
}
status.SetError(cmStrCat("RENAME failed to rename\n ", oldname, "\nto\n ",
newname, "\nbecause: ", err, "\n"));
return false;
}
bool HandleCopyFile(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
if (args.size() < 3) {
status.SetError("COPY_FILE must be called with at least two additional "
"arguments");
return false;
}
// Compute full path for old and new names.
std::string oldname = args[1];
if (!cmsys::SystemTools::FileIsFullPath(oldname)) {
oldname =
cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', args[1]);
}
std::string newname = args[2];
if (!cmsys::SystemTools::FileIsFullPath(newname)) {
newname =
cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', args[2]);
}
struct Arguments
{
bool OnlyIfDifferent = false;
std::string Result;
};
static auto const parser =
cmArgumentParser<Arguments>{}
.Bind("ONLY_IF_DIFFERENT"_s, &Arguments::OnlyIfDifferent)
.Bind("RESULT"_s, &Arguments::Result);
std::vector<std::string> unconsumedArgs;
Arguments const arguments =
parser.Parse(cmMakeRange(args).advance(3), &unconsumedArgs);
if (!unconsumedArgs.empty()) {
status.SetError("COPY_FILE unknown argument:\n " +
unconsumedArgs.front());
return false;
}
bool result = true;
if (cmsys::SystemTools::FileIsDirectory(oldname)) {
if (!arguments.Result.empty()) {
status.GetMakefile().AddDefinition(arguments.Result,
"cannot copy a directory");
} else {
status.SetError(
cmStrCat("COPY_FILE cannot copy a directory\n ", oldname));
result = false;
}
return result;
}
if (cmsys::SystemTools::FileIsDirectory(newname)) {
if (!arguments.Result.empty()) {
status.GetMakefile().AddDefinition(arguments.Result,
"cannot copy to a directory");
} else {
status.SetError(
cmStrCat("COPY_FILE cannot copy to a directory\n ", newname));
result = false;
}
return result;
}
cmSystemTools::CopyWhen when;
if (arguments.OnlyIfDifferent) {
when = cmSystemTools::CopyWhen::OnlyIfDifferent;
} else {
when = cmSystemTools::CopyWhen::Always;
}
std::string err;
if (cmSystemTools::CopySingleFile(oldname, newname, when, &err) ==
cmSystemTools::CopyResult::Success) {
if (!arguments.Result.empty()) {
status.GetMakefile().AddDefinition(arguments.Result, "0");
}
} else {
if (!arguments.Result.empty()) {
status.GetMakefile().AddDefinition(arguments.Result, err);
} else {
status.SetError(cmStrCat("COPY_FILE failed to copy\n ", oldname,
"\nto\n ", newname, "\nbecause: ", err, "\n"));
result = false;
}
}
return result;
}
bool HandleRemoveImpl(std::vector<std::string> const& args, bool recurse,
@@ -3569,6 +3700,7 @@ bool cmFileCommand(std::vector<std::string> const& args,
{ "GLOB_RECURSE"_s, HandleGlobRecurseCommand },
{ "MAKE_DIRECTORY"_s, HandleMakeDirectoryCommand },
{ "RENAME"_s, HandleRename },
{ "COPY_FILE"_s, HandleCopyFile },
{ "REMOVE"_s, HandleRemove },
{ "REMOVE_RECURSE"_s, HandleRemoveRecurse },
{ "COPY"_s, HandleCopyCommand },
+53 -2
View File
@@ -14,6 +14,7 @@
#include <utility>
#include <cm/iterator>
#include <cm/optional>
#include <cm/string_view>
#include <cm/vector>
#include <cmext/algorithm>
@@ -23,6 +24,7 @@
#include "cmsys/String.h"
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorExpressionDAGChecker.h"
@@ -1627,8 +1629,8 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
type != cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but is not an allowed library types (EXECUTABLE, "
<< "STATIC, SHARED, MODULE, OBJECT).";
<< "\" referenced but is not one of the allowed target types "
<< "(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT).";
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
@@ -1687,6 +1689,54 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
}
} targetObjectsNode;
static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode
{
TargetRuntimeDllsNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::string tgtName = parameters.front();
cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
if (!gt) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but no such target exists.";
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
cmStateEnums::TargetType type = gt->GetType();
if (type != cmStateEnums::EXECUTABLE &&
type != cmStateEnums::SHARED_LIBRARY &&
type != cmStateEnums::MODULE_LIBRARY) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but is not one of the allowed target types "
<< "(EXECUTABLE, SHARED, MODULE).";
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
if (auto* cli = gt->GetLinkInformation(context->Config)) {
std::vector<std::string> dllPaths;
auto const& dlls = cli->GetRuntimeDLLs();
for (auto const& dll : dlls) {
if (auto loc = dll->MaybeGetLocation(context->Config)) {
dllPaths.emplace_back(*loc);
}
}
return cmJoin(dllPaths, ";");
}
return "";
}
} targetRuntimeDllsNode;
static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
{
CompileFeaturesNode() {} // NOLINT(modernize-use-equals-default)
@@ -2603,6 +2653,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
{ "TARGET_EXISTS", &targetExistsNode },
{ "TARGET_NAME_IF_EXISTS", &targetNameIfExistsNode },
{ "TARGET_GENEX_EVAL", &targetGenexEvalNode },
{ "TARGET_RUNTIME_DLLS", &targetRuntimeDllsNode },
{ "GENEX_EVAL", &genexEvalNode },
{ "BUILD_INTERFACE", &buildInterfaceNode },
{ "INSTALL_INTERFACE", &installInterfaceNode },
+14
View File
@@ -1062,6 +1062,20 @@ const std::string& cmGeneratorTarget::GetLocation(
return location;
}
cm::optional<std::string> cmGeneratorTarget::MaybeGetLocation(
std::string const& config) const
{
cm::optional<std::string> location;
if (cmGeneratorTarget::ImportInfo const* imp = this->GetImportInfo(config)) {
if (!imp->Location.empty()) {
location = imp->Location;
}
} else {
location = this->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
}
return location;
}
std::vector<cmCustomCommand> const& cmGeneratorTarget::GetPreBuildCommands()
const
{
+5
View File
@@ -14,6 +14,8 @@
#include <utility>
#include <vector>
#include <cm/optional>
#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmPolicies.h"
@@ -50,6 +52,9 @@ public:
bool CanCompileSources() const;
const std::string& GetLocation(const std::string& config) const;
/** Get the full path to the target's main artifact, if known. */
cm::optional<std::string> MaybeGetLocation(std::string const& config) const;
std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
std::vector<cmCustomCommand> const& GetPreLinkCommands() const;
std::vector<cmCustomCommand> const& GetPostBuildCommands() const;
+57 -8
View File
@@ -9,6 +9,7 @@
#include <cm/iterator>
#include <cm/memory>
#include <cm/string_view>
#include <cmext/algorithm>
#include <cmext/memory>
@@ -503,14 +504,7 @@ std::unique_ptr<cmLocalGenerator> cmGlobalNinjaGenerator::CreateLocalGenerator(
codecvt::Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const
{
#ifdef _WIN32
// Ninja on Windows does not support non-ANSI characters.
// https://github.com/ninja-build/ninja/issues/1195
return codecvt::ANSI;
#else
// No encoding conversion needed on other platforms.
return codecvt::None;
#endif
return this->NinjaExpectedEncoding;
}
void cmGlobalNinjaGenerator::GetDocumentation(cmDocumentationEntry& entry)
@@ -731,6 +725,61 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
this->NinjaSupportsMetadataOnRegeneration = !cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
RequiredNinjaVersionForMetadataOnRegeneration().c_str());
#ifdef _WIN32
this->NinjaSupportsCodePage = !cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
RequiredNinjaVersionForCodePage().c_str());
if (this->NinjaSupportsCodePage) {
this->CheckNinjaCodePage();
} else {
this->NinjaExpectedEncoding = codecvt::ANSI;
}
#endif
}
void cmGlobalNinjaGenerator::CheckNinjaCodePage()
{
std::vector<std::string> command{ this->NinjaCommand, "-t", "wincodepage" };
std::string output;
std::string error;
int result;
if (!cmSystemTools::RunSingleCommand(command, &output, &error, &result,
nullptr, cmSystemTools::OUTPUT_NONE)) {
this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR,
cmStrCat("Running\n '",
cmJoin(command, "' '"),
"'\n"
"failed with:\n ",
error));
cmSystemTools::SetFatalErrorOccured();
} else if (result == 0) {
std::istringstream outputStream(output);
std::string line;
bool found = false;
while (cmSystemTools::GetLineFromStream(outputStream, line)) {
if (cmHasLiteralPrefix(line, "Build file encoding: ")) {
cm::string_view lineView(line);
cm::string_view encoding =
lineView.substr(cmStrLen("Build file encoding: "));
if (encoding == "UTF-8") {
// Ninja expects UTF-8. We use that internally. No conversion needed.
this->NinjaExpectedEncoding = codecvt::None;
} else {
this->NinjaExpectedEncoding = codecvt::ANSI;
}
found = true;
break;
}
}
if (!found) {
this->GetCMakeInstance()->IssueMessage(
MessageType::WARNING,
"Could not determine Ninja's code page, defaulting to UTF-8");
this->NinjaExpectedEncoding = codecvt::None;
}
} else {
this->NinjaExpectedEncoding = codecvt::ANSI;
}
}
bool cmGlobalNinjaGenerator::CheckLanguages(
+5
View File
@@ -388,6 +388,7 @@ public:
{
return "1.10.2";
}
static std::string RequiredNinjaVersionForCodePage() { return "1.11"; }
bool SupportsConsolePool() const;
bool SupportsImplicitOuts() const;
bool SupportsManifestRestat() const;
@@ -474,6 +475,7 @@ private:
std::string GetEditCacheCommand() const override;
bool FindMakeProgram(cmMakefile* mf) override;
void CheckNinjaFeatures();
void CheckNinjaCodePage();
bool CheckLanguages(std::vector<std::string> const& languages,
cmMakefile* mf) const override;
bool CheckFortran(cmMakefile* mf) const;
@@ -568,6 +570,9 @@ private:
bool NinjaSupportsUnconditionalRecompactTool = false;
bool NinjaSupportsMultipleOutputs = false;
bool NinjaSupportsMetadataOnRegeneration = false;
bool NinjaSupportsCodePage = false;
codecvt::Encoding NinjaExpectedEncoding = codecvt::None;
bool DiagnosedCxxModuleSupport = false;
+194 -83
View File
@@ -1349,137 +1349,248 @@ static cmIDEFlagTable const* cmLoadFlagTableJson(
return ret;
}
static std::string cmGetFlagTableName(std::string const& toolsetName,
std::string const& table)
cm::optional<std::string> cmGlobalVisualStudio10Generator::FindFlagTable(
cm::string_view toolsetName, cm::string_view table) const
{
return cmSystemTools::GetCMakeRoot() + "/Templates/MSBuild/FlagTables/" +
toolsetName + "_" + table + ".json";
std::string fullPath =
cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/MSBuild/FlagTables/",
toolsetName, '_', table, ".json");
if (cmSystemTools::FileExists(fullPath)) {
return fullPath;
}
return {};
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
std::string const& optionsName, std::string const& toolsetName,
std::string const& defaultName, std::string const& table) const
std::string const& toolSpecificName, std::string const& defaultName,
std::string const& table) const
{
cmIDEFlagTable const* ret = nullptr;
cmMakefile* mf = this->GetCurrentMakefile();
std::string filename;
if (!optionsName.empty()) {
filename = cmGetFlagTableName(optionsName, table);
ret = cmLoadFlagTableJson(filename);
} else {
filename = cmGetFlagTableName(toolsetName, table);
if (cmSystemTools::FileExists(filename)) {
ret = cmLoadFlagTableJson(filename);
if (!toolSpecificName.empty()) {
if (cm::optional<std::string> found =
this->FindFlagTable(toolSpecificName, table)) {
filename = std::move(*found);
} else {
filename = cmGetFlagTableName(defaultName, table);
ret = cmLoadFlagTableJson(filename);
mf->IssueMessage(MessageType::FATAL_ERROR,
cmStrCat("JSON flag table for ", table,
" not found for toolset ", toolSpecificName));
return nullptr;
}
} else {
std::string const& genericName =
this->CanonicalToolsetName(this->GetPlatformToolsetString());
cm::optional<std::string> found = this->FindFlagTable(genericName, table);
if (!found) {
found = this->FindFlagTable(defaultName, table);
}
if (found) {
filename = std::move(*found);
} else {
mf->IssueMessage(MessageType::FATAL_ERROR,
cmStrCat("JSON flag table for ", table,
" not found for toolset ", genericName, " ",
defaultName));
return nullptr;
}
}
if (!ret) {
cmMakefile* mf = this->GetCurrentMakefile();
std::ostringstream e;
/* clang-format off */
e << "JSON flag table \"" << filename <<
"\" could not be loaded.\n";
/* clang-format on */
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename)) {
return ret;
}
return ret;
mf->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("JSON flag table could not be loaded:\n ", filename));
return nullptr;
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetClFlagTable() const
{
std::string optionsName = this->ToolsetOptions.GetClFlagTableName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultCLFlagTableName);
return LoadFlagTable(optionsName, toolsetName, defaultName, "CL");
return LoadFlagTable(this->GetClFlagTableName(),
this->DefaultCLFlagTableName, "CL");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCSharpFlagTable()
const
{
std::string optionsName = this->ToolsetOptions.GetCSharpFlagTableName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultCSharpFlagTableName);
return LoadFlagTable(optionsName, toolsetName, defaultName, "CSharp");
return LoadFlagTable(this->GetCSharpFlagTableName(),
this->DefaultCSharpFlagTableName, "CSharp");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetRcFlagTable() const
{
std::string optionsName = this->ToolsetOptions.GetRcFlagTableName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultRCFlagTableName);
return LoadFlagTable(optionsName, toolsetName, defaultName, "RC");
return LoadFlagTable(this->GetRcFlagTableName(),
this->DefaultRCFlagTableName, "RC");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLibFlagTable() const
{
std::string optionsName = this->ToolsetOptions.GetLibFlagTableName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultLibFlagTableName);
return LoadFlagTable(optionsName, toolsetName, defaultName, "LIB");
return LoadFlagTable(this->GetLibFlagTableName(),
this->DefaultLibFlagTableName, "LIB");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLinkFlagTable() const
{
std::string optionsName = this->ToolsetOptions.GetLinkFlagTableName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultLinkFlagTableName);
return LoadFlagTable(optionsName, toolsetName, defaultName, "Link");
return LoadFlagTable(this->GetLinkFlagTableName(),
this->DefaultLinkFlagTableName, "Link");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaFlagTable() const
{
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultCudaFlagTableName);
return LoadFlagTable("", toolsetName, defaultName, "Cuda");
return LoadFlagTable(std::string(), this->DefaultCudaFlagTableName, "Cuda");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaHostFlagTable()
const
{
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultCudaHostFlagTableName);
return LoadFlagTable("", toolsetName, defaultName, "CudaHost");
return LoadFlagTable(std::string(), this->DefaultCudaHostFlagTableName,
"CudaHost");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const
{
std::string optionsName = this->ToolsetOptions.GetMasmFlagTableName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultMasmFlagTableName);
return LoadFlagTable(optionsName, toolsetName, defaultName, "MASM");
return LoadFlagTable(this->GetMasmFlagTableName(),
this->DefaultMasmFlagTableName, "MASM");
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetNasmFlagTable() const
{
std::string toolsetName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->GetPlatformToolsetString());
std::string defaultName = this->ToolsetOptions.GetToolsetName(
this->GetPlatformName(), this->DefaultNasmFlagTableName);
return LoadFlagTable("", toolsetName, defaultName, "NASM");
return LoadFlagTable(std::string(), this->DefaultNasmFlagTableName, "NASM");
}
std::string cmGlobalVisualStudio10Generator::GetClFlagTableName() const
{
std::string const& toolset = this->GetPlatformToolsetString();
std::string const useToolset = this->CanonicalToolsetName(toolset);
if (toolset == "v142") {
return "v142";
} else if (toolset == "v141") {
return "v141";
} else if (useToolset == "v140") {
return "v140";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName() const
{
std::string const& toolset = this->GetPlatformToolsetString();
std::string const useToolset = this->CanonicalToolsetName(toolset);
if (useToolset == "v142") {
return "v142";
} else if (useToolset == "v141") {
return "v141";
} else if (useToolset == "v140") {
return "v140";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmGlobalVisualStudio10Generator::GetRcFlagTableName() const
{
std::string const& toolset = this->GetPlatformToolsetString();
std::string const useToolset = this->CanonicalToolsetName(toolset);
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmGlobalVisualStudio10Generator::GetLibFlagTableName() const
{
std::string const& toolset = this->GetPlatformToolsetString();
std::string const useToolset = this->CanonicalToolsetName(toolset);
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName() const
{
std::string const& toolset = this->GetPlatformToolsetString();
std::string const useToolset = this->CanonicalToolsetName(toolset);
if (useToolset == "v142") {
return "v142";
} else if (useToolset == "v141") {
return "v141";
} else if (useToolset == "v140") {
return "v140";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmGlobalVisualStudio10Generator::GetMasmFlagTableName() const
{
std::string const& toolset = this->GetPlatformToolsetString();
std::string const useToolset = this->CanonicalToolsetName(toolset);
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmGlobalVisualStudio10Generator::CanonicalToolsetName(
std::string const& toolset) const
{
std::size_t length = toolset.length();
if (cmHasLiteralSuffix(toolset, "_xp")) {
length -= 3;
}
return toolset.substr(0, length);
}
+15 -4
View File
@@ -5,8 +5,10 @@
#include <memory>
#include <set>
#include <cm/optional>
#include <cm/string_view>
#include "cmGlobalVisualStudio8Generator.h"
#include "cmVisualStudio10ToolsetOptions.h"
/** \class cmGlobalVisualStudio10Generator
* \brief Write a Unix makefiles.
@@ -176,8 +178,7 @@ protected:
std::string const& GetMSBuildCommand();
cmIDEFlagTable const* LoadFlagTable(std::string const& optionsName,
std::string const& toolsetName,
cmIDEFlagTable const* LoadFlagTable(std::string const& toolSpecificName,
std::string const& defaultName,
std::string const& table) const;
@@ -230,7 +231,6 @@ private:
std::string MSBuildCommand;
bool MSBuildCommandInitialized;
cmVisualStudio10ToolsetOptions ToolsetOptions;
std::set<std::string> AndroidExecutableWarnings;
virtual std::string FindMSBuildCommand();
std::string FindDevEnvCommand() override;
@@ -242,6 +242,17 @@ private:
bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
std::string GetClFlagTableName() const;
std::string GetCSharpFlagTableName() const;
std::string GetRcFlagTableName() const;
std::string GetLibFlagTableName() const;
std::string GetLinkFlagTableName() const;
std::string GetMasmFlagTableName() const;
std::string CanonicalToolsetName(std::string const& toolset) const;
cm::optional<std::string> FindFlagTable(cm::string_view toolsetName,
cm::string_view table) const;
std::string CustomVCTargetsPath;
std::string VCTargetsPath;
bool FindVCTargetsPath(cmMakefile* mf);
+3 -2
View File
@@ -991,7 +991,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
includes, genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES),
*sf);
}
lg->AppendFlags(flags, lg->GetIncludeFlags(includes, gtgt, lang, true));
lg->AppendFlags(flags,
lg->GetIncludeFlags(includes, gtgt, lang, std::string()));
cmXCodeObject* buildFile =
this->CreateXCodeBuildFileFromPath(sf->ResolveFullPath(), gtgt, lang, sf);
@@ -2695,7 +2696,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// GNU assembly files (#16449)
for (auto const& language : languages) {
std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags(
includes, gtgt, language, true, false, configName);
includes, gtgt, language, configName);
if (!includeFlags.empty()) {
cflags[language] += " " + includeFlags;
+61 -7
View File
@@ -4,9 +4,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdio>
#include <cstdlib> // required for atoi
#include <functional>
#include <iterator>
#include <set>
@@ -36,6 +34,42 @@
namespace {
bool GetIndexArg(char const* arg, int* idx, cmMakefile& mf)
{
long value;
if (!cmStrToLong(arg, &value)) {
switch (mf.GetPolicyStatus(cmPolicies::CMP0121)) {
case cmPolicies::WARN: {
// Default is to warn and use old behavior OLD behavior is to allow
// compatibility, so issue a warning and use the previous behavior.
std::string warn =
cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0121),
" Invalid list index \"", arg, "\".");
mf.IssueMessage(MessageType::AUTHOR_WARNING, warn);
break;
}
case cmPolicies::OLD:
// OLD behavior is to allow compatibility, so just ignore the
// situation.
break;
case cmPolicies::NEW:
return false;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
std::string msg =
cmStrCat(cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0121),
" Invalid list index \"", arg, "\".");
mf.IssueMessage(MessageType::FATAL_ERROR, msg);
break;
}
}
// Truncation is happening here, but it had always been happening here.
*idx = static_cast<int>(value);
return true;
}
bool FilterRegex(std::vector<std::string> const& args, bool includeMatches,
std::string const& listName,
std::vector<std::string>& varArgsExpanded,
@@ -154,7 +188,11 @@ bool HandleGetCommand(std::vector<std::string> const& args,
const char* sep = "";
size_t nitem = varArgsExpanded.size();
for (cc = 2; cc < args.size() - 1; cc++) {
int item = atoi(args[cc].c_str());
int item;
if (!GetIndexArg(args[cc].c_str(), &item, status.GetMakefile())) {
status.SetError(cmStrCat("index: ", args[cc], " is not a valid index"));
return false;
}
value += sep;
sep = ";";
if (item < 0) {
@@ -362,7 +400,11 @@ bool HandleInsertCommand(std::vector<std::string> const& args,
const std::string& listName = args[1];
// expand the variable
int item = atoi(args[2].c_str());
int item;
if (!GetIndexArg(args[2].c_str(), &item, status.GetMakefile())) {
status.SetError(cmStrCat("index: ", args[2], " is not a valid index"));
return false;
}
std::vector<std::string> varArgsExpanded;
if ((!GetList(varArgsExpanded, listName, status.GetMakefile()) ||
varArgsExpanded.empty()) &&
@@ -1282,8 +1324,16 @@ bool HandleSublistCommand(std::vector<std::string> const& args,
return true;
}
const int start = atoi(args[2].c_str());
const int length = atoi(args[3].c_str());
int start;
int length;
if (!GetIndexArg(args[2].c_str(), &start, status.GetMakefile())) {
status.SetError(cmStrCat("index: ", args[2], " is not a valid index"));
return false;
}
if (!GetIndexArg(args[3].c_str(), &length, status.GetMakefile())) {
status.SetError(cmStrCat("index: ", args[3], " is not a valid index"));
return false;
}
using size_type = decltype(varArgsExpanded)::size_type;
@@ -1338,7 +1388,11 @@ bool HandleRemoveAtCommand(std::vector<std::string> const& args,
std::vector<size_t> removed;
size_t nitem = varArgsExpanded.size();
for (cc = 2; cc < args.size(); ++cc) {
int item = atoi(args[cc].c_str());
int item;
if (!GetIndexArg(args[cc].c_str(), &item, status.GetMakefile())) {
status.SetError(cmStrCat("index: ", args[cc], " is not a valid index"));
return false;
}
if (item < 0) {
item = static_cast<int>(nitem) + item;
}
+9 -8
View File
@@ -838,16 +838,16 @@ cmProp cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
}
std::string cmLocalGenerator::ConvertToIncludeReference(
std::string const& path, OutputFormat format, bool forceFullPaths)
std::string const& path, IncludePathStyle pathStyle, OutputFormat format)
{
static_cast<void>(forceFullPaths);
static_cast<void>(pathStyle);
return this->ConvertToOutputForExisting(path, format);
}
std::string cmLocalGenerator::GetIncludeFlags(
const std::vector<std::string>& includeDirs, cmGeneratorTarget* target,
const std::string& lang, bool forceFullPaths, bool forResponseFile,
const std::string& config)
std::vector<std::string> const& includeDirs, cmGeneratorTarget* target,
std::string const& lang, std::string const& config, bool forResponseFile,
IncludePathStyle pathStyle)
{
if (lang.empty()) {
return "";
@@ -923,7 +923,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
flagUsed = true;
}
std::string includePath =
this->ConvertToIncludeReference(i, shellFormat, forceFullPaths);
this->ConvertToIncludeReference(i, pathStyle, shellFormat);
if (quotePaths && !includePath.empty() && includePath.front() != '\"') {
includeFlags << "\"";
}
@@ -2701,8 +2701,9 @@ void cmLocalGenerator::CopyPchCompilePdb(
}
file << "foreach(retry RANGE 1 30)\n";
file << " if (EXISTS \"" << from_file << "\" AND \"" << from_file
<< " \" IS_NEWER_THAN \"" << dest_file << "\")\n";
file << " if (EXISTS \"" << from_file << "\" AND (NOT EXISTS \""
<< dest_file << "\" OR NOT \"" << dest_file << " \" IS_NEWER_THAN \""
<< from_file << "\"))\n";
file << " execute_process(COMMAND ${CMAKE_COMMAND} -E copy";
file << " \"" << from_file << "\""
<< " \"" << to_dir << "\" RESULT_VARIABLE result "
+19 -11
View File
@@ -171,13 +171,19 @@ public:
cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
enum class IncludePathStyle
{
Default,
Absolute,
};
//! Get the include flags for the current makefile and language
std::string GetIncludeFlags(const std::vector<std::string>& includes,
cmGeneratorTarget* target,
const std::string& lang,
bool forceFullPaths = false,
bool forResponseFile = false,
const std::string& config = "");
std::string GetIncludeFlags(
std::vector<std::string> const& includes, cmGeneratorTarget* target,
std::string const& lang, std::string const& config,
bool forResponseFile = false,
IncludePathStyle pathStyle = IncludePathStyle::Default);
using GeneratorTargetVector =
std::vector<std::unique_ptr<cmGeneratorTarget>>;
@@ -256,11 +262,6 @@ public:
bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
virtual std::string ConvertToIncludeReference(
std::string const& path,
cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
bool forceFullPaths = false);
/** Called from command-line hook to clear dependencies. */
virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {}
@@ -557,6 +558,13 @@ public:
cmProp GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop);
protected:
// The default implementation ignores the IncludePathStyle and always
// uses absolute paths. A generator may override this to use relative
// paths in some cases.
virtual std::string ConvertToIncludeReference(
std::string const& path, IncludePathStyle pathStyle,
cmOutputConverter::OutputFormat format);
//! put all the libraries for a target on into the given stream
void OutputLinkLibraries(cmComputeLinkInformation* pcli,
cmLinkLineComputer* linkLineComputer,
+7 -4
View File
@@ -97,9 +97,12 @@ void cmLocalNinjaGenerator::Generate()
// contains any non-ASCII characters and dependency checking will fail.
// As a workaround, leave the msvc_deps_prefix UTF-8 encoded even though
// the rest of the file is ANSI encoded.
if (GetConsoleOutputCP() == CP_UTF8 && GetACP() != CP_UTF8) {
if (GetConsoleOutputCP() == CP_UTF8 && GetACP() != CP_UTF8 &&
this->GetGlobalGenerator()->GetMakefileEncoding() != codecvt::None) {
this->GetRulesFileStream().WriteRaw(showIncludesPrefix);
} else {
// Ninja 1.11 and above uses the UTF-8 code page if it's supported, so
// in that case we can write it normally without using raw bytes.
this->GetRulesFileStream() << showIncludesPrefix;
}
#else
@@ -202,10 +205,10 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
// Virtual protected methods.
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
std::string const& path, cmOutputConverter::OutputFormat format,
bool forceFullPaths)
std::string const& path, IncludePathStyle pathStyle,
cmOutputConverter::OutputFormat format)
{
if (forceFullPaths) {
if (pathStyle == IncludePathStyle::Absolute) {
return this->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(path, this->GetCurrentBinaryDirectory()),
format);
+3 -3
View File
@@ -12,6 +12,7 @@
#include "cmListFileCache.h"
#include "cmLocalCommonGenerator.h"
#include "cmLocalGenerator.h"
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
@@ -91,9 +92,8 @@ public:
protected:
std::string ConvertToIncludeReference(
std::string const& path,
cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
bool forceFullPaths = false) override;
std::string const& path, IncludePathStyle pathStyle,
cmOutputConverter::OutputFormat format) override;
private:
cmGeneratedFileStream& GetImplFileStream(const std::string& config) const;
+1 -1
View File
@@ -4393,7 +4393,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
// Deprecate old policies, especially those that require a lot
// of code to maintain the old behavior.
if (status == cmPolicies::OLD && id <= cmPolicies::CMP0075 &&
if (status == cmPolicies::OLD && id <= cmPolicies::CMP0081 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
+4 -1
View File
@@ -780,9 +780,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
std::string targetOutSOName;
if (this->GeneratorTarget->HasSOName(this->GetConfigName())) {
vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
vars.TargetSOName = this->TargetNames.SharedObject.c_str();
targetOutSOName = this->LocalGenerator->ConvertToOutputFormat(
this->TargetNames.SharedObject.c_str(), cmOutputConverter::SHELL);
vars.TargetSOName = targetOutSOName.c_str();
}
vars.LinkFlags = linkFlags.c_str();
+3 -3
View File
@@ -854,7 +854,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
vars.Defines = definesString.c_str();
std::string includesString = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, lang, true, false, config);
includes, this->GeneratorTarget, lang, config);
this->LocalGenerator->AppendFlags(includesString,
"$(" + lang + "_INCLUDES)");
vars.Includes = includesString.c_str();
@@ -2195,8 +2195,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
lang, this->GetConfigName());
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, lang, false, useResponseFile,
this->GetConfigName());
includes, this->GeneratorTarget, lang, this->GetConfigName(),
useResponseFile);
if (includeFlags.empty()) {
return;
}
+4 -2
View File
@@ -868,7 +868,8 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
if (genTarget->HasSOName(config)) {
vars["SONAME_FLAG"] =
this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage(config));
vars["SONAME"] = tgtNames.SharedObject;
vars["SONAME"] = localGen.ConvertToOutputFormat(tgtNames.SharedObject,
cmOutputConverter::SHELL);
if (genTarget->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string install_dir =
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(config);
@@ -1176,7 +1177,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
}
if (gt->HasSOName(config)) {
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage(config));
vars["SONAME"] = tgtNames.SharedObject;
vars["SONAME"] = localGen.ConvertToOutputFormat(tgtNames.SharedObject,
cmOutputConverter::SHELL);
if (targetType == cmStateEnums::SHARED_LIBRARY) {
std::string install_dir = gt->GetInstallNameDirForBuildTree(config);
if (!install_dir.empty()) {
+8 -6
View File
@@ -263,9 +263,10 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
language, config);
// Add include directory flags.
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, language,
language == "RC", // full include paths for RC needed by cmcldeps
false, config);
includes, this->GeneratorTarget, language, config, false,
// full include paths for RC needed by cmcldeps
language == "RC" ? cmLocalGenerator::IncludePathStyle::Absolute
: cmLocalGenerator::IncludePathStyle::Default);
if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
}
@@ -324,7 +325,8 @@ std::string cmNinjaTargetGenerator::ComputeIncludes(
}
std::string includesString = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, language, true, false, config);
includes, this->GeneratorTarget, language, config, false,
cmLocalGenerator::IncludePathStyle::Absolute);
this->LocalGenerator->AppendFlags(includesString,
this->GetIncludes(language, config));
@@ -1379,8 +1381,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSystemTools::GetParentDirectory(source->GetFullPath()));
std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags(
sourceDirectory, this->GeneratorTarget, language, false, false,
config);
sourceDirectory, this->GeneratorTarget, language, config, false,
cmLocalGenerator::IncludePathStyle::Default);
vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]);
}
+4 -1
View File
@@ -359,7 +359,10 @@ class cmMakefile;
3, 20, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0120, \
"The WriteCompilerDetectionHeader module is removed.", 3, 20, 0, \
cmPolicies::WARN)
cmPolicies::WARN) \
SELECT(POLICY, CMP0121, \
"The list() command now validates parsing of index arguments.", 3, \
21, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
+31
View File
@@ -938,6 +938,30 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!uicOpts.empty()) {
this->Uic.UiFiles.emplace_back(fullPath, cmExpandedList(uicOpts));
}
auto uiHeaderRelativePath = cmSystemTools::RelativePath(
this->LocalGen->GetCurrentSourceDirectory(),
cmSystemTools::GetFilenamePath(fullPath));
auto uiHeaderFilePath = cmStrCat(
'/', uiHeaderRelativePath, '/', "ui_"_s,
cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s);
ConfigString uiHeader;
uiHeader.Default =
cmStrCat(this->Dir.Build, "/include"_s, uiHeaderFilePath);
auto uiHeaderGenex = uiHeader.Default;
if (this->MultiConfig) {
uiHeaderGenex = cmStrCat(this->Dir.Build, "/include_$<CONFIG>"_s,
uiHeaderFilePath);
for (std::string const& cfg : this->ConfigsList) {
uiHeader.Config[cfg] = cmStrCat(this->Dir.Build, "/include_"_s,
cfg, uiHeaderFilePath);
}
}
this->Uic.UiHeaders.emplace_back(
std::make_pair(uiHeader, uiHeaderGenex));
} else {
// Register skipped .ui file
this->Uic.SkipUi.insert(fullPath);
@@ -1091,6 +1115,13 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
autogenByproducts.push_back(this->Moc.CompilationFileGenex);
}
if (this->Uic.Enabled) {
for (const auto& file : this->Uic.UiHeaders) {
this->AddGeneratedSource(file.first, this->Uic);
autogenByproducts.push_back(file.second);
}
}
// Compose target comment
std::string autogenComment;
{
+2
View File
@@ -239,6 +239,8 @@ private:
std::vector<UiFileT> UiFiles;
ConfigStrings<std::vector<std::string>> Options;
std::vector<std::string> SearchPaths;
std::vector<std::pair<ConfigString /*ui header*/, std::string /*genex*/>>
UiHeaders;
} Uic;
/** rcc variables. */
+3 -3
View File
@@ -1589,14 +1589,14 @@ bool cmQtAutoMocUicT::JobEvalCacheUicT::FindIncludedUi(
};
// Vicinity of the source
if (findUi(cmStrCat(sourceDirPrefix, this->UiName))) {
return true;
}
if (!includePrefix.empty()) {
if (findUi(cmStrCat(sourceDirPrefix, includePrefix, this->UiName))) {
return true;
}
}
if (findUi(cmStrCat(sourceDirPrefix, this->UiName))) {
return true;
}
// Additional AUTOUIC search paths
auto const& searchPaths = this->UicConst().SearchPaths;
if (!searchPaths.empty()) {
+3 -2
View File
@@ -308,8 +308,9 @@ struct StanardLevelComputer
std::unordered_map<std::string, StanardLevelComputer> StandardComputerMapping =
{
{ "C",
StanardLevelComputer{ "C", std::vector<int>{ 90, 99, 11 },
std::vector<std::string>{ "90", "99", "11" } } },
StanardLevelComputer{
"C", std::vector<int>{ 90, 99, 11, 17, 23 },
std::vector<std::string>{ "90", "99", "11", "17", "23" } } },
{ "CXX",
StanardLevelComputer{
"CXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 },
+114 -9
View File
@@ -87,6 +87,7 @@
# include <unistd.h>
# include <sys/time.h>
# include <sys/types.h>
#endif
#if defined(_WIN32) && \
@@ -149,6 +150,27 @@ static int cm_archive_read_open_file(struct archive* a, const char* file,
# define environ (*_NSGetEnviron())
#endif
namespace {
void ReportError(std::string* err)
{
if (!err) {
return;
}
#ifdef _WIN32
LPSTR message = NULL;
DWORD size = FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&message, 0, NULL);
*err = std::string(message, size);
LocalFree(message);
#else
*err = strerror(errno);
#endif
}
}
bool cmSystemTools::s_RunCommandHideConsole = false;
bool cmSystemTools::s_DisableRunCommandOutput = false;
bool cmSystemTools::s_ErrorOccured = false;
@@ -952,20 +974,78 @@ void cmSystemTools::InitializeLibUV()
#ifdef _WIN32
namespace {
bool cmMoveFile(std::wstring const& oldname, std::wstring const& newname)
bool cmMoveFile(std::wstring const& oldname, std::wstring const& newname,
cmSystemTools::Replace replace)
{
// Not only ignore any previous error, but clear any memory of it.
SetLastError(0);
// Use MOVEFILE_REPLACE_EXISTING to replace an existing destination file.
return MoveFileExW(oldname.c_str(), newname.c_str(),
MOVEFILE_REPLACE_EXISTING);
DWORD flags = 0;
if (replace == cmSystemTools::Replace::Yes) {
// Use MOVEFILE_REPLACE_EXISTING to replace an existing destination file.
flags = flags | MOVEFILE_REPLACE_EXISTING;
}
return MoveFileExW(oldname.c_str(), newname.c_str(), flags);
}
}
#endif
bool cmSystemTools::CopySingleFile(const std::string& oldname,
const std::string& newname)
{
return cmSystemTools::CopySingleFile(oldname, newname, CopyWhen::Always) ==
CopyResult::Success;
}
cmSystemTools::CopyResult cmSystemTools::CopySingleFile(
std::string const& oldname, std::string const& newname, CopyWhen when,
std::string* err)
{
switch (when) {
case CopyWhen::Always:
break;
case CopyWhen::OnlyIfDifferent:
if (!FilesDiffer(oldname, newname)) {
return CopyResult::Success;
}
break;
}
mode_t perm = 0;
bool perms = SystemTools::GetPermissions(oldname, perm);
// If files are the same do not copy
if (SystemTools::SameFile(oldname, newname)) {
return CopyResult::Success;
}
if (!cmsys::SystemTools::CloneFileContent(oldname, newname)) {
// if cloning did not succeed, fall back to blockwise copy
if (!cmsys::SystemTools::CopyFileContentBlockwise(oldname, newname)) {
ReportError(err);
return CopyResult::Failure;
}
}
if (perms) {
if (!SystemTools::SetPermissions(newname, perm)) {
ReportError(err);
return CopyResult::Failure;
}
}
return CopyResult::Success;
}
bool cmSystemTools::RenameFile(const std::string& oldname,
const std::string& newname)
{
return cmSystemTools::RenameFile(oldname, newname, Replace::Yes) ==
RenameResult::Success;
}
cmSystemTools::RenameResult cmSystemTools::RenameFile(
std::string const& oldname, std::string const& newname, Replace replace,
std::string* err)
{
#ifdef _WIN32
# ifndef INVALID_FILE_ATTRIBUTES
@@ -988,7 +1068,7 @@ bool cmSystemTools::RenameFile(const std::string& oldname,
oldname_wstr, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
DWORD move_last_error = 0;
while (!cmMoveFile(oldname_wstr, newname_wstr) && --retry.Count) {
while (!cmMoveFile(oldname_wstr, newname_wstr, replace) && --retry.Count) {
move_last_error = GetLastError();
// There was no error ==> the operation is not yet complete.
@@ -1004,7 +1084,11 @@ bool cmSystemTools::RenameFile(const std::string& oldname,
// 3) Windows Explorer has an associated directory already opened.
if (move_last_error != ERROR_ACCESS_DENIED &&
move_last_error != ERROR_SHARING_VIOLATION) {
return false;
if (replace == Replace::No && move_last_error == ERROR_ALREADY_EXISTS) {
return RenameResult::NoReplace;
}
ReportError(err);
return RenameResult::Failure;
}
DWORD const attrs = GetFileAttributesW(newname_wstr.c_str());
@@ -1028,10 +1112,31 @@ bool cmSystemTools::RenameFile(const std::string& oldname,
save_restore_file_attributes.SetPath(newname_wstr);
}
SetLastError(move_last_error);
return retry.Count > 0;
if (retry.Count > 0) {
return RenameResult::Success;
}
if (replace == Replace::No && GetLastError() == ERROR_ALREADY_EXISTS) {
return RenameResult::NoReplace;
}
ReportError(err);
return RenameResult::Failure;
#else
/* On UNIX we have an OS-provided call to do this atomically. */
return rename(oldname.c_str(), newname.c_str()) == 0;
// On UNIX we have OS-provided calls to create 'newname' atomically.
if (replace == Replace::No) {
if (link(oldname.c_str(), newname.c_str()) == 0) {
return RenameResult::Success;
}
if (errno == EEXIST) {
return RenameResult::NoReplace;
}
ReportError(err);
return RenameResult::Failure;
}
if (rename(oldname.c_str(), newname.c_str()) == 0) {
return RenameResult::Success;
}
ReportError(err);
return RenameResult::Failure;
#endif
}
+33
View File
@@ -128,10 +128,43 @@ public:
static bool SimpleGlob(const std::string& glob,
std::vector<std::string>& files, int type = 0);
enum class CopyWhen
{
Always,
OnlyIfDifferent,
};
enum class CopyResult
{
Success,
Failure,
};
/** Copy a file. */
static bool CopySingleFile(const std::string& oldname,
const std::string& newname);
static CopyResult CopySingleFile(std::string const& oldname,
std::string const& newname, CopyWhen when,
std::string* err = nullptr);
enum class Replace
{
Yes,
No,
};
enum class RenameResult
{
Success,
NoReplace,
Failure,
};
/** Rename a file or directory within a single disk volume (atomic
if possible). */
static bool RenameFile(const std::string& oldname,
const std::string& newname);
static RenameResult RenameFile(std::string const& oldname,
std::string const& newname, Replace replace,
std::string* err = nullptr);
//! Rename a file if contents are different, delete the source otherwise
static void MoveFileIfDifferent(const std::string& source,
-143
View File
@@ -1,143 +0,0 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVisualStudio10ToolsetOptions.h"
#include "cmAlgorithms.h"
#include "cmIDEFlagTable.h"
#include "cmVisualStudioGeneratorOptions.h"
std::string cmVisualStudio10ToolsetOptions::GetClFlagTableName(
std::string const& name, std::string const& toolset) const
{
std::string const useToolset = this->GetToolsetName(name, toolset);
if (toolset == "v142") {
return "v142";
} else if (toolset == "v141") {
return "v141";
} else if (useToolset == "v140") {
return "v140";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName(
std::string const& name, std::string const& toolset) const
{
std::string const useToolset = this->GetToolsetName(name, toolset);
if (useToolset == "v142") {
return "v142";
} else if (useToolset == "v141") {
return "v141";
} else if (useToolset == "v140") {
return "v140";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmVisualStudio10ToolsetOptions::GetRcFlagTableName(
std::string const& name, std::string const& toolset) const
{
std::string const useToolset = this->GetToolsetName(name, toolset);
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmVisualStudio10ToolsetOptions::GetLibFlagTableName(
std::string const& name, std::string const& toolset) const
{
std::string const useToolset = this->GetToolsetName(name, toolset);
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmVisualStudio10ToolsetOptions::GetLinkFlagTableName(
std::string const& name, std::string const& toolset) const
{
std::string const useToolset = this->GetToolsetName(name, toolset);
if (useToolset == "v142") {
return "v142";
} else if (useToolset == "v141") {
return "v141";
} else if (useToolset == "v140") {
return "v140";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmVisualStudio10ToolsetOptions::GetMasmFlagTableName(
std::string const& name, std::string const& toolset) const
{
std::string const useToolset = this->GetToolsetName(name, toolset);
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
} else if (useToolset == "v120") {
return "v12";
} else if (useToolset == "v110") {
return "v11";
} else if (useToolset == "v100") {
return "v10";
} else {
return "";
}
}
std::string cmVisualStudio10ToolsetOptions::GetToolsetName(
std::string const& name, std::string const& toolset) const
{
static_cast<void>(name);
std::size_t length = toolset.length();
if (cmHasLiteralSuffix(toolset, "_xp")) {
length -= 3;
}
return toolset.substr(0, length);
}
-31
View File
@@ -1,31 +0,0 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
/** \class cmVisualStudio10ToolsetOptions
* \brief Retrieves toolset options for MSBuild.
*
* cmVisualStudio10ToolsetOptions manages toolsets within MSBuild
*/
class cmVisualStudio10ToolsetOptions
{
public:
std::string GetClFlagTableName(std::string const& name,
std::string const& toolset) const;
std::string GetCSharpFlagTableName(std::string const& name,
std::string const& toolset) const;
std::string GetRcFlagTableName(std::string const& name,
std::string const& toolset) const;
std::string GetLibFlagTableName(std::string const& name,
std::string const& toolset) const;
std::string GetLinkFlagTableName(std::string const& name,
std::string const& toolset) const;
std::string GetMasmFlagTableName(std::string const& name,
std::string const& toolset) const;
std::string GetToolsetName(std::string const& name,
std::string const& toolset) const;
};
+32 -1
View File
@@ -28,6 +28,7 @@
#include "cm_sys_stat.h"
#include "cmCMakePath.h"
#include "cmCMakePresetsFile.h"
#include "cmCommandLineArgument.h"
#include "cmCommands.h"
@@ -493,6 +494,21 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return true;
};
auto PrefixLambda = [&](std::string const& path, cmake* state) -> bool {
const std::string var = "CMAKE_INSTALL_PREFIX";
cmStateEnums::CacheEntryType type = cmStateEnums::PATH;
cmCMakePath absolutePath(path);
if (absolutePath.IsAbsolute()) {
#ifndef CMAKE_BOOTSTRAP
state->UnprocessedPresetVariables.erase(var);
#endif
state->ProcessCacheArg(var, path, type);
return true;
}
cmSystemTools::Error("Absolute paths are required for --install-prefix");
return false;
};
std::vector<CommandArgument> arguments = {
CommandArgument{ "-D", "-D must be followed with VAR=VALUE.",
CommandArgument::Values::One, DefineLambda },
@@ -511,8 +527,12 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
state->ReadListFile(args, path);
return true;
} },
CommandArgument{ "-P", "-P must be followed by a file name.",
CommandArgument::Values::One, ScriptLambda },
CommandArgument{ "--install-prefix",
"No install directory specified for --install-prefix",
CommandArgument::Values::One, PrefixLambda },
CommandArgument{ "--find-package", CommandArgument::Values::Zero,
[&](std::string const&, cmake*) -> bool {
findPackageMode = true;
@@ -649,7 +669,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
this->GlobalGenerator->CreateGenerationObjects();
const auto& lg = this->GlobalGenerator->LocalGenerators[0];
std::string includeFlags =
lg->GetIncludeFlags(includeDirs, nullptr, language);
lg->GetIncludeFlags(includeDirs, nullptr, language, std::string());
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
@@ -815,6 +835,9 @@ void cmake::SetArgs(const std::vector<std::string>& args)
CommandArgument::Values::One, PlatformLambda },
CommandArgument{ "-T", "No toolset specified for -T",
CommandArgument::Values::One, ToolsetLamda },
CommandArgument{ "--install-prefix",
"No install directory specified for --install-prefix",
CommandArgument::Values::One, IgnoreAndTrueLambda },
CommandArgument{ "--check-build-system", CommandArgument::Values::Two,
[](std::string const& value, cmake* state) -> bool {
@@ -1207,6 +1230,14 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->UnprocessedPresetVariables = expandedPreset->CacheVariables;
this->UnprocessedPresetEnvironment = expandedPreset->Environment;
if (!expandedPreset->InstallDir.empty() &&
this->State->GetInitializedCacheValue("CMAKE_INSTALL_PREFIX") ==
nullptr) {
this->UnprocessedPresetVariables["CMAKE_INSTALL_PREFIX"] = {
"PATH", expandedPreset->InstallDir
};
}
if (!expandedPreset->ArchitectureStrategy ||
expandedPreset->ArchitectureStrategy ==
cmCMakePresetsFile::ArchToolsetStrategy::Set) {
+4
View File
@@ -712,6 +712,8 @@ private:
"Specify toolset name if supported by generator." }, \
{ "-A <platform-name>", \
"Specify platform name if supported by generator." }, \
{ "--install-prefix <directory>", \
"Specify install directory [CMAKE_INSTALL_PREFIX]." }, \
{ "-Wdev", "Enable developer warnings." }, \
{ "-Wno-dev", "Suppress developer warnings." }, \
{ "-Werror=dev", "Make developer warnings errors." }, \
@@ -739,6 +741,8 @@ private:
F(c_std_90) \
F(c_std_99) \
F(c_std_11) \
F(c_std_17) \
F(c_std_23) \
FOR_EACH_C90_FEATURE(F) \
FOR_EACH_C99_FEATURE(F) \
FOR_EACH_C11_FEATURE(F)
+29 -1
View File
@@ -121,7 +121,21 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
delete[] buf;
if (srchHandle == -1) {
return 0;
if (errorMessage) {
if (unsigned int errorId = GetLastError()) {
LPSTR message = nullptr;
DWORD size = FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, errorId, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&message, 0, nullptr);
*errorMessage = std::string(message, size);
LocalFree(message);
} else {
*errorMessage = "Unknown error.";
}
}
return false;
}
// Loop through names
@@ -152,6 +166,20 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
delete[] buf;
if (srchHandle == -1) {
if (errorMessage) {
if (unsigned int errorId = GetLastError()) {
LPSTR message = nullptr;
DWORD size = FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, errorId, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&message, 0, nullptr);
*errorMessage = std::string(message, size);
LocalFree(message);
} else {
*errorMessage = "Unknown error.";
}
}
return 0;
}
+3 -4
View File
@@ -54,6 +54,9 @@ public:
Glob();
~Glob();
Glob(const Glob&) = delete;
void operator=(const Glob&) = delete;
//! Find all files that match the pattern.
bool FindFiles(const std::string& inexpr, GlobMessages* messages = nullptr);
@@ -124,10 +127,6 @@ protected:
std::vector<std::string> VisitedSymlinks;
bool ListDirs;
bool RecurseListDirs;
private:
Glob(const Glob&) = delete;
void operator=(const Glob&) = delete;
};
} // namespace @KWSYS_NAMESPACE@
+7 -10
View File
@@ -244,7 +244,7 @@ inline int Chdir(const std::string& dir)
return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str());
}
inline void Realpath(const std::string& path, std::string& resolved_path,
std::string* errorMessage = 0)
std::string* errorMessage = nullptr)
{
std::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path);
wchar_t* ptemp;
@@ -2273,11 +2273,8 @@ bool SystemTools::TextFilesDiffer(const std::string& path1,
return false;
}
/**
* Blockwise copy source to destination file
*/
static bool CopyFileContentBlockwise(const std::string& source,
const std::string& destination)
bool SystemTools::CopyFileContentBlockwise(const std::string& source,
const std::string& destination)
{
// Open files
kwsys::ifstream fin(source.c_str(), std::ios::in | std::ios::binary);
@@ -2341,8 +2338,8 @@ static bool CopyFileContentBlockwise(const std::string& source,
* - The underlying filesystem does not support file cloning
* - An unspecified error occurred
*/
static bool CloneFileContent(const std::string& source,
const std::string& destination)
bool SystemTools::CloneFileContent(const std::string& source,
const std::string& destination)
{
#if defined(__linux) && defined(FICLONE)
int in = open(source.c_str(), O_RDONLY);
@@ -2410,9 +2407,9 @@ bool SystemTools::CopyFileAlways(const std::string& source,
SystemTools::MakeDirectory(destination_dir);
if (!CloneFileContent(source, real_destination)) {
if (!SystemTools::CloneFileContent(source, real_destination)) {
// if cloning did not succeed, fall back to blockwise copy
if (!CopyFileContentBlockwise(source, real_destination)) {
if (!SystemTools::CopyFileContentBlockwise(source, real_destination)) {
return false;
}
}
+11
View File
@@ -577,6 +577,17 @@ public:
static bool TextFilesDiffer(const std::string& path1,
const std::string& path2);
/**
* Blockwise copy source to destination file
*/
static bool CopyFileContentBlockwise(const std::string& source,
const std::string& destination);
/**
* Clone the source file to the destination file
*/
static bool CloneFileContent(const std::string& source,
const std::string& destination);
/**
* Return true if the two files are the same file
*/
+6 -3
View File
@@ -25,14 +25,14 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/CheckSwift.cmake)
# Fake a user home directory to avoid polluting the real one.
if(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
if(NOT CTEST_NO_TEST_HOME AND (NOT WIN32 OR DEFINED ENV{HOME}))
set(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome")
file(MAKE_DIRECTORY "${TEST_HOME}")
file(WRITE "${TEST_HOME}/.cvspass" ":pserver:anoncvs@www.cmake.org:/cvsroot/KWSys A\n")
set(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one.
# But provide original ENV{HOME} value in ENV{CTEST_REAL_HOME} for tests that
# need access to the real HOME directory.
if(NOT DEFINED ENV{CTEST_REAL_HOME})
if(DEFINED ENV{HOME} AND NOT DEFINED ENV{CTEST_REAL_HOME})
set(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\")
endif()
set(ENV{HOME} \"${TEST_HOME}\")
@@ -96,7 +96,7 @@ if(BUILD_TESTING)
# some old versions of make simply cannot handle spaces in paths
if (MAKE_IS_GNU OR
CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR
CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland")
CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland|Ninja")
set(MAKE_SUPPORTS_SPACES 1)
else()
set(MAKE_SUPPORTS_SPACES 0)
@@ -804,6 +804,7 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project Framework
--build-options
-DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
"-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install"
--test-command bar)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework")
@@ -828,6 +829,8 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project LibName
--build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
--build-options
-DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
--test-command foobar
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName")

Some files were not shown because too many files have changed in this diff Show More