summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/target_precompile_headers.rst122
-rw-r--r--Help/manual/cmake-compile-features.7.rst7
-rw-r--r--Help/manual/cmake-policies.7.rst8
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/policy/CMP0098.rst30
-rw-r--r--Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst2
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst13
-rw-r--r--Help/release/dev/FindFLEX-work-dir.rst6
-rw-r--r--Help/release/dev/sdcc-new-librarian.rst6
-rw-r--r--Help/release/dev/xcode-scheme-workdir.rst7
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst12
-rw-r--r--Modules/CMakeSwiftInformation.cmake4
-rw-r--r--Modules/FindFLEX.cmake73
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake8
-rw-r--r--Modules/Platform/Generic-SDCC-C.cmake34
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx2
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx3
-rw-r--r--Source/CPack/cpack.cxx1
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx5
-rw-r--r--Source/cmGeneratorTarget.cxx9
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx54
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmSystemTools.cxx2
-rw-r--r--Source/cmTarget.cxx8
-rw-r--r--Source/cmXCodeScheme.cxx28
-rw-r--r--Source/cmXCodeScheme.h6
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/ctest.cxx1
-rw-r--r--Source/kwsys/SystemTools.cxx6
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake9
-rw-r--r--Tests/RunCMake/PrecompileHeaders/foobar.c8
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake1
40 files changed, 363 insertions, 147 deletions
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 5ab3766..569c7eb 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -3,33 +3,21 @@ target_precompile_headers
Add a list of header files to precompile.
+Precompiling header files can speed up compilation by creating a partially
+processed version of some header files, and then using that version during
+compilations rather than repeatedly parsing the original headers.
+
+Main Form
+^^^^^^^^^
+
.. code-block:: cmake
target_precompile_headers(<target>
<INTERFACE|PUBLIC|PRIVATE> [header1...]
[<INTERFACE|PUBLIC|PRIVATE> [header2...] ...])
- target_precompile_headers(<target> REUSE_FROM <other_target>)
-
-Adds header files to :prop_tgt:`PRECOMPILE_HEADERS` or
-:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties.
-
-The second signature will reuse an already precompiled header file artefact
-from another target. This is done by setting the
-:prop_tgt:`PRECOMPILE_HEADERS_REUSE_FROM` to ``<other_target>`` value.
-The ``<other_target>`` will become a dependency of ``<target>``.
-
-.. note::
-
- The second signature will require the same set of compiler options,
- compiler flags, compiler definitions for both ``<target>``, and
- ``<other_target>``. Compilers (e.g. GCC) will issue a warning if the
- precompiled header file cannot be used (``-Winvalid-pch``).
-
-Precompiling header files can speed up compilation by creating a partially
-processed version of some header files, and then using that version during
-compilations rather than repeatedly parsing the original headers.
-
+The command adds header files to the :prop_tgt:`PRECOMPILE_HEADERS` and/or
+:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties of ``<target>``.
The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.
@@ -38,25 +26,50 @@ The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC``
items will populate the :prop_tgt:`PRECOMPILE_HEADERS` property of
``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
-:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``.
-(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.)
-Repeated calls for the same ``<target>`` append items in the order called.
+:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``
+(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items).
+Repeated calls for the same ``<target>`` will append items in the order called.
+
+Projects should generally avoid using ``PUBLIC`` or ``INTERFACE`` for targets
+that will be :ref:`exported <install(EXPORT)>`, or they should at least use
+the ``$<BUILD_INTERFACE:...>`` generator expression to prevent precompile
+headers from appearing in an installed exported target. Consumers of a target
+should typically be in control of what precompile headers they use, not have
+precompile headers forced on them by the targets being consumed (since
+precompile headers are not typically usage requirements). A notable exception
+to this is where an :ref:`interface library <Interface Libraries>` is created
+to define a commonly used set of precompile headers in one place and then other
+targets link to that interface library privately. In this case, the interface
+library exists specifically to propagate the precompile headers to its
+consumers and the consumer is effectively still in control, since it decides
+whether to link to the interface library or not.
+
+The list of header files is used to generate a header file named
+``cmake_pch.h|xx`` which is used to generate the precompiled header file
+(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header
+file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to
+all source files, so sources do not need to have ``#include "pch.h"``.
+
+Header file names specified with angle brackets (e.g. ``<unordered_map>``) or
+explicit double quotes (escaped for the :manual:`cmake-language(7)`,
+e.g. ``[["other_header.h"]]``) will be treated as is, and include directories
+must be available for the compiler to find them. Other header file names
+(e.g. ``project_header.h``) are interpreted as being relative to the current
+source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be
+included by absolute path.
-Arguments to ``target_precompile_headers`` may use "generator expressions"
+Arguments to ``target_precompile_headers()`` may use "generator expressions"
with the syntax ``$<...>``.
See the :manual:`cmake-generator-expressions(7)` manual for available
expressions. See the :manual:`cmake-compile-features(7)` manual for
information on compile features and a list of supported compilers.
The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
useful for specifying a language-specific header to precompile for
-only one language (e.g. ``CXX`` and not ``C``).
-
-Usage
-^^^^^
+only one language (e.g. ``CXX`` and not ``C``). For example:
.. code-block:: cmake
- target_precompile_headers(<target>
+ target_precompile_headers(myTarget
PUBLIC
project_header.h
"$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>"
@@ -65,20 +78,6 @@ Usage
<unordered_map>
)
-The list of header files is used to generate a header file named
-``cmake_pch.h|xx`` which is used to generate the precompiled header file
-(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header
-file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to
-all source files, so sources do not need to have ``#include "pch.h"``.
-
-Header file names specified with angle brackets (e.g. ``<unordered_map>``) or
-explicit double quotes (escaped for the :manual:`cmake-language(7)`,
-e.g. ``[["other_header.h"]]``) will be treated as is, and include directories
-must be available for the compiler to find them. Other header file names
-(e.g. ``project_header.h``) are interpreted as being relative to the current
-source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be
-included by absolute path.
-
When specifying angle brackets inside a :manual:`generator expression
<cmake-generator-expressions(7)>`, be sure to encode the closing ``>``
as ``$<ANGLE-R>``. For example:
@@ -88,13 +87,38 @@ as ``$<ANGLE-R>``. For example:
target_precompile_headers(mylib PRIVATE
"$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>"
"$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>"
- )
+ )
+
+
+Reusing Precompile Headers
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The command also supports a second signature which can be used to specify that
+one target re-uses a precompiled header file artefact from another target
+instead of generating its own:
+
+.. code-block:: cmake
+
+ target_precompile_headers(<target> REUSE_FROM <other_target>)
+
+This form sets the :prop_tgt:`PRECOMPILE_HEADERS_REUSE_FROM` property to
+``<other_target>`` and adds a dependency such that ``<target>`` will depend
+on ``<other_target>``. CMake will halt with an error if the
+:prop_tgt:`PRECOMPILE_HEADERS` property of ``<target>`` is already set when
+the ``REUSE_FROM`` form is used.
+
+.. note::
+
+ The ``REUSE_FROM`` form requires the same set of compiler options,
+ compiler flags and compiler definitions for both ``<target>`` and
+ ``<other_target>``. Some compilers (e.g. GCC) may issue a warning if the
+ precompiled header file cannot be used (``-Winvalid-pch``).
See Also
^^^^^^^^
-For disabling precompile headers for specific targets there is the
-property :prop_tgt:`DISABLE_PRECOMPILE_HEADERS`.
+To disable precompile headers for specific targets, see the
+:prop_tgt:`DISABLE_PRECOMPILE_HEADERS` target property.
-For skipping certain source files there is the source file property
-:prop_sf:`SKIP_PRECOMPILE_HEADERS`.
+To prevent precompile headers from being used when compiling a specific
+source file, see the :prop_sf:`SKIP_PRECOMPILE_HEADERS` source file property.
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index a821189..a14e322 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -28,10 +28,15 @@ CMake knows are known to the compiler, regardless of language standard
or compile flags needed to use them.
Features known to CMake are named mostly following the same convention
-as the Clang feature test macros. The are some exceptions, such as
+as the Clang feature test macros. There are some exceptions, such as
CMake using ``cxx_final`` and ``cxx_override`` instead of the single
``cxx_override_control`` used by Clang.
+Note that there are no separate compile features properties or variables for
+the ``OBJC`` or ``OBJCXX`` languages. These are based off ``C`` or ``C++``
+respectively, so the properties and variables for their corresponding base
+language should be used instead.
+
Compile Feature Requirements
============================
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 44ea1a8..eceeac7 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -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.17
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0098: FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing. </policy/CMP0098>
+
Policies Introduced by CMake 3.16
=================================
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 94d08c6..c5ef09a 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -381,6 +381,7 @@ Properties on Targets
/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER
/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
/prop_tgt/XCODE_SCHEME_ARGUMENTS
+ /prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY
/prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT
/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 01dd5fd..0c1d510 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -239,6 +239,7 @@ Variables that Change Behavior
/variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+ /variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY
/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
diff --git a/Help/policy/CMP0098.rst b/Help/policy/CMP0098.rst
new file mode 100644
index 0000000..6d1443b
--- /dev/null
+++ b/Help/policy/CMP0098.rst
@@ -0,0 +1,30 @@
+CMP0098
+-------
+
+:module:`FindFLEX` runs ``flex`` in directory
+:variable:`CMAKE_CURRENT_BINARY_DIR` when executing.
+
+The module provides a ``FLEX_TARGET`` macro which generates FLEX output.
+In CMake 3.16 and below the macro would generate a custom command that runs
+``flex`` in the current source directory. CMake 3.17 and later prefer to
+run it in the build directory and use :variable:`CMAKE_CURRENT_BINARY_DIR`
+as the ``WORKING_DIRECTORY`` of its :command:`add_custom_command` invocation.
+This ensures that any implicitly generated file is written relative to the
+build tree rather than the source tree, unless the generated file is
+provided as absolute path.
+
+This policy provides compatibility for projects that have not been updated
+to expect the new behavior.
+
+The ``OLD`` behavior for this policy is for ``FLEX_TARGET`` to use
+the current source directory for the ``WORKING_DIRECTORY`` and where
+to generate implicit files. The ``NEW`` behavior of this policy is to
+use the current binary directory for the ``WORKING_DIRECTORY`` relative to
+which implicit files are generated unless provided as absolute path.
+
+This policy was introduced in CMake version 3.17. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+Unlike many policies, CMake version |release| does *not* warn
+when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst b/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
index 8ff7e8b..e285407 100644
--- a/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
+++ b/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
@@ -7,6 +7,8 @@ Targets may populate this property to publish the header files
for consuming targets to precompile. The :command:`target_precompile_headers`
command populates this property with values given to the ``PUBLIC`` and
``INTERFACE`` keywords. Projects may also get and set the property directly.
+See the discussion in :command:`target_precompile_headers` for guidance on
+appropriate use of this property for installed or exported targets.
Contents of ``INTERFACE_PRECOMPILE_HEADERS`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
diff --git a/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst b/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst
new file mode 100644
index 0000000..7ffa74b
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst
@@ -0,0 +1,13 @@
+XCODE_SCHEME_WORKING_DIRECTORY
+------------------------------
+
+Specify the ``Working Directory`` a of the `Run` and `Profile`
+action in the generated Xcode scheme. In case the value contains
+generator expressions those are evaluated.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_WORKING_DIRECTORY` if it is set
+when a target is created.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/release/dev/FindFLEX-work-dir.rst b/Help/release/dev/FindFLEX-work-dir.rst
new file mode 100644
index 0000000..3569185
--- /dev/null
+++ b/Help/release/dev/FindFLEX-work-dir.rst
@@ -0,0 +1,6 @@
+FindFLEX-work-dir
+-----------------
+
+* The :module:`FindFLEX` module's ``FLEX_TARGET`` command now runs ``flex``
+ with :variable:`CMAKE_CURRENT_BINARY_DIR` as the working directory.
+ See policy :policy:`CMP0098`.
diff --git a/Help/release/dev/sdcc-new-librarian.rst b/Help/release/dev/sdcc-new-librarian.rst
new file mode 100644
index 0000000..93961ce
--- /dev/null
+++ b/Help/release/dev/sdcc-new-librarian.rst
@@ -0,0 +1,6 @@
+sdcc-new-librarian
+------------------
+
+* Since sdcc 3.2.0, sdcclib has been deprecated in favor of sdar as librarian.
+ Since sdcc 3.8.6, it has been removed from the distribution.
+ Use sdar if found, else use sdcclib to keep older compatibility.
diff --git a/Help/release/dev/xcode-scheme-workdir.rst b/Help/release/dev/xcode-scheme-workdir.rst
new file mode 100644
index 0000000..8eb5ed8
--- /dev/null
+++ b/Help/release/dev/xcode-scheme-workdir.rst
@@ -0,0 +1,7 @@
+xcode-scheme-workdir
+--------------------
+
+* The Xcode generator learnt to set the value of the
+ ``Custom Working Directory`` schema
+ option with the :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY`
+ target property.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst b/Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst
new file mode 100644
index 0000000..cc690f7
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_WORKING_DIRECTORY
+------------------------------------
+
+Specify the ``Working Directory`` a of the `Run` and `Profile`
+action in the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY`
+property on all targets.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index f2bf232..2c54da0 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -24,7 +24,7 @@ elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ")
endif()
-if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":")
endif()
@@ -77,7 +77,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
- set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
+ set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index d22b7ec..90e5f86 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -142,8 +142,6 @@ if(FLEX_EXECUTABLE)
#============================================================
#
macro(FLEX_TARGET Name Input Output)
- set(FLEX_TARGET_outputs "${Output}")
- set(FLEX_EXECUTABLE_opts "")
set(FLEX_TARGET_PARAM_OPTIONS)
set(FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS
@@ -165,31 +163,68 @@ if(FLEX_EXECUTABLE)
if(NOT "${FLEX_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(SEND_ERROR ${FLEX_TARGET_usage})
else()
+
+ cmake_policy(GET CMP0098 _flex_CMP0098
+ PARENT_SCOPE # undocumented, do not use outside of CMake
+ )
+ set(_flex_INPUT "${Input}")
+ if("x${_flex_CMP0098}x" STREQUAL "xNEWx")
+ set(_flex_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+ if(NOT IS_ABSOLUTE "${_flex_INPUT}")
+ set(_flex_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${_flex_INPUT}")
+ endif()
+ else()
+ set(_flex_WORKING_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+ endif()
+ unset(_flex_CMP0098)
+
+ set(_flex_OUTPUT "${Output}")
+ if(NOT IS_ABSOLUTE ${_flex_OUTPUT})
+ set(_flex_OUTPUT "${_flex_WORKING_DIR}/${_flex_OUTPUT}")
+ endif()
+ set(_flex_TARGET_OUTPUTS "${_flex_OUTPUT}")
+
+ set(_flex_EXE_OPTS "")
if(NOT "${FLEX_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
- set(FLEX_EXECUTABLE_opts "${FLEX_TARGET_ARG_COMPILE_FLAGS}")
- separate_arguments(FLEX_EXECUTABLE_opts)
+ set(_flex_EXE_OPTS "${FLEX_TARGET_ARG_COMPILE_FLAGS}")
+ separate_arguments(_flex_EXE_OPTS)
endif()
+
+ set(_flex_OUTPUT_HEADER "")
if(NOT "${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
- list(APPEND FLEX_TARGET_outputs "${FLEX_TARGET_ARG_DEFINES_FILE}")
- list(APPEND FLEX_EXECUTABLE_opts --header-file=${FLEX_TARGET_ARG_DEFINES_FILE})
+ set(_flex_OUTPUT_HEADER "${FLEX_TARGET_ARG_DEFINES_FILE}")
+ if(IS_ABSOLUTE "${_flex_OUTPUT_HEADER}")
+ set(_flex_OUTPUT_HEADER_ABS "${_flex_OUTPUT_HEADER}")
+ else()
+ set(_flex_OUTPUT_HEADER_ABS "${_flex_WORKING_DIR}/${_flex_OUTPUT_HEADER}")
+ endif()
+ list(APPEND _flex_TARGET_OUTPUTS "${_flex_OUTPUT_HEADER_ABS}")
+ list(APPEND _flex_EXE_OPTS --header-file=${_flex_OUTPUT_HEADER_ABS})
endif()
- add_custom_command(OUTPUT ${FLEX_TARGET_outputs}
- COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
+ get_filename_component(_flex_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE)
+ add_custom_command(OUTPUT ${_flex_TARGET_OUTPUTS}
+ COMMAND ${FLEX_EXECUTABLE} ${_flex_EXE_OPTS} -o${_flex_OUTPUT} ${_flex_INPUT}
VERBATIM
- DEPENDS ${Input}
- COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ DEPENDS ${_flex_INPUT}
+ COMMENT "[FLEX][${Name}] Building scanner with ${_flex_EXE_NAME_WE} ${FLEX_VERSION}"
+ WORKING_DIRECTORY ${_flex_WORKING_DIR})
set(FLEX_${Name}_DEFINED TRUE)
- set(FLEX_${Name}_OUTPUTS ${Output})
- set(FLEX_${Name}_INPUT ${Input})
- set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
- if("${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
- set(FLEX_${Name}_OUTPUT_HEADER "")
- else()
- set(FLEX_${Name}_OUTPUT_HEADER ${FLEX_TARGET_ARG_DEFINES_FILE})
- endif()
+ set(FLEX_${Name}_OUTPUTS ${_flex_TARGET_OUTPUTS})
+ set(FLEX_${Name}_INPUT ${_flex_INPUT})
+ set(FLEX_${Name}_COMPILE_FLAGS ${_flex_EXE_OPTS})
+ set(FLEX_${Name}_OUTPUT_HEADER ${_flex_OUTPUT_HEADER})
+
+ unset(_flex_EXE_NAME_WE)
+ unset(_flex_EXE_OPTS)
+ unset(_flex_INPUT)
+ unset(_flex_OUTPUT)
+ unset(_flex_OUTPUT_HEADER)
+ unset(_flex_OUTPUT_HEADER_ABS)
+ unset(_flex_TARGET_OUTPUTS)
+ unset(_flex_WORKING_DIR)
+
endif()
endmacro()
#============================================================
diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index 82053b2..b46a7b1 100644
--- a/Modules/Internal/CPack/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -230,13 +230,11 @@ function(_cpack_nuget_render_spec)
foreach(_dep IN LISTS _deps)
_cpack_nuget_debug(" checking dependency `${_dep}`")
- string(MAKE_C_IDENTIFIER "${_dep}" _dep_id)
-
- _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_id}_VERSION)
+ _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep}_VERSION)
if(NOT _ver)
- string(TOUPPER "${_dep_id}" _dep_id)
- _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_id}_VERSION)
+ string(TOUPPER "${_dep}" _dep_upper)
+ _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_upper}_VERSION)
endif()
if(_ver)
diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake
index 8f648a1..c51767e 100644
--- a/Modules/Platform/Generic-SDCC-C.cmake
+++ b/Modules/Platform/Generic-SDCC-C.cmake
@@ -19,14 +19,28 @@ set(CMAKE_DL_LIBS "")
set(CMAKE_C_OUTPUT_EXTENSION ".rel")
-# find sdcclib as CMAKE_AR
-# since cmake may already have searched for "ar", sdcclib has to
-# be searched with a different variable name (SDCCLIB_EXECUTABLE)
-# and must then be forced into the cache
+# find sdar/sdcclib as CMAKE_AR
+# since cmake may already have searched for "ar", sdar has to
+# be searched with a different variable name (SDCCAR_EXECUTABLE)
+# and must then be forced into the cache.
+# sdcclib has been deprecated in SDCC 3.2.0 and removed in 3.8.6
+# so we first look for sdar
get_filename_component(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH)
-find_program(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH)
-find_program(SDCCLIB_EXECUTABLE sdcclib)
-set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
+find_program(SDCCAR_EXECUTABLE sdar NAMES sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH)
+find_program(SDCCAR_EXECUTABLE sdar NAMES sdcclib)
+# for compatibility, in case SDCCLIB_EXECUTABLE is set, we use it
+if(DEFINED SDCCLIB_EXECUTABLE)
+ set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
+else()
+ set(CMAKE_AR "${SDCCAR_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
+endif()
+
+
+if("${SDCCAR_EXECUTABLE}" MATCHES "sdcclib")
+ set(CMAKE_AR_OPTIONS "-a")
+else()
+ set(CMAKE_AR_OPTIONS "-rc")
+endif()
# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file
if(NOT DEFINED CMAKE_C_FLAGS_INIT)
@@ -45,10 +59,10 @@ set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o
# link object files to an executable
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <OBJECTS> -o <TARGET> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
-# needs sdcc 2.7.0 + sddclib from cvs
+# needs sdcc + sdar/sdcclib
set(CMAKE_C_CREATE_STATIC_LIBRARY
- "\"${CMAKE_COMMAND}\" -E rm -f <TARGET>"
- "<CMAKE_AR> -a <TARGET> <LINK_FLAGS> <OBJECTS> ")
+ "\"${CMAKE_COMMAND}\" -E remove <TARGET>"
+ "<CMAKE_AR> ${CMAKE_AR_OPTIONS} <TARGET> <LINK_FLAGS> <OBJECTS> ")
# not supported by sdcc
set(CMAKE_C_CREATE_SHARED_LIBRARY "")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 743996f..8a606d4 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 16)
-set(CMake_VERSION_PATCH 20191118)
+set(CMake_VERSION_PATCH 20191119)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 5fdbeab..e71a38f 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -610,7 +610,7 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
{
- std::string wixTemplate = FindTemplate("Internal/CPack/WIX.template.in");
+ std::string wixTemplate = FindTemplate("WIX.template.in");
if (GetOption("CPACK_WIX_TEMPLATE") != 0) {
wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7a6c50b..9530227 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -23,6 +23,7 @@
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmWorkingDirectory.h"
#include "cmXMLSafe.h"
@@ -1254,7 +1255,17 @@ std::string cmCPackGenerator::FindTemplate(const char* name)
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Look for template: " << (name ? name : "(NULL)")
<< std::endl);
+ // Search CMAKE_MODULE_PATH for a custom template.
std::string ffile = this->MakefileMap->GetModulesFile(name);
+ if (ffile.empty()) {
+ // Fall back to our internal builtin default.
+ ffile = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/Internal/CPack/",
+ name);
+ cmSystemTools::ConvertToUnixSlashes(ffile);
+ if (!cmSystemTools::FileExists(ffile)) {
+ ffile.clear();
+ }
+ }
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Found template: " << ffile << std::endl);
return ffile;
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index f90a740..4702639 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -39,8 +39,7 @@ int cmCPackNSISGenerator::PackageFiles()
{
// TODO: Fix nsis to force out file name
- std::string nsisInFileName =
- this->FindTemplate("Internal/CPack/NSIS.template.in");
+ std::string nsisInFileName = this->FindTemplate("NSIS.template.in");
if (nsisInFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer template file."
@@ -48,7 +47,7 @@ int cmCPackNSISGenerator::PackageFiles()
return false;
}
std::string nsisInInstallOptions =
- this->FindTemplate("Internal/CPack/NSIS.InstallOptions.ini.in");
+ this->FindTemplate("NSIS.InstallOptions.ini.in");
if (nsisInInstallOptions.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer options file."
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index cd65694..951c65f 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -240,7 +240,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
const std::string& name, const std::string& dir,
const char* outputFileName /* = 0 */, bool copyOnly /* = false */)
{
- std::string inFName = cmStrCat("Internal/CPack/CPack.", name, ".in");
+ std::string inFName = cmStrCat("CPack.", name, ".in");
std::string inFileName = this->FindTemplate(inFName.c_str());
if (inFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 328aac3..ac3d64d 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -108,7 +108,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
const char* genName)
{
std::string distributionTemplate =
- this->FindTemplate("Internal/CPack/CPack.distribution.dist.in");
+ this->FindTemplate("CPack.distribution.dist.in");
if (distributionTemplate.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find input file: " << distributionTemplate
@@ -364,7 +364,7 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
outName = name.c_str();
}
- std::string inFName = cmStrCat("Internal/CPack/CPack.", name, ".in");
+ std::string inFName = cmStrCat("CPack.", name, ".in");
std::string inFileName = this->FindTemplate(inFName.c_str());
if (inFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index bb0ed4f..a4a5e6f 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -27,8 +27,7 @@ int cmCPackSTGZGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
- std::string inFile =
- this->FindTemplate("Internal/CPack/CPack.STGZ_Header.sh.in");
+ std::string inFile = this->FindTemplate("CPack.STGZ_Header.sh.in");
if (inFile.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find template file: " << inFile << std::endl);
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index d7868f3..dc31623 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -115,7 +115,6 @@ int main(int argc, char const* const* argv)
argc = args.argc();
argv = args.argv();
- cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv[0]);
cmCPackLog log;
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 269e8dd..3557e5c 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -635,7 +635,10 @@ std::string cmExtraCodeLiteGenerator::GetBuildCommand(
if (generator == "NMake Makefiles" || generator == "Ninja") {
ss << make;
} else if (generator == "MinGW Makefiles" || generator == "Unix Makefiles") {
- ss << make << " -f$(ProjectPath)/Makefile -j " << this->CpuCount;
+ ss << make << " -f$(ProjectPath)/Makefile";
+ if (this->CpuCount > 0) {
+ ss << " -j " << this->CpuCount;
+ }
}
if (!targetName.empty()) {
ss << " " << targetName;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 573ad4d..d0b5f9e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3360,19 +3360,20 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
if (this->GetPropertyAsBool("DISABLE_PRECOMPILE_HEADERS")) {
return std::string();
}
+ const cmGeneratorTarget* generatorTarget = this;
+ const char* pchReuseFrom =
+ generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
+
const auto inserted =
this->PchHeaders.insert(std::make_pair(language + config, ""));
if (inserted.second) {
const std::vector<BT<std::string>> headers =
this->GetPrecompileHeaders(config, language);
- if (headers.empty()) {
+ if (headers.empty() && !pchReuseFrom) {
return std::string();
}
std::string& filename = inserted.first->second;
- const cmGeneratorTarget* generatorTarget = this;
- const char* pchReuseFrom =
- generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
if (pchReuseFrom) {
generatorTarget =
this->GetGlobalGenerator()->FindGeneratorTarget(pchReuseFrom);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 154bd8e..40e8d48 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3414,7 +3414,7 @@ bool cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
(root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() ||
obj->GetTarget()->GetPropertyAsBool("XCODE_GENERATE_SCHEME"))) {
const std::string& targetName = obj->GetTarget()->GetName();
- cmXCodeScheme schm(obj, testables[targetName],
+ cmXCodeScheme schm(root, obj, testables[targetName],
this->CurrentConfigurationTypes,
this->XcodeVersion);
schm.WriteXCodeSharedScheme(xcProjDir,
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index e093be0..147f97f 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -7,10 +7,11 @@
#include <set>
#include <utility>
+#include <cm/memory>
+
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cmAlgorithms.h"
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
@@ -94,7 +95,7 @@ public:
/**
* Destructor.
*/
- ~cmLBDepend() { cmDeleteAll(this->DependInformationMap); }
+ ~cmLBDepend() = default;
cmLBDepend(const cmLBDepend&) = delete;
cmLBDepend& operator=(const cmLBDepend&) = delete;
@@ -152,9 +153,9 @@ public:
* Generate dependencies for the file given. Returns a pointer to
* the cmDependInformation object for the file.
*/
- const cmDependInformation* FindDependencies(const char* file)
+ const cmDependInformation* FindDependencies(const std::string& file)
{
- cmDependInformation* info = this->GetDependInformation(file, nullptr);
+ cmDependInformation* info = this->GetDependInformation(file, "");
this->GenerateDependInformation(info);
return info;
}
@@ -203,7 +204,7 @@ protected:
}
// Add this file and all its dependencies.
- this->AddDependency(info, includeFile.c_str());
+ this->AddDependency(info, includeFile);
/// add the cxx file if it exists
std::string cxxFile = includeFile;
std::string::size_type pos = cxxFile.rfind('.');
@@ -254,7 +255,7 @@ protected:
}
}
if (found) {
- this->AddDependency(info, cxxFile.c_str());
+ this->AddDependency(info, cxxFile);
}
}
}
@@ -264,10 +265,10 @@ protected:
/**
* Add a dependency. Possibly walk it for more dependencies.
*/
- void AddDependency(cmDependInformation* info, const char* file)
+ void AddDependency(cmDependInformation* info, const std::string& file)
{
cmDependInformation* dependInfo =
- this->GetDependInformation(file, info->PathOnly.c_str());
+ this->GetDependInformation(file, info->PathOnly);
this->GenerateDependInformation(dependInfo);
info->AddDependencies(dependInfo);
}
@@ -313,7 +314,7 @@ protected:
// Dependency hints have been given. Use them to begin the
// recursion.
for (std::string const& file : cFile.GetDepends()) {
- this->AddDependency(info, file.c_str());
+ this->AddDependency(info, file);
}
// Found dependency information. We are done.
@@ -361,8 +362,8 @@ protected:
* Get an instance of cmDependInformation corresponding to the given file
* name.
*/
- cmDependInformation* GetDependInformation(const char* file,
- const char* extraPath)
+ cmDependInformation* GetDependInformation(const std::string& file,
+ const std::string& extraPath)
{
// Get the full path for the file so that lookup is unambiguous.
std::string fullPath = this->FullPath(file, extraPath);
@@ -371,15 +372,16 @@ protected:
auto result = this->DependInformationMap.find(fullPath);
if (result != this->DependInformationMap.end()) {
// Found an instance, return it.
- return result->second;
+ return result->second.get();
}
// Didn't find an instance. Create a new one and save it.
- cmDependInformation* info = new cmDependInformation;
+ auto info = cm::make_unique<cmDependInformation>();
+ auto ptr = info.get();
info->FullPath = fullPath;
info->PathOnly = cmSystemTools::GetFilenamePath(fullPath);
info->IncludeName = file;
- this->DependInformationMap[fullPath] = info;
- return info;
+ this->DependInformationMap[fullPath] = std::move(info);
+ return ptr;
}
/**
@@ -387,14 +389,9 @@ protected:
* This uses the include directories.
* TODO: Cache path conversions to reduce FileExists calls.
*/
- std::string FullPath(const char* fname, const char* extraPath)
+ std::string FullPath(const std::string& fname, const std::string& extraPath)
{
- DirectoryToFileToPathMapType::iterator m;
- if (extraPath) {
- m = this->DirectoryToFileToPathMap.find(extraPath);
- } else {
- m = this->DirectoryToFileToPathMap.find("");
- }
+ auto m = this->DirectoryToFileToPathMap.find(extraPath);
if (m != this->DirectoryToFileToPathMap.end()) {
FileToPathMapType& map = m->second;
@@ -406,7 +403,7 @@ protected:
if (cmSystemTools::FileExists(fname, true)) {
std::string fp = cmSystemTools::CollapseFullPath(fname);
- this->DirectoryToFileToPathMap[extraPath ? extraPath : ""][fname] = fp;
+ this->DirectoryToFileToPathMap[extraPath][fname] = fp;
return fp;
}
@@ -418,12 +415,12 @@ protected:
if (cmSystemTools::FileExists(path, true) &&
!cmSystemTools::FileIsDirectory(path)) {
std::string fp = cmSystemTools::CollapseFullPath(path);
- this->DirectoryToFileToPathMap[extraPath ? extraPath : ""][fname] = fp;
+ this->DirectoryToFileToPathMap[extraPath][fname] = fp;
return fp;
}
}
- if (extraPath) {
+ if (!extraPath.empty()) {
std::string path = extraPath;
if (!path.empty() && path.back() != '/') {
path = path + "/";
@@ -438,7 +435,7 @@ protected:
}
// Couldn't find the file.
- return std::string(fname);
+ return fname;
}
cmMakefile* Makefile;
@@ -449,7 +446,8 @@ protected:
using FileToPathMapType = std::map<std::string, std::string>;
using DirectoryToFileToPathMapType =
std::map<std::string, FileToPathMapType>;
- using DependInformationMapType = std::map<std::string, cmDependInformation*>;
+ using DependInformationMapType =
+ std::map<std::string, std::unique_ptr<cmDependInformation>>;
DependInformationMapType DependInformationMap;
DirectoryToFileToPathMapType DirectoryToFileToPathMap;
};
@@ -476,7 +474,7 @@ bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args,
md.SetMakefile(&status.GetMakefile());
md.AddSearchPath(status.GetMakefile().GetCurrentSourceDirectory());
// find the depends for a file
- const cmDependInformation* info = md.FindDependencies(file.c_str());
+ const cmDependInformation* info = md.FindDependencies(file);
if (info) {
// write them out
FILE* fout = cmsys::SystemTools::Fopen(outputFile, "w");
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 92c80bb..da32204 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -290,7 +290,10 @@ class cmMakefile;
SELECT(POLICY, CMP0097, \
"ExternalProject_Add with GIT_SUBMODULES \"\" initializes no " \
"submodules.", \
- 3, 16, 0, cmPolicies::WARN)
+ 3, 16, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0098, \
+ "FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing.", 3, \
+ 17, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index c4a4220..17d32c6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -814,6 +814,8 @@ void cmSystemTools::InitializeLibUV()
# else
_fmode = _O_TEXT;
# endif
+ // Replace libuv's report handler with our own to suppress popups.
+ cmSystemTools::EnableMSVCDebugHook();
#endif
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 05c9e6e..b9bf7a5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -371,6 +371,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP");
initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER");
initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP");
+ initProp("XCODE_SCHEME_WORKING_DIRECTORY");
initProp("XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER");
initProp("XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP");
initProp("XCODE_SCHEME_MALLOC_SCRIBBLE");
@@ -1288,11 +1289,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
reusedTarget->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
cmStrCat(reusedFrom, ".dir/").c_str());
- for (auto p : { "COMPILE_PDB_NAME", "PRECOMPILE_HEADERS",
- "INTERFACE_PRECOMPILE_HEADERS" }) {
- this->SetProperty(p, reusedTarget->GetProperty(p));
- }
-
+ this->SetProperty("COMPILE_PDB_NAME",
+ reusedTarget->GetProperty("COMPILE_PDB_NAME"));
this->AddUtility(reusedFrom, impl->Makefile);
} else {
impl->Properties.SetProperty(prop, value);
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index afc95f5..b34c2f6 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -8,13 +8,16 @@
#include <utility>
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmXMLSafe.h"
-cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests,
+cmXCodeScheme::cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj,
+ TestObjects tests,
const std::vector<std::string>& configList,
unsigned int xcVersion)
- : Target(xcObj)
+ : LocalGenerator(lg)
+ , Target(xcObj)
, Tests(std::move(tests))
, TargetName(xcObj->GetTarget()->GetName())
, ConfigList(configList)
@@ -135,7 +138,8 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.Attribute("selectedLauncherIdentifier",
"Xcode.DebuggerFoundation.Launcher.LLDB");
xout.Attribute("launchStyle", "0");
- xout.Attribute("useCustomWorkingDirectory", "NO");
+ WriteCustomWorkingDirectory(xout, configuration);
+
xout.Attribute("ignoresPersistentStateOnLaunch", "NO");
WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
"XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING",
@@ -355,7 +359,7 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
xout.Attribute("buildConfiguration", configuration);
xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES");
xout.Attribute("savedToolIdentifier", "");
- xout.Attribute("useCustomWorkingDirectory", "NO");
+ WriteCustomWorkingDirectory(xout, configuration);
WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
"XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING",
true);
@@ -395,6 +399,22 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
xout.EndElement();
}
+void cmXCodeScheme::WriteCustomWorkingDirectory(
+ cmXMLWriter& xout, const std::string& configuration)
+{
+ std::string propertyValue = this->Target->GetTarget()->GetSafeProperty(
+ "XCODE_SCHEME_WORKING_DIRECTORY");
+ if (propertyValue.empty()) {
+ xout.Attribute("useCustomWorkingDirectory", "NO");
+ } else {
+ xout.Attribute("useCustomWorkingDirectory", "YES");
+
+ auto customWorkingDirectory = cmGeneratorExpression::Evaluate(
+ propertyValue, this->LocalGenerator, configuration);
+ xout.Attribute("customWorkingDirectory", customWorkingDirectory);
+ }
+}
+
std::string cmXCodeScheme::WriteVersionString()
{
std::ostringstream v;
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index dff5e35..da40856 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -20,7 +20,7 @@ class cmXCodeScheme
public:
using TestObjects = std::vector<const cmXCodeObject*>;
- cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests,
+ cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj, TestObjects tests,
const std::vector<std::string>& configList,
unsigned int xcVersion);
@@ -28,6 +28,7 @@ public:
const std::string& container);
private:
+ cmLocalGenerator* const LocalGenerator;
const cmXCodeObject* const Target;
const TestObjects Tests;
const std::string& TargetName;
@@ -63,6 +64,9 @@ private:
void WriteBuildableReference(cmXMLWriter& xout, const cmXCodeObject* xcObj,
const std::string& container);
+ void WriteCustomWorkingDirectory(cmXMLWriter& xout,
+ const std::string& configuration);
+
std::string WriteVersionString();
std::string FindConfiguration(const std::string& name);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index baf975e..d817971 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -683,7 +683,6 @@ int main(int ac, char const* const* av)
ac = args.argc();
av = args.argv();
- cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(av[0]);
if (ac > 1) {
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index a7b11cd..a9fcc84 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -164,7 +164,6 @@ int main(int argc, char const* const* argv)
argv = encoding_args.argv();
cmSystemTools::DoNotInheritStdPipes();
- cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv[0]);
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index dcf05da..39873e6 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4666,8 +4666,12 @@ void SystemTools::ClassFinalize()
# include <stdlib.h>
namespace KWSYS_NAMESPACE {
-static int SystemToolsDebugReport(int, char* message, int*)
+static int SystemToolsDebugReport(int, char* message, int* ret)
{
+ if (ret) {
+ // Pretend user clicked on Retry button in popup.
+ *ret = 1;
+ }
fprintf(stderr, "%s", message);
fflush(stderr);
return 1; // no further reporting required
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
index 4502456..03a97ed 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
@@ -1,8 +1,12 @@
cmake_minimum_required(VERSION 3.15)
project(PchReuseFrom C)
+if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
+ add_definitions(-DHAVE_PCH_SUPPORT)
+endif()
+
add_library(empty empty.c)
-target_precompile_headers(empty PUBLIC
+target_precompile_headers(empty PRIVATE
<stdio.h>
<string.h>
)
@@ -12,6 +16,9 @@ add_library(foo foo.c)
target_include_directories(foo PUBLIC include)
target_precompile_headers(foo REUSE_FROM empty)
+# should not cause problems if configured multiple times
+target_precompile_headers(foo REUSE_FROM empty)
+
add_executable(foobar foobar.c)
target_link_libraries(foobar foo )
set_target_properties(foobar PROPERTIES PRECOMPILE_HEADERS_REUSE_FROM foo)
diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c
index 7a135ea..97d465c 100644
--- a/Tests/RunCMake/PrecompileHeaders/foobar.c
+++ b/Tests/RunCMake/PrecompileHeaders/foobar.c
@@ -4,5 +4,11 @@
int main()
{
- return foo() + foo2() + bar();
+ int zeroSize = 0;
+
+#ifdef HAVE_PCH_SUPPORT
+ zeroSize = (int)strlen("");
+#endif
+
+ return foo() + foo2() + bar() + zeroSize;
}
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
index 7d83a70..c742f50 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -45,6 +45,7 @@ check_property("ENVIRONMENT" [=[key="FOO"]=])
check_property("ENVIRONMENT" [=[value="foo"]=])
check_property("ENVIRONMENT" [=[key="BAR"]=])
check_property("ENVIRONMENT" [=[value="bar"]=])
+check_property("WORKING_DIRECTORY" [=["/working/dir"]=])
expect_no_schema("NoSchema")
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
index be219f4..ce5c0c9 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -35,6 +35,7 @@ endfunction()
create_scheme_for_property(EXECUTABLE myExecutable)
create_scheme_for_property(ARGUMENTS "--foo;--bar=baz")
create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar")
+create_scheme_for_property(WORKING_DIRECTORY "/working/dir")
add_executable(NoSchema main.cpp)
set_target_properties(NoSchema PROPERTIES XCODE_GENERATE_SCHEME OFF)