diff options
89 files changed, 665 insertions, 286 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index d881a66..b45a079 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -271,35 +271,40 @@ The options are: ``DEPFILE`` .. versionadded:: 3.7 - Specify a ``.d`` depfile for the :generator:`Ninja`, :generator:`Xcode` and - :ref:`Makefile <Makefile Generators>` generators. The depfile may use - "generator expressions" with the syntax ``$<...>``. See the - :manual:`generator-expressions(7) <cmake-generator-expressions(7)>` manual - for available expressions. A ``.d`` file holds dependencies usually emitted - by the custom command itself. + Specify a ``.d`` depfile which holds dependencies for the custom command. + It is usually emitted by the custom command itself. This keyword may only + be used if the generator supports it, as detailed below. - Using ``DEPFILE`` with other generators than :generator:`Ninja`, - :generator:`Xcode` or :ref:`Makefile <Makefile Generators>` is an error. + .. versionadded:: 3.7 + The :generator:`Ninja` generator supports ``DEPFILE`` since the keyword + was first added. + + .. versionadded:: 3.17 + Added the :generator:`Ninja Multi-Config` generator, which included + support for the ``DEPFILE`` keyword. .. versionadded:: 3.20 Added support for :ref:`Makefile Generators`. + .. note:: + + ``DEPFILE`` cannot be specified at the same time as the + ``IMPLICIT_DEPENDS`` option for :ref:`Makefile Generators`. + .. versionadded:: 3.21 Added support for :ref:`Visual Studio Generators` with VS 2012 and above, - for the :generator:`Xcode` generator, and for - :manual:`generator expressions <cmake-generator-expressions(7)>`. + and for the :generator:`Xcode` generator. Support for + :manual:`generator expressions <cmake-generator-expressions(7)>` was also + added. + + Using ``DEPFILE`` with generators other than those listed above is an error. If the ``DEPFILE`` argument is relative, it should be relative to :variable:`CMAKE_CURRENT_BINARY_DIR`, and any relative paths inside the - ``DEPFILE`` should also be relative to :variable:`CMAKE_CURRENT_BINARY_DIR` - (see policy :policy:`CMP0116`. This policy is always ``NEW`` for + ``DEPFILE`` should also be relative to :variable:`CMAKE_CURRENT_BINARY_DIR`. + See policy :policy:`CMP0116`, which is always ``NEW`` for :ref:`Makefile Generators`, :ref:`Visual Studio Generators`, - and the :generator:`Xcode` generator). - - .. note:: - - For :ref:`Makefile Generators`, this option cannot be specified at the - same time as ``IMPLICIT_DEPENDS`` option. + and the :generator:`Xcode` generator. Examples: Generating Files ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 9c4df22..4e5484f 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -155,12 +155,12 @@ The options are: Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. -``OUTPUT_JUNIT`` +``OUTPUT_JUNIT <file>`` .. versionadded:: 3.21 Write test results to ``<file>`` in JUnit XML format. If ``<file>`` is a - relative path it will be placed in the build directory. If ``<file>>`` - already exists it will be overwritten. Note that the resulting JUnit XML + relative path, it will be placed in the build directory. If ``<file>`` + already exists, it will be overwritten. Note that the resulting JUnit XML file is **not** uploaded to CDash because it would be redundant with CTest's ``Test.xml`` file. diff --git a/Help/command/file.rst b/Help/command/file.rst index 943bf7c..f038871 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -38,10 +38,10 @@ Synopsis `Filesystem`_ file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...]) + file(`MAKE_DIRECTORY`_ [<dir>...]) + file({`REMOVE`_ | `REMOVE_RECURSE`_ } [<files>...]) file(`RENAME`_ <oldname> <newname> [...]) file(`COPY_FILE`_ <oldname> <newname> [...]) - file({`REMOVE`_ | `REMOVE_RECURSE`_ } [<files>...]) - file(`MAKE_DIRECTORY`_ [<dir>...]) file({`COPY`_ | `INSTALL`_} <file>... DESTINATION <dir> [...]) file(`SIZE`_ <filename> <out-var>) file(`READ_SYMLINK`_ <linkname> <out-var>) @@ -691,6 +691,32 @@ Examples of recursive globbing include:: /dir/*.py - match all python files in /dir and subdirectories +.. _MAKE_DIRECTORY: + +.. code-block:: cmake + + file(MAKE_DIRECTORY [<directories>...]) + +Create the given directories and their parents as needed. + +.. _REMOVE: +.. _REMOVE_RECURSE: + +.. code-block:: cmake + + file(REMOVE [<files>...]) + file(REMOVE_RECURSE [<files>...]) + +Remove the given files. The ``REMOVE_RECURSE`` mode will remove the given +files and directories, also non-empty directories. No error is emitted if a +given file does not exist. Relative input paths are evaluated with respect +to the current source directory. + +.. versionchanged:: 3.15 + Empty input paths are ignored with a warning. Previous versions of CMake + interpreted empty strings as a relative path with respect to the current + directory and removed its contents. + .. _RENAME: .. code-block:: cmake @@ -725,6 +751,8 @@ The options are: [RESULT <result>] [ONLY_IF_DIFFERENT]) +.. versionadded:: 3.21 + 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. @@ -736,34 +764,17 @@ The options are: 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: - -.. code-block:: cmake - - file(REMOVE [<files>...]) - file(REMOVE_RECURSE [<files>...]) - -Remove the given files. The ``REMOVE_RECURSE`` mode will remove the given -files and directories, also non-empty directories. No error is emitted if a -given file does not exist. Relative input paths are evaluated with respect -to the current source directory. - -.. versionchanged:: 3.15 - Empty input paths are ignored with a warning. Previous versions of CMake - interpreted empty string as a relative path with respect to the current - directory and removed its contents. - -.. _MAKE_DIRECTORY: + If the ``<newname>`` path already exists, do not replace it if the file's + contents are already the same as ``<oldname>`` (this avoids updating + ``<newname>``'s timestamp). -.. code-block:: cmake - - file(MAKE_DIRECTORY [<directories>...]) +This sub-command has some similarities to :command:`configure_file` with the +``COPYONLY`` option. An important difference is that :command:`configure_file` +creates a dependency on the source file, so CMake will be re-run if it changes. +The ``file(COPY_FILE)`` sub-command does not create such a dependency. -Create the given directories and their parents as needed. +See also the ``file(COPY)`` sub-command just below which provides +further file-copying capabilities. .. _COPY: .. _INSTALL: @@ -779,6 +790,11 @@ Create the given directories and their parents as needed. [[PATTERN <pattern> | REGEX <regex>] [EXCLUDE] [PERMISSIONS <permissions>...]] [...]) +.. note:: + + For a simple file copying operation, the ``file(COPY_FILE)`` sub-command + just above may be easier to use. + The ``COPY`` signature copies files, directories, and symlinks to a destination folder. Relative input paths are evaluated with respect to the current source directory, and a relative destination is diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index ac231bc..c85094a 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -300,7 +300,7 @@ The object files associated with an object library may be referenced by the :genex:`$<TARGET_OBJECTS>` generator expression. Such object files are placed on the link line *before* all libraries, regardless of their relative order. Additionally, an ordering dependency will be -added to the build sysstem to make sure the object library is up-to-date +added to the build system to make sure the object library is up-to-date before the dependent target links. For example, the code .. code-block:: cmake diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index c55bb58..7cfa0c8 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -53,6 +53,7 @@ Variables that Provide Information /variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION /variable/CMAKE_EDIT_COMMAND /variable/CMAKE_EXECUTABLE_SUFFIX + /variable/CMAKE_EXECUTABLE_SUFFIX_LANG /variable/CMAKE_EXTRA_GENERATOR /variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES /variable/CMAKE_FIND_DEBUG_MODE diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index ab819f9..03d8bf6 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -137,8 +137,10 @@ Options ``--output-junit <file>`` Write test results in JUnit format. - This option tells CTest to write test results to a ``<file>`` JUnit XML file. - If ``<file>`` already exists it will be overwritten. + This option tells CTest to write test results to ``<file>`` in JUnit XML + format. If ``<file>`` already exists, it will be overwritten. If using the + ``-S`` option to run a dashboard script, use the ``OUTPUT_JUNIT`` keyword + with the :command:`ctest_test` command instead. ``-N,--show-only[=<format>]`` Disable actual execution of tests. diff --git a/Help/policy/CMP0077.rst b/Help/policy/CMP0077.rst index 174cde9..d8744a9 100644 --- a/Help/policy/CMP0077.rst +++ b/Help/policy/CMP0077.rst @@ -46,6 +46,10 @@ name: variable of the same name exists. The normal variable is not removed. The cache entry is not created or updated and is ignored if it exists. +See :policy:`CMP0126` for a similar policy for the :command:`set(CACHE)` +command, but note that there are some differences in ``NEW`` behavior +between the two policies. + This policy was introduced in CMake version 3.13. 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`` diff --git a/Help/policy/CMP0124.rst b/Help/policy/CMP0124.rst index 88d03e3..3935166 100644 --- a/Help/policy/CMP0124.rst +++ b/Help/policy/CMP0124.rst @@ -3,14 +3,12 @@ CMP0124 .. versionadded:: 3.21 -The loop variables created by :command:`foreach` command have now their scope -restricted to the loop scope. +When this policy is set to ``NEW``, the scope of loop variables defined by the +:command:`foreach` command is restricted to the loop only. They will be unset +at the end of the loop. -Starting with CMake 3.21, the :command:`foreach` command ensures that the loop -variables have their scope restricted to the loop scope. - -The ``OLD`` behavior for this policy let the loop variables to exist, with an -empty value, in the outer scope of loop scope. +The ``OLD`` behavior for this policy still clears the loop variables at the end +of the loop, but does not unset them. This leaves them as defined, but empty. This policy was introduced in CMake version 3.21. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/policy/CMP0125.rst b/Help/policy/CMP0125.rst index 19571dc..0b1704e 100644 --- a/Help/policy/CMP0125.rst +++ b/Help/policy/CMP0125.rst @@ -4,18 +4,35 @@ CMP0125 .. versionadded:: 3.21 The :command:`find_file`, :command:`find_path`, :command:`find_library` and -:command:`find_program` commands handle cache variables in the same way -regardless of whether they are defined on the command line, with or without a -type, or using the :command:`set` command. - -Starting with CMake 3.21, the :command:`find_file`, :command:`find_path`, -:command:`find_library`, and :command:`find_program` commands ensure that the -cache variables will be used in the same way regardless how they were defined -and the result will be always successful if the searched artifact exists. - -The ``OLD`` behavior for this policy is to have the find commands' behaviors -differ depending on how the cache variable is defined. The ``NEW`` behavior for -this policy is to have consistent behavior. +:command:`find_program` commands cache their result in the variable specified +by their first argument. Prior to CMake 3.21, if a cache variable of that +name already existed before the call but the cache variable had no type, any +non-cache variable of the same name would be discarded and the cache variable +was always used (see also :policy:`CMP0126` for a different but similar +behavior). This contradicts the convention that a non-cache variable should +take precedence over a cache variable of the same name. Such a situation can +arise if a user sets a cache variable on the command line without specifying +a type, such as ``cmake -DMYVAR=blah ...`` instead of +``cmake -DMYVAR:FILEPATH=blah``. + +Related to the above, if a cache variable of the specified name already exists +and it *does* have a type, the various ``find_...()`` commands would return +that value unchanged. In particular, if it contained a relative path, it +would not be converted to an absolute path in this situation. + +When policy ``CMP0125`` is set to ``OLD`` or is unset, the behavior is as +described above. When it is set to ``NEW``, the behavior is as follows: + +* If a non-cache variable of the specified name exists when the ``find_...()`` + command is called, its value will be used regardless of whether a cache + variable of the same name already exists or not. A cache variable will not + be created in this case if no such cache variable existed before. + If a cache variable of the specified name did already exist, the cache will + be updated to match the non-cache variable. + +* The various ``find...()`` commands will always provide an absolute path in + the result variable, except where a relative path provided by a cache or + non-cache variable cannot be resolved to an existing path. This policy was introduced in CMake version 3.21. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/policy/CMP0126.rst b/Help/policy/CMP0126.rst index 0ced8fa..ba027b3 100644 --- a/Help/policy/CMP0126.rst +++ b/Help/policy/CMP0126.rst @@ -3,16 +3,25 @@ CMP0126 .. versionadded:: 3.21 -The :command:`set(CACHE)` does not remove a normal variable of the same name. +When this policy is set to ``NEW``, the :command:`set(CACHE)` command does not +remove any normal variable of the same name from the current scope. +The ``OLD`` behavior removes any normal variable of the same name from the +current scope in the following situations: -Starting with CMake 3.21, the :command:`set(CACHE)` does not remove, in the -current scope, any normal variable with the same name. +* No cache variable of that name existed previously. -The ``OLD`` behavior for this policy is to have the :command:`set(CACHE)` -command removing the normal variable of the same name, if any. The ``NEW`` -behavior for this policy is to keep the normal variable of the same name. +* A cache variable of that name existed previously, but it had no type. + This can occur when the variable was set on the command line using a form + like ``cmake -DMYVAR=blah`` instead of ``cmake -DMYVAR:STRING=blah``. -This policy was introduced in CMake version 3.21. Use the +Note that the ``NEW`` behavior has an important difference to the similar +``NEW`` behavior of policy :policy:`CMP0077`. The :command:`set(CACHE)` +command always sets the cache variable if it did not exist previously, +regardless of the ``CMP0126`` policy setting. The :command:`option` command +will *not* set the cache variable if a non-cache variable of the same name +already exists and :policy:`CMP0077` is set to ``NEW``. + +Policy ``CMP0126`` was introduced in CMake version 3.21. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. Unlike many policies, CMake version |release| does *not* warn when the policy is not set and simply uses ``OLD`` behavior. See documentation of the diff --git a/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst b/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst index 356590f..bc4b9df 100644 --- a/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst +++ b/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst @@ -6,4 +6,5 @@ The suffix for executables on this platform. The suffix to use for the end of an executable filename if any, ``.exe`` on Windows. -``CMAKE_EXECUTABLE_SUFFIX_<LANG>`` overrides this for language ``<LANG>``. +:variable:`CMAKE_EXECUTABLE_SUFFIX_<LANG>` overrides this for +language ``<LANG>``. diff --git a/Help/variable/CMAKE_EXECUTABLE_SUFFIX_LANG.rst b/Help/variable/CMAKE_EXECUTABLE_SUFFIX_LANG.rst new file mode 100644 index 0000000..a68150e --- /dev/null +++ b/Help/variable/CMAKE_EXECUTABLE_SUFFIX_LANG.rst @@ -0,0 +1,7 @@ +CMAKE_EXECUTABLE_SUFFIX_<LANG> +------------------------------ + +The suffix to use for the end of an executable filename of ``<LANG>`` +compiler target architecture, if any. + +It overrides :variable:`CMAKE_EXECUTABLE_SUFFIX` for language ``<LANG>``. diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst index 9f145c1..7e7d431 100644 --- a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst @@ -9,3 +9,6 @@ If a test's output contains the literal string "CTEST_FULL_OUTPUT", the output will not be truncated and may exceed the maximum size. .. include:: CTEST_CUSTOM_XXX.txt + +For controlling the output collection of passing tests, see +:variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE`. diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst index 71ecf52..64367f9 100644 --- a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst @@ -9,3 +9,6 @@ If a test's output contains the literal string "CTEST_FULL_OUTPUT", the output will not be truncated and may exceed the maximum size. .. include:: CTEST_CUSTOM_XXX.txt + +For controlling the output collection of failing tests, see +:variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE`. diff --git a/Help/variable/PROJECT_IS_TOP_LEVEL.rst b/Help/variable/PROJECT_IS_TOP_LEVEL.rst index ad61fec..7e40704 100644 --- a/Help/variable/PROJECT_IS_TOP_LEVEL.rst +++ b/Help/variable/PROJECT_IS_TOP_LEVEL.rst @@ -3,7 +3,8 @@ PROJECT_IS_TOP_LEVEL .. versionadded:: 3.21 -A boolean variable indicating whether :command:`project` was called in a top +A boolean variable indicating whether the most recently called +:command:`project` command in the current scope or above was in the top level ``CMakeLists.txt`` file. Some modules should only be included as part of the top level diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake index 0a291f2..96855d2 100644 --- a/Modules/CMakeDependentOption.cmake +++ b/Modules/CMakeDependentOption.cmake @@ -42,10 +42,7 @@ macro(CMAKE_DEPENDENT_OPTION option doc default depends force) if(${option}_ISSET MATCHES "^${option}_ISSET$") set(${option}_AVAILABLE 1) foreach(d ${depends}) - string(REPLACE "(" " ( " _CMAKE_CDO_DEP "${d}") - string(REPLACE ")" " ) " _CMAKE_CDO_DEP "${_CMAKE_CDO_DEP}") - string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${_CMAKE_CDO_DEP}") - unset(_CMAKE_CDO_DEP) + string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}") if(${CMAKE_DEPENDENT_OPTION_DEP}) else() set(${option}_AVAILABLE 0) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index fb5d773..16243c7 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -1015,9 +1015,6 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) endif() endif() - if(NOT DEFINED CMAKE_EXECUTABLE_FORMAT) - set(CMAKE_EXECUTABLE_FORMAT) - endif() # Return the information extracted. set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) @@ -1029,7 +1026,6 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(CMAKE_${lang}_COMPILER_WRAPPER "${COMPILER_WRAPPER}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) - set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE) set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) endfunction() diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 3162ec5..f139ff4 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -94,6 +94,53 @@ elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^x(Open)?W set(_CMAKE_AR_NAMES "wlib") list(APPEND _CMAKE_TOOL_VARS LINKER AR) +elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIAR$") + # Small helper declaring an IAR tool (e.g. linker) to avoid repeating the same idiom every time + macro(__append_IAR_tool TOOL_VAR NAME) + set(_CMAKE_${TOOL_VAR}_NAMES "${NAME}" "${NAME}.exe") + list(APPEND _CMAKE_TOOL_VARS ${TOOL_VAR}) + endmacro() + + # Resolve hint path from an IAR compiler + function(__resolve_IAR_hints COMPILER RESULT) + get_filename_component(_CMAKE_IAR_HINT "${COMPILER}" REALPATH) + get_filename_component(_CMAKE_IAR_HINT "${_CMAKE_IAR_HINT}" DIRECTORY) + list(APPEND _IAR_HINTS "${_CMAKE_IAR_HINT}") + + get_filename_component(_CMAKE_IAR_HINT "${COMPILER}" DIRECTORY) + list(APPEND _IAR_HINTS "${_CMAKE_IAR_HINT}") + + set(${RESULT} "${_IAR_HINTS}" PARENT_SCOPE) + endfunction() + + __resolve_IAR_hints("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" _CMAKE_TOOLCHAIN_LOCATION) + set(_CMAKE_IAR_ITOOLS "ARM" "RX" "RH850" "RL78" "RISCV" "STM8") + set(_CMAKE_IAR_XTOOLS "AVR" "MSP430" "V850" "8051") + + if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) + string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _CMAKE_IAR_LOWER_ARCHITECTURE_ID) + + __append_IAR_tool(AR "iarchive") + __append_IAR_tool(LINKER "ilink${_CMAKE_IAR_LOWER_ARCHITECTURE_ID}") + + __append_IAR_tool(IAR_ELFDUMP "ielfdump${_CMAKE_IAR_LOWER_ARCHITECTURE_ID}") + __append_IAR_tool(IAR_ELFTOOL "ielftool") + __append_IAR_tool(IAR_OBJMANIP "iobjmanip") + __append_IAR_tool(IAR_SYMEXPORT "isymexport") + + unset(_CMAKE_IAR_LOWER_ARCHITECTURE_ID) + + elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_XTOOLS) + __append_IAR_tool(AR "xar") + __append_IAR_tool(LINKER "xlink") + + else() + message(FATAL_ERROR "Failed to find linker and librarian for ${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID} on ${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}.") + endif() + + unset(_CMAKE_IAR_ITOOLS) + unset(_CMAKE_IAR_XTOOLS) + # in all other cases search for ar, ranlib, etc. else() if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN) @@ -186,3 +233,10 @@ unset(_CMAKE_TOOL_VARS) unset(_CMAKE_TOOL_CACHED) unset(_CMAKE_TOOL_NAME) unset(_CMAKE_TOOL) + +if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIAR$") + # Set for backwards compatibility + set(CMAKE_IAR_ARCHIVE "${CMAKE_AR}" CACHE FILEPATH "The IAR archiver") + set(CMAKE_IAR_LINKER "${CMAKE_LINKER}" CACHE FILEPATH "The IAR ILINK linker") + mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_AR) +endif() diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 39e9c72..03e8d2b 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -42,8 +42,8 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) 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") + set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x") + set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x") endif() __compiler_check_default_language_standard(C 3.4 90 5.0 11 8.1 17) diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake deleted file mode 100644 index 6c67d34..0000000 --- a/Modules/Compiler/IAR-FindBinUtils.cmake +++ /dev/null @@ -1,64 +0,0 @@ -if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "") - message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set") -endif() - -# Try to find tools in the same directory as the compiler itself -get_filename_component(__iar_hint_1 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" REALPATH) -get_filename_component(__iar_hint_1 "${__iar_hint_1}" DIRECTORY) - -get_filename_component(__iar_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY) - -set(__iar_hints "${__iar_hint_1}" "${__iar_hint_2}") - -if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8") - - string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _archid_lower) - - # Find linker - find_program(CMAKE_IAR_LINKER ilink${_archid_lower} HINTS ${__iar_hints} - DOC "The IAR ILINK linker") - find_program(CMAKE_IAR_ARCHIVE iarchive HINTS ${__iar_hints} - DOC "The IAR archiver") - - # Find utility tools - find_program(CMAKE_IAR_ELFTOOL ielftool HINTS ${__iar_hints} - DOC "The IAR ELF Tool") - find_program(CMAKE_IAR_ELFDUMP ielfdump${_archid_lower} HINTS ${__iar_hints} - DOC "The IAR ELF Dumper") - find_program(CMAKE_IAR_OBJMANIP iobjmanip HINTS ${__iar_hints} - DOC "The IAR ELF Object Tool") - find_program(CMAKE_IAR_SYMEXPORT isymexport HINTS ${__iar_hints} - DOC "The IAR Absolute Symbol Exporter") - mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_ARCHIVE CMAKE_IAR_ELFTOOL CMAKE_IAR_ELFDUMP CMAKE_IAR_OBJMANIP CMAKE_IAR_SYMEXPORT) - - set(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_CUSTOM_CODE -"set(CMAKE_IAR_LINKER \"${CMAKE_IAR_LINKER}\") -set(CMAKE_IAR_ARCHIVE \"${CMAKE_IAR_ARCHIVE}\") -set(CMAKE_IAR_ELFTOOL \"${CMAKE_IAR_ELFTOOL}\") -set(CMAKE_IAR_ELFDUMP \"${CMAKE_IAR_ELFDUMP}\") -set(CMAKE_IAR_OBJMANIP \"${CMAKE_IAR_OBJMANIP}\") -set(CMAKE_IAR_LINKER \"${CMAKE_IAR_LINKER}\") -") - -elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051") - - # Find the "xlink" linker and "xar" archiver: - find_program(CMAKE_IAR_LINKER xlink HINTS ${__iar_hints} - DOC "The IAR XLINK linker") - find_program(CMAKE_IAR_AR xar HINTS ${__iar_hints} - DOC "The IAR archiver") - mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_AR) - - set(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_CUSTOM_CODE -"set(CMAKE_IAR_LINKER \"${CMAKE_IAR_LINKER}\") -set(CMAKE_IAR_AR \"${CMAKE_IAR_AR}\") -") -endif() diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 8bfc3ef..2200a21 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -41,7 +41,7 @@ include_guard() macro(__compiler_iar_ilink lang) - set(CMAKE_EXECUTABLE_SUFFIX ".elf") + set(CMAKE_EXECUTABLE_SUFFIX_${lang} ".elf") set(CMAKE_${lang}_OUTPUT_EXTENSION ".o") if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") @@ -71,13 +71,10 @@ macro(__compiler_iar_ilink lang) set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> <TARGET> --replace <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_FINISH "") - - set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE) - set(CMAKE_AR "${CMAKE_IAR_ARCHIVE}" CACHE FILEPATH "The IAR archiver" FORCE) endmacro() macro(__compiler_iar_xlink lang) - set(CMAKE_EXECUTABLE_SUFFIX ".bin") + set(CMAKE_EXECUTABLE_SUFFIX_${lang} ".bin") if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") @@ -109,7 +106,4 @@ macro(__compiler_iar_xlink lang) set(CMAKE_${lang}_ARCHIVE_FINISH "") set(CMAKE_LIBRARY_PATH_FLAG "-I") - - set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE) - set(CMAKE_AR "${CMAKE_IAR_AR}" CACHE FILEPATH "The IAR archiver" FORCE) endmacro() diff --git a/Modules/FindPatch.cmake b/Modules/FindPatch.cmake index 4108651..f4fe4a6 100644 --- a/Modules/FindPatch.cmake +++ b/Modules/FindPatch.cmake @@ -43,7 +43,7 @@ endif() # First search the PATH find_program(Patch_EXECUTABLE - NAME patch + NAMES patch PATHS ${_patch_path} DOC ${_doc} ) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index d8ba784..6775acb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -398,6 +398,8 @@ set(SRCS cmQtAutoMocUic.h cmQtAutoRcc.cxx cmQtAutoRcc.h + cmQtAutoUicHelpers.cxx + cmQtAutoUicHelpers.h cmRST.cxx cmRST.h cmRuntimeDependencyArchive.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 85be49e..7345e44 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 21) -set(CMake_VERSION_PATCH 20210719) +set(CMake_VERSION_PATCH 20210726) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 8ecf264..bf18143 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -570,6 +570,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, *cmp0123 == "NEW"_s ? "NEW" : "OLD"); } + /* Set cache/normal variable policy to match outer project. + It may affect toolchain files. */ + if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) != + cmPolicies::NEW) { + fprintf(fout, "cmake_policy(SET CMP0126 OLD)\n"); + } + std::string projectLangs; for (std::string const& li : testLangs) { projectLangs += " " + li; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 0cbe637..ef960d1 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -259,6 +259,34 @@ struct cmFindLibraryHelper }; }; +namespace { + +std::string const& get_prefixes(cmMakefile* mf) +{ +#ifdef _WIN32 + static std::string defaultPrefix = ";lib"; +#else + static std::string defaultPrefix = "lib"; +#endif + cmProp prefixProp = mf->GetDefinition("CMAKE_FIND_LIBRARY_PREFIXES"); + return (prefixProp) ? *prefixProp : defaultPrefix; +} + +std::string const& get_suffixes(cmMakefile* mf) +{ +#ifdef _WIN32 + static std::string defaultSuffix = ".lib;.dll.a;.a"; +#elif defined(__APPLE__) + static std::string defaultSuffix = ".tbd;.dylib;.so;.a"; +#elif defined(__hpux) + static std::string defaultSuffix = ".sl;.so;.a"; +#else + static std::string defaultSuffix = ".so;.a"; +#endif + cmProp suffixProp = mf->GetDefinition("CMAKE_FIND_LIBRARY_SUFFIXES"); + return (suffixProp) ? *suffixProp : defaultSuffix; +} +} cmFindLibraryHelper::cmFindLibraryHelper(std::string debugName, cmMakefile* mf, cmFindBase const* base) : Makefile(mf) @@ -268,10 +296,9 @@ cmFindLibraryHelper::cmFindLibraryHelper(std::string debugName, cmMakefile* mf, this->GG = this->Makefile->GetGlobalGenerator(); // Collect the list of library name prefixes/suffixes to try. - std::string const& prefixes_list = - this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_PREFIXES"); - std::string const& suffixes_list = - this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_SUFFIXES"); + std::string const& prefixes_list = get_prefixes(this->Makefile); + std::string const& suffixes_list = get_suffixes(this->Makefile); + cmExpandList(prefixes_list, this->Prefixes, true); cmExpandList(suffixes_list, this->Suffixes, true); this->RegexFromList(this->PrefixRegexStr, this->Prefixes); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index c608bf9..217ebe5 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1635,10 +1635,11 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode reportError(context, content->GetOriginalExpression(), e.str()); return std::string(); } - if (!context->EvaluateForBuildsystem) { - cmGlobalGenerator* gg = context->LG->GetGlobalGenerator(); + cmGlobalGenerator* gg = context->LG->GetGlobalGenerator(); + { std::string reason; - if (!gg->HasKnownObjectFileLocation(&reason)) { + if (!context->EvaluateForBuildsystem && + !gg->HasKnownObjectFileLocation(&reason)) { std::ostringstream e; e << "The evaluation of the TARGET_OBJECTS generator expression " "is only suitable for consumption by CMake (limited" @@ -1664,7 +1665,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode gt->GetTargetObjectNames(context->Config, objects); std::string obj_dir; - if (context->EvaluateForBuildsystem) { + if (context->EvaluateForBuildsystem && !gg->SupportsCrossConfigs()) { // Use object file directory with buildsystem placeholder. obj_dir = gt->ObjectDirectory; context->HadContextSensitiveCondition = diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 57fcd2d..898d862 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -384,3 +384,39 @@ bool cmQtAutoGen::RccLister::list(std::string const& qrcFile, } return true; } + +bool cmQtAutoGen::FileRead(std::string& content, std::string const& filename, + std::string* error) +{ + content.clear(); + if (!cmSystemTools::FileExists(filename, true)) { + if (error != nullptr) { + *error = "Not a file."; + } + return false; + } + + unsigned long const length = cmSystemTools::FileLength(filename); + cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); + + // Use lambda to save destructor calls of ifs + return [&ifs, length, &content, error]() -> bool { + if (!ifs) { + if (error != nullptr) { + *error = "Opening the file for reading failed."; + } + return false; + } + content.reserve(length); + using IsIt = std::istreambuf_iterator<char>; + content.assign(IsIt{ ifs }, IsIt{}); + if (!ifs) { + content.clear(); + if (error != nullptr) { + *error = "Reading from the file failed."; + } + return false; + } + return true; + }(); +} diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 466a954..b9ae360 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -100,6 +100,9 @@ public: std::vector<std::string> const& newOpts, bool isQt5); + static bool FileRead(std::string& content, std::string const& filename, + std::string* error = nullptr); + /** @class RccLister * @brief Lists files in qrc resource files */ diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 4dd78e5..6cc8328 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -902,6 +902,13 @@ bool cmQtAutoGenInitializer::InitScanFiles() // The reason is that their file names might be discovered from source files // at generation time. if (this->MocOrUicEnabled()) { + std::set<std::string> uicIncludes; + auto collectUicIncludes = [&](std::unique_ptr<cmSourceFile> const& sf) { + std::string content; + FileRead(content, sf->GetFullPath()); + this->AutoUicHelpers.CollectUicIncludes(uicIncludes, content); + }; + for (const auto& sf : this->Makefile->GetSourceFiles()) { // sf->GetExtension() is only valid after sf->ResolveFullPath() ... // Since we're iterating over source files that might be not in the @@ -914,6 +921,10 @@ bool cmQtAutoGenInitializer::InitScanFiles() std::string const& extLower = cmSystemTools::LowerCase(sf->GetExtension()); + bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN); + bool const skipUic = + (skipAutogen || sf->GetPropertyAsBool(kw.SKIP_AUTOUIC) || + !this->Uic.Enabled); if (cm->IsAHeaderExtension(extLower)) { if (!cm::contains(this->AutogenTarget.Headers, sf.get())) { auto muf = makeMUFile(sf.get(), fullPath, {}, false); @@ -921,6 +932,9 @@ bool cmQtAutoGenInitializer::InitScanFiles() addMUHeader(std::move(muf), extLower); } } + if (!skipUic && !sf->GetIsGenerated()) { + collectUicIncludes(sf); + } } else if (cm->IsACLikeSourceExtension(extLower)) { if (!cm::contains(this->AutogenTarget.Sources, sf.get())) { auto muf = makeMUFile(sf.get(), fullPath, {}, false); @@ -928,11 +942,11 @@ bool cmQtAutoGenInitializer::InitScanFiles() addMUSource(std::move(muf)); } } + if (!skipUic && !sf->GetIsGenerated()) { + collectUicIncludes(sf); + } } else if (this->Uic.Enabled && (extLower == kw.ui)) { // .ui file - bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN); - bool const skipUic = - (skipAutogen || sf->GetPropertyAsBool(kw.SKIP_AUTOUIC)); if (!skipUic) { // Check if the .ui file has uic options std::string const uicOpts = sf->GetSafeProperty(kw.AUTOUIC_OPTIONS); @@ -942,35 +956,22 @@ bool cmQtAutoGenInitializer::InitScanFiles() this->Uic.UiFilesWithOptions.emplace_back(fullPath, cmExpandedList(uicOpts)); } - - auto uiHeaderRelativePath = cmSystemTools::RelativePath( - this->LocalGen->GetCurrentSourceDirectory(), - cmSystemTools::GetFilenamePath(fullPath)); - - // Avoid creating a path containing adjacent slashes - if (!uiHeaderRelativePath.empty() && - uiHeaderRelativePath.back() != '/') { - uiHeaderRelativePath += '/'; - } - - auto uiHeaderFilePath = cmStrCat( - '/', uiHeaderRelativePath, "ui_"_s, - cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s); - - ConfigString uiHeader; - std::string uiHeaderGenex; - this->ConfigFileNamesAndGenex( - uiHeader, uiHeaderGenex, cmStrCat(this->Dir.Build, "/include"_s), - uiHeaderFilePath); - - this->Uic.UiHeaders.emplace_back( - std::make_pair(uiHeader, uiHeaderGenex)); } else { // Register skipped .ui file this->Uic.SkipUi.insert(fullPath); } } } + + for (const auto& include : uicIncludes) { + ConfigString uiHeader; + std::string uiHeaderGenex; + this->ConfigFileNamesAndGenex(uiHeader, uiHeaderGenex, + cmStrCat(this->Dir.Build, "/include"_s), + cmStrCat("/"_s, include)); + this->Uic.UiHeaders.emplace_back( + std::make_pair(uiHeader, uiHeaderGenex)); + } } // Process GENERATED sources and headers diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index e76817b..3ec87d2 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -17,6 +17,7 @@ #include "cmFilePathChecksum.h" #include "cmQtAutoGen.h" +#include "cmQtAutoUicHelpers.h" class cmGeneratorTarget; class cmGlobalGenerator; @@ -170,6 +171,7 @@ private: std::string ConfigDefault; std::vector<std::string> ConfigsList; std::string TargetsFolder; + cmQtAutoUicHelpers AutoUicHelpers; /** Common directories. */ struct diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 568926e..0c6b5e6 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -121,43 +121,6 @@ bool cmQtAutoGenerator::MakeParentDirectory(std::string const& filename) return success; } -bool cmQtAutoGenerator::FileRead(std::string& content, - std::string const& filename, - std::string* error) -{ - content.clear(); - if (!cmSystemTools::FileExists(filename, true)) { - if (error != nullptr) { - *error = "Not a file."; - } - return false; - } - - unsigned long const length = cmSystemTools::FileLength(filename); - cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); - - // Use lambda to save destructor calls of ifs - return [&ifs, length, &content, error]() -> bool { - if (!ifs) { - if (error != nullptr) { - *error = "Opening the file for reading failed."; - } - return false; - } - content.reserve(length); - using IsIt = std::istreambuf_iterator<char>; - content.assign(IsIt{ ifs }, IsIt{}); - if (!ifs) { - content.clear(); - if (error != nullptr) { - *error = "Reading from the file failed."; - } - return false; - } - return true; - }(); -} - bool cmQtAutoGenerator::FileWrite(std::string const& filename, std::string const& content, std::string* error) diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 5c3a8ad..66399d7 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -70,8 +70,6 @@ public: // -- File system methods static bool MakeParentDirectory(std::string const& filename); - static bool FileRead(std::string& content, std::string const& filename, - std::string* error = nullptr); static bool FileWrite(std::string const& filename, std::string const& content, std::string* error = nullptr); diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index f5c195f..86d54f9 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -30,6 +30,7 @@ #include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" +#include "cmQtAutoUicHelpers.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmWorkerPool.h" @@ -281,7 +282,7 @@ public: std::vector<std::string> Options; std::unordered_map<std::string, UiFile> UiFiles; std::vector<std::string> SearchPaths; - cmsys::RegularExpression RegExpInclude; + cmQtAutoUicHelpers AutoUicHelpers; }; /** Uic shared variables. */ @@ -761,11 +762,7 @@ std::string cmQtAutoMocUicT::MocSettingsT::MacrosString() const return res; } -cmQtAutoMocUicT::UicSettingsT::UicSettingsT() -{ - this->RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+" - "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]"); -} +cmQtAutoMocUicT::UicSettingsT::UicSettingsT() = default; cmQtAutoMocUicT::UicSettingsT::~UicSettingsT() = default; @@ -1056,16 +1053,7 @@ void cmQtAutoMocUicT::JobParseT::UicIncludes() } std::set<std::string> includes; - { - const char* contentChars = this->Content.c_str(); - cmsys::RegularExpression const& regExp = this->UicConst().RegExpInclude; - cmsys::RegularExpressionMatch match; - while (regExp.find(contentChars, match)) { - includes.emplace(match.match(2)); - // Forward content pointer - contentChars += match.end(); - } - } + this->UicConst().AutoUicHelpers.CollectUicIncludes(includes, this->Content); this->CreateKeys(this->FileHandle->ParseData->Uic.Include, includes, UiUnderscoreLength); } @@ -2248,12 +2236,20 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process() std::for_each(this->MocEval().SourceMappings.begin(), this->MocEval().SourceMappings.end(), processMappingEntry); - // Remove SKIP_AUTOMOC files - dependencies.erase(std::remove_if(dependencies.begin(), dependencies.end(), - [this](const std::string& dep) { - return this->MocConst().skipped(dep); - }), - dependencies.end()); + // Remove SKIP_AUTOMOC files. + // Also remove AUTOUIC header files to avoid cyclic dependency. + dependencies.erase( + std::remove_if(dependencies.begin(), dependencies.end(), + [this](const std::string& dep) { + return this->MocConst().skipped(dep) || + std::any_of( + this->UicEval().Includes.begin(), + this->UicEval().Includes.end(), + [&dep](MappingMapT::value_type const& mapping) { + return dep == mapping.second->OutputFile; + }); + }), + dependencies.end()); // Remove duplicates to make the depfile smaller std::sort(dependencies.begin(), dependencies.end()); diff --git a/Source/cmQtAutoUicHelpers.cxx b/Source/cmQtAutoUicHelpers.cxx new file mode 100644 index 0000000..751ae08 --- /dev/null +++ b/Source/cmQtAutoUicHelpers.cxx @@ -0,0 +1,25 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmQtAutoUicHelpers.h" + +cmQtAutoUicHelpers::cmQtAutoUicHelpers() +{ + RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+" + "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]"); +} + +void cmQtAutoUicHelpers::CollectUicIncludes(std::set<std::string>& includes, + const std::string& content) const +{ + if (content.find("ui_") == std::string::npos) { + return; + } + + const char* contentChars = content.c_str(); + cmsys::RegularExpressionMatch match; + while (this->RegExpInclude.find(contentChars, match)) { + includes.emplace(match.match(2)); + // Forward content pointer + contentChars += match.end(); + } +} diff --git a/Source/cmQtAutoUicHelpers.h b/Source/cmQtAutoUicHelpers.h new file mode 100644 index 0000000..6b09a31 --- /dev/null +++ b/Source/cmQtAutoUicHelpers.h @@ -0,0 +1,20 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include <set> +#include <string> + +#include "cmsys/RegularExpression.hxx" + +class cmQtAutoUicHelpers +{ +public: + cmQtAutoUicHelpers(); + virtual ~cmQtAutoUicHelpers() = default; + void CollectUicIncludes(std::set<std::string>& includes, + const std::string& content) const; + +private: + cmsys::RegularExpression RegExpInclude; +}; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 1725375..64d93df 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -153,9 +153,20 @@ std::string cmakemainGetStack(cmake* cm) void cmakemainMessageCallback(const std::string& m, const cmMessageMetadata& md, cmake* cm) { +#if defined(_WIN32) + // FIXME: On Windows we replace cerr's streambuf with a custom + // implementation that converts our internal UTF-8 encoding to the + // console's encoding. It also does *not* replace LF with CRLF. + // Since stderr does not convert encoding and does convert LF, we + // cannot use it to print messages. Another implementation will + // be needed to print colored messages on Windows. + static_cast<void>(md); + std::cerr << m << cmakemainGetStack(cm) << "\n"; +#else cmsysTerminal_cfprintf(md.desiredColor, stderr, "%s", m.c_str()); fflush(stderr); // stderr is buffered in some cases. std::cerr << cmakemainGetStack(cm) << "\n"; +#endif } void cmakemainProgressCallback(const std::string& m, float prog, cmake* cm) diff --git a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt index 1f636af..a9ccece 100644 --- a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt +++ b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt @@ -27,10 +27,12 @@ endmacro() configure_file("${testProjectTemplateDir}/mocwidget.h" "${testProjectSrc}/mocwidget.h" COPYONLY) configure_file("${testProjectTemplateDir}/main.cpp" "${testProjectSrc}/main.cpp" COPYONLY) +configure_file("${testProjectTemplateDir}/subdir/subdircheck.cpp" "${testProjectSrc}/subdir/subdircheck.cpp" COPYONLY) configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" @ONLY) set(Num 1) configure_file("${testProjectTemplateDir}/mainwindow.ui.in" "${testProjectSrc}/mainwindow.ui" @ONLY) +configure_file("${testProjectTemplateDir}/subdir/mainwindowsubdir.ui.in" "${testProjectSrc}/subdir/mainwindowsubdir.ui" @ONLY) if(CMAKE_GENERATOR_INSTANCE) set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE}") @@ -94,6 +96,7 @@ sleep() set(Num 2) configure_file("${testProjectTemplateDir}/mainwindow.ui.in" "${testProjectSrc}/mainwindow.ui" @ONLY) +configure_file("${testProjectTemplateDir}/subdir/mainwindowsubdir.ui.in" "${testProjectSrc}/subdir/mainwindowsubdir.ui" @ONLY) rebuild(2) execute_process(COMMAND "${testProjectBinDir}/${extra_bin_path}UicOnFileChange" RESULT_VARIABLE result) diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in index fa9dd6b..2a1998d 100644 --- a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in +++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in @@ -6,6 +6,8 @@ include("@CMAKE_CURRENT_LIST_DIR@/../AutogenGuiTest.cmake") # Enable CMAKE_AUTOUIC for all targets set(CMAKE_AUTOUIC ON) -add_executable(UicOnFileChange main.cpp mainwindow.ui) +add_executable(UicOnFileChange main.cpp mainwindow.ui + subdir/subdircheck.cpp subdir/mainwindowsubdir.ui +) target_include_directories(UicOnFileChange PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(UicOnFileChange ${QT_QTCORE_TARGET} ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp index fd810fa..3981268 100644 --- a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp +++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp @@ -1,9 +1,11 @@ #include "ui_mainwindow.h" +extern bool subdircheck(); + int main(int argc, char* argv[]) { MocWidget mw; Ui::Widget mwUi; mwUi.setupUi(&mw); - return mw.objectName() == "Widget2" ? 0 : 1; + return mw.objectName() == "Widget2" && subdircheck() ? 0 : 1; } diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/subdir/mainwindowsubdir.ui.in b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/subdir/mainwindowsubdir.ui.in new file mode 100644 index 0000000..a6a31f6 --- /dev/null +++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/subdir/mainwindowsubdir.ui.in @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>WidgetSubdir</class> + <widget class="MocWidget" name="WidgetSubdir@Num@"/> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/subdir/subdircheck.cpp b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/subdir/subdircheck.cpp new file mode 100644 index 0000000..3b36a10 --- /dev/null +++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/subdir/subdircheck.cpp @@ -0,0 +1,9 @@ +#include "ui_mainwindowsubdir.h" + +bool subdircheck() +{ + MocWidget mw; + Ui::WidgetSubdir mwUi; + mwUi.setupUi(&mw); + return mw.objectName() == "WidgetSubdir2"; +} diff --git a/Tests/RunCMake/CMakeDependentOption/Parentheses.cmake b/Tests/RunCMake/CMakeDependentOption/Parentheses.cmake deleted file mode 100644 index c2951f1..0000000 --- a/Tests/RunCMake/CMakeDependentOption/Parentheses.cmake +++ /dev/null @@ -1,7 +0,0 @@ -include(CMakeDependentOption) - -set(A 1) -set(B 1) -set(C 0) -cmake_dependent_option(USE_FOO "Use Foo" ON "A AND (B OR C)" OFF) -message(STATUS "USE_FOO='${USE_FOO}'") diff --git a/Tests/RunCMake/CMakeDependentOption/Parentheses-stdout.txt b/Tests/RunCMake/CMakeDependentOption/Regex-stdout.txt index 15b56a1..15b56a1 100644 --- a/Tests/RunCMake/CMakeDependentOption/Parentheses-stdout.txt +++ b/Tests/RunCMake/CMakeDependentOption/Regex-stdout.txt diff --git a/Tests/RunCMake/CMakeDependentOption/Regex.cmake b/Tests/RunCMake/CMakeDependentOption/Regex.cmake new file mode 100644 index 0000000..8342a01 --- /dev/null +++ b/Tests/RunCMake/CMakeDependentOption/Regex.cmake @@ -0,0 +1,5 @@ +include(CMakeDependentOption) + +set(FOO "lower") +cmake_dependent_option(USE_FOO "Use Foo" ON "FOO MATCHES (UPPER|lower)" OFF) +message(STATUS "USE_FOO='${USE_FOO}'") diff --git a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake index bbdd3e5..e1045f2 100644 --- a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake @@ -1,3 +1,3 @@ include(RunCMake) -run_cmake_script(Parentheses) +run_cmake_script(Regex) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 559c8f7..7c100eb 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -101,6 +101,7 @@ run_cmake_build(Simple all-configs Release simplestatic:all) run_ninja(Simple default-build-file build.ninja simpleexe) run_cmake_build(Simple all-clean Release clean:all) run_cmake_build(Simple debug-subdir Debug SimpleSubdir/all) +run_ninja(Simple debug-in-release-graph-target build-Release.ninja simpleexe2:Debug) run_ninja(Simple release-in-minsizerel-graph-subdir build-MinSizeRel.ninja SimpleSubdir/all:Release) run_cmake_build(Simple all-subdir Release SimpleSubdir/all:all) run_ninja(Simple minsizerel-top build-MinSizeRel.ninja all) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-all-subdir-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-all-subdir-build-check.cmake index de4505c..0cb6ad2 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-all-subdir-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-all-subdir-build-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -14,6 +17,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -23,6 +29,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_MinSizeRel} ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_FILE_simpleexe2_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe2_MinSizeRel} + ${TARGET_FILE_simpleshared_MinSizeRel} ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} @@ -32,6 +41,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-all-top-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-all-top-ninja-check.cmake index c171e3d..d27c1ca 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-all-top-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-all-top-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -18,6 +21,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -31,6 +37,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_MinSizeRel} ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_FILE_simpleexe2_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe2_MinSizeRel} + ${TARGET_FILE_simpleshared_MinSizeRel} ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} @@ -44,6 +53,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-target-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-target-ninja-check.cmake new file mode 100644 index 0000000..8de8fde --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-target-ninja-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe2_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-top-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-top-build-check.cmake index fe980fe..d2cb846 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-top-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-top-build-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -18,6 +21,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -27,6 +33,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_MinSizeRel} ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_FILE_simpleexe2_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe2_MinSizeRel} + ${TARGET_FILE_simpleshared_MinSizeRel} ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} @@ -40,6 +49,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-subdir-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-subdir-build-check.cmake index 6bb7773..6a0190f 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-subdir-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-subdir-build-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-all-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-all-ninja-check.cmake index 4e6e654..aec10ee 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-all-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-all-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -18,6 +21,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -31,6 +37,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-minsizerel-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-minsizerel-ninja-check.cmake index c09ae65..b46a708 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-minsizerel-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-minsizerel-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -18,6 +21,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-ninja-check.cmake index 43213dd..9d124cd 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -18,6 +21,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -31,6 +37,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_MinSizeRel} ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_FILE_simpleexe2_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe2_MinSizeRel} + ${TARGET_FILE_simpleshared_MinSizeRel} ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-minsizerel-top-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-minsizerel-top-ninja-check.cmake index bf4be49..496d722 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-minsizerel-top-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-minsizerel-top-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -14,6 +17,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -23,6 +29,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_MinSizeRel} ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_FILE_simpleexe2_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe2_MinSizeRel} + ${TARGET_FILE_simpleshared_MinSizeRel} ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} @@ -36,6 +45,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-release-in-minsizerel-graph-subdir-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-release-in-minsizerel-graph-subdir-ninja-check.cmake index b6c77ab..29c0187 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-release-in-minsizerel-graph-subdir-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-release-in-minsizerel-graph-subdir-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -14,6 +17,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple.cmake index 3f4ecbe..e2d393b 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Simple.cmake @@ -10,6 +10,6 @@ add_subdirectory(SimpleSubdir) add_library(simplestatic STATIC simplelib.c) include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) -generate_output_files(simpleexe simpleshared simplestatic simpleobj) +generate_output_files(simpleexe simpleexe2 simpleshared simplestatic simpleobj) file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(GENERATED_FILES [==[${CMAKE_BINARY_DIR}/empty.cmake]==])\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake index fee5951..67326d9 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -17,6 +20,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake index fee5951..67326d9 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -17,6 +20,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-all-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-all-ninja-check.cmake index c171e3d..d27c1ca 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-all-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-all-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -18,6 +21,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -31,6 +37,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_MinSizeRel} ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_FILE_simpleexe2_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe2_MinSizeRel} + ${TARGET_FILE_simpleshared_MinSizeRel} ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} @@ -44,6 +53,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-configs-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-configs-build-check.cmake index 8ffdd20..4e4ec82 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-configs-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-configs-build-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -17,6 +20,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-relwithdebinfo-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-relwithdebinfo-ninja-check.cmake index 9e5baf9..b1789b0 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-relwithdebinfo-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-relwithdebinfo-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Debug} ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_FILE_simpleexe2_Debug} + ${TARGET_OBJECT_FILES_simpleexe2_Debug} + ${TARGET_FILE_simpleshared_Debug} ${TARGET_LINKER_FILE_simpleshared_Debug} ${TARGET_OBJECT_FILES_simpleshared_Debug} @@ -17,6 +20,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_Release} ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_FILE_simpleexe2_Release} + ${TARGET_OBJECT_FILES_simpleexe2_Release} + ${TARGET_FILE_simpleshared_Release} ${TARGET_LINKER_FILE_simpleshared_Release} ${TARGET_OBJECT_FILES_simpleshared_Release} @@ -29,6 +35,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-clean-configs-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-clean-configs-ninja-check.cmake index 3829d3e..9016cf4 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-clean-configs-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-clean-configs-ninja-check.cmake @@ -5,6 +5,9 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_FILE_simpleexe_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_FILE_simpleexe2_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe2_RelWithDebInfo} + ${TARGET_FILE_simpleshared_RelWithDebInfo} ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleSubdir/CMakeLists.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleSubdir/CMakeLists.txt index 7e754a3..d81f5ab 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleSubdir/CMakeLists.txt +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleSubdir/CMakeLists.txt @@ -1,4 +1,8 @@ -add_library(simpleobj OBJECT ../empty.c) -add_executable(simpleexe ../main.c $<TARGET_OBJECTS:simpleobj>) +add_library(simpleobj OBJECT ../empty.c "$<$<CONFIG:Debug>:../empty_dbg.c>" "$<$<CONFIG:Release>:../empty_rel.c>") add_library(simpleshared SHARED ../simplelib.c) + +add_executable(simpleexe ../main.c $<TARGET_OBJECTS:simpleobj>) target_link_libraries(simpleexe PRIVATE simpleshared) + +add_executable(simpleexe2 ../main.c) +target_link_libraries(simpleexe2 PRIVATE simpleshared $<TARGET_OBJECTS:simpleobj>) diff --git a/Tests/RunCMake/NinjaMultiConfig/empty_dbg.c b/Tests/RunCMake/NinjaMultiConfig/empty_dbg.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/empty_dbg.c diff --git a/Tests/RunCMake/NinjaMultiConfig/empty_rel.c b/Tests/RunCMake/NinjaMultiConfig/empty_rel.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/empty_rel.c diff --git a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt index 69230b6..5c27b8a 100644 --- a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt @@ -1,19 +1,7 @@ -^CMake Error at OwnSources.cmake:[0-9]+ \(add_library\): +^(CMake Error at OwnSources.cmake:[0-9]+ \(add_library\): The SOURCES of "A" use a generator expression that depends on the SOURCES themselves. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) -+ -CMake Error at OwnSources.cmake:[0-9]+ \(add_library\): - The SOURCES of "A" use a generator expression that depends on the SOURCES - themselves. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) -+ -CMake Error at OwnSources.cmake:[0-9]+ \(add_library\): - The SOURCES of "A" use a generator expression that depends on the SOURCES - themselves. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) -+ ++)+ CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-NEW-stderr.txt b/Tests/RunCMake/ToolchainFile/CMP0126-NEW-stderr.txt new file mode 100644 index 0000000..7b91b43 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-NEW-stderr.txt @@ -0,0 +1 @@ +^try_compile CMP0126='NEW' VAR='1' diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-NEW-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CMP0126-NEW-toolchain.cmake new file mode 100644 index 0000000..2f1ec86 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-NEW-toolchain.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/CMP0126-toolchain.cmake") diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-NEW.cmake b/Tests/RunCMake/ToolchainFile/CMP0126-NEW.cmake new file mode 100644 index 0000000..62d4df1 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0126 NEW) +enable_language(C) diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt b/Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt new file mode 100644 index 0000000..f3c068a --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt @@ -0,0 +1 @@ +^try_compile CMP0126='OLD' VAR='2' diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-OLD-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CMP0126-OLD-toolchain.cmake new file mode 100644 index 0000000..2f1ec86 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-OLD-toolchain.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/CMP0126-toolchain.cmake") diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-OLD.cmake b/Tests/RunCMake/ToolchainFile/CMP0126-OLD.cmake new file mode 100644 index 0000000..ef821fe --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0126 OLD) +enable_language(C) diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-WARN-stderr.txt b/Tests/RunCMake/ToolchainFile/CMP0126-WARN-stderr.txt new file mode 100644 index 0000000..f3c068a --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-WARN-stderr.txt @@ -0,0 +1 @@ +^try_compile CMP0126='OLD' VAR='2' diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-WARN-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CMP0126-WARN-toolchain.cmake new file mode 100644 index 0000000..2f1ec86 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-WARN-toolchain.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/CMP0126-toolchain.cmake") diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-WARN.cmake b/Tests/RunCMake/ToolchainFile/CMP0126-WARN.cmake new file mode 100644 index 0000000..426e2b1 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-WARN.cmake @@ -0,0 +1,2 @@ +# leave CMP0126 unset +enable_language(C) diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CMP0126-toolchain.cmake new file mode 100644 index 0000000..d5af14f --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMP0126-toolchain.cmake @@ -0,0 +1,7 @@ +get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) +if(_IN_TC) + cmake_policy(GET CMP0126 cmp0126) + set(VAR 1) + set(VAR 2 CACHE STRING "") + message("try_compile CMP0126='${cmp0126}' VAR='${VAR}'") +endif() diff --git a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake index 304c105..7744ee8 100644 --- a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake +++ b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake @@ -11,6 +11,9 @@ run_cmake_toolchain(CheckLanguage) run_cmake_toolchain(FlagsInit) run_cmake_toolchain(LangVars) run_cmake_toolchain(LinkFlagsInit) +run_cmake_toolchain(CMP0126-NEW) +run_cmake_toolchain(CMP0126-OLD) +run_cmake_toolchain(CMP0126-WARN) function(run_IncludeDirectories) run_cmake_toolchain(IncludeDirectories) diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt new file mode 100644 index 0000000..185720b --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt @@ -0,0 +1,4 @@ +.*find_library considered the following locations.* +.*\(lib\)library_no_exist\(\\.tbd\|\\.dylib\|\\.so\|\\.a\).* +.*The item was found at.* +.*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr-windows.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr-windows.txt new file mode 100644 index 0000000..501ec0f --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr-windows.txt @@ -0,0 +1,4 @@ +.*find_library considered the following locations.* +.*\(\|lib\)library_no_exist\(\\.lib\|\\.dll\\.a\|\\.a\).* +.*The item was found at.* +.*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt new file mode 100644 index 0000000..046f680 --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt @@ -0,0 +1,4 @@ +.*find_library considered the following locations.* +.*\(lib\)library_no_exist\(\\.so\|\\.a\).* +.*The item was found at.* +.*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode.cmake b/Tests/RunCMake/find_library/FromScriptMode.cmake new file mode 100644 index 0000000..4d3c699 --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode.cmake @@ -0,0 +1,15 @@ + +if(TEMP_DIR) + file(REMOVE_RECURSE "${TEMP_DIR}") + file(MAKE_DIRECTORY "${TEMP_DIR}") + file(MAKE_DIRECTORY "${TEMP_DIR}/lib") + file(WRITE "${TEMP_DIR}/lib/libcreated.a" "created") +endif() + +set(CMAKE_FIND_DEBUG_MODE 1) +find_library(CREATED_LIBRARY NAMES library_no_exist) + +set(CMAKE_PREFIX_PATH "${TEMP_DIR}") +find_library(CREATED_LIBRARY NAMES created) +message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'") +set(CMAKE_FIND_DEBUG_MODE 0) diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index e297173..ad02c82 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -10,3 +10,5 @@ endif() run_cmake(PrefixInPATH) run_cmake(Required) run_cmake(NO_CACHE) + +run_cmake_script(FromScriptMode "-DTEMP_DIR=${RunCMake_BINARY_DIR}/FromScriptMode-temp") diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 0313ed1..1233838 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake_script(newline) + run_cmake(defaultmessage) run_cmake(nomessage) run_cmake(message-internal-warning) diff --git a/Tests/RunCMake/message/newline-script.cmake b/Tests/RunCMake/message/newline-script.cmake new file mode 100644 index 0000000..e9e3d5d --- /dev/null +++ b/Tests/RunCMake/message/newline-script.cmake @@ -0,0 +1,2 @@ +message(STATUS "one\ntwo") +message("one\ntwo") diff --git a/Tests/RunCMake/message/newline-stdout.txt b/Tests/RunCMake/message/newline-stdout.txt new file mode 100644 index 0000000..beca44e --- /dev/null +++ b/Tests/RunCMake/message/newline-stdout.txt @@ -0,0 +1,2 @@ +-- out='2d2d206f6e650a74776f0a' +-- err='6f6e650a74776f0a' diff --git a/Tests/RunCMake/message/newline.cmake b/Tests/RunCMake/message/newline.cmake new file mode 100644 index 0000000..97afba4 --- /dev/null +++ b/Tests/RunCMake/message/newline.cmake @@ -0,0 +1,9 @@ +execute_process( + COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/newline-script.cmake" + OUTPUT_FILE newline-script-stdout.txt + ERROR_FILE newline-script-stderr.txt + ) +foreach(f out err) + file(READ newline-script-std${f}.txt hex HEX) + message(STATUS "${f}='${hex}'") +endforeach() diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index 41d14ea..01c2222 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required(VERSION 3.3) +if(POLICY CMP0126) + cmake_policy(SET CMP0126 NEW) +endif() # NOTE: Force the Release mode configuration as there are some issues with the # debug information handling on macOS on certain Xcode builds. |