diff options
504 files changed, 5147 insertions, 1943 deletions
diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake index 7407959..16282b6 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake @@ -65,6 +65,7 @@ set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "") set(CMake_TEST_FindTIFF "ON" CACHE BOOL "") +set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "") set(CMake_TEST_FindX11 "ON" CACHE BOOL "") set(CMake_TEST_FindXalanC "ON" CACHE BOOL "") set(CMake_TEST_FindXercesC "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index e8d6d55..327c1c5 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -71,6 +71,7 @@ set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "") set(CMake_TEST_FindTIFF "ON" CACHE BOOL "") +set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "") set(CMake_TEST_FindX11 "ON" CACHE BOOL "") set(CMake_TEST_FindXalanC "ON" CACHE BOOL "") set(CMake_TEST_FindXercesC "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora37_makefiles.cmake b/.gitlab/ci/configure_fedora37_makefiles.cmake index 725cc46..f5676aa 100644 --- a/.gitlab/ci/configure_fedora37_makefiles.cmake +++ b/.gitlab/ci/configure_fedora37_makefiles.cmake @@ -69,6 +69,7 @@ set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "") set(CMake_TEST_FindTIFF "ON" CACHE BOOL "") +set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "") set(CMake_TEST_FindX11 "ON" CACHE BOOL "") set(CMake_TEST_FindXalanC "ON" CACHE BOOL "") set(CMake_TEST_FindXercesC "ON" CACHE BOOL "") diff --git a/.gitlab/ci/cxx_modules_rules_clang.cmake b/.gitlab/ci/cxx_modules_rules_clang.cmake index fcb2281..8088330 100644 --- a/.gitlab/ci/cxx_modules_rules_clang.cmake +++ b/.gitlab/ci/cxx_modules_rules_clang.cmake @@ -1,17 +1,6 @@ set(CMake_TEST_CXXModules_UUID "a246741c-d067-4019-a8fb-3d16b0c9d1d3") set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) -string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE - "${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}" - " -format=p1689" - " --" - " <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>" - " -x c++ <SOURCE> -c -o <OBJECT>" - " -MT <DYNDEP_FILE>" - " -MD -MF <DEP_FILE>" - " > <DYNDEP_FILE>") -set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang") -set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>") # Default to C++ extensions being off. Clang's modules support have trouble # with extensions right now. diff --git a/.gitlab/ci/docker/debian10-aarch64/deps_packages.lst b/.gitlab/ci/docker/debian10-aarch64/deps_packages.lst index 5e30e16..36b5d8c 100644 --- a/.gitlab/ci/docker/debian10-aarch64/deps_packages.lst +++ b/.gitlab/ci/docker/debian10-aarch64/deps_packages.lst @@ -76,6 +76,7 @@ libsdl-dev libsqlite3-dev libtiff-dev libuv1-dev +libwxgtk3.0-dev libx11-dev libxalan-c-dev libxerces-c-dev diff --git a/.gitlab/ci/docker/debian10/deps_packages.lst b/.gitlab/ci/docker/debian10/deps_packages.lst index 3df41f5..bd4377a 100644 --- a/.gitlab/ci/docker/debian10/deps_packages.lst +++ b/.gitlab/ci/docker/debian10/deps_packages.lst @@ -79,6 +79,7 @@ libsdl-dev libsqlite3-dev libtiff-dev libuv1-dev +libwxgtk3.0-dev libx11-dev libxalan-c-dev libxerces-c-dev diff --git a/.gitlab/ci/docker/fedora37/deps_packages.lst b/.gitlab/ci/docker/fedora37/deps_packages.lst index 9ce8007..61382b5 100644 --- a/.gitlab/ci/docker/fedora37/deps_packages.lst +++ b/.gitlab/ci/docker/fedora37/deps_packages.lst @@ -105,6 +105,7 @@ SDL-devel sqlite-devel swig unixODBC-devel +wxGTK-devel xalan-c-devel xerces-c-devel xz-devel diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 9a53401..60cd0b7 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -45,7 +45,7 @@ ### Debian .debian10: - image: "kitware/cmake:ci-debian10-x86_64-2023-02-07" + image: "kitware/cmake:ci-debian10-x86_64-2023-03-08" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -60,7 +60,7 @@ CMAKE_CI_NO_INSTALL: 1 .debian10_aarch64: - image: "kitware/cmake:ci-debian10-aarch64-2023-02-07" + image: "kitware/cmake:ci-debian10-aarch64-2023-03-08" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -69,7 +69,7 @@ ### Fedora .fedora37: - image: "kitware/cmake:ci-fedora37-x86_64-2023-02-07" + image: "kitware/cmake:ci-fedora37-x86_64-2023-03-08" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes" diff --git a/Help/command/cmake_language.rst b/Help/command/cmake_language.rst index 8801a9f..707568c 100644 --- a/Help/command/cmake_language.rst +++ b/Help/command/cmake_language.rst @@ -27,163 +27,155 @@ those created via the :command:`macro` or :command:`function` commands. Calling Commands ^^^^^^^^^^^^^^^^ -.. _CALL: - -.. code-block:: cmake - +.. signature:: cmake_language(CALL <command> [<arg>...]) -Calls the named ``<command>`` with the given arguments (if any). -For example, the code: + Calls the named ``<command>`` with the given arguments (if any). + For example, the code: -.. code-block:: cmake + .. code-block:: cmake - set(message_command "message") - cmake_language(CALL ${message_command} STATUS "Hello World!") + set(message_command "message") + cmake_language(CALL ${message_command} STATUS "Hello World!") -is equivalent to + is equivalent to -.. code-block:: cmake + .. code-block:: cmake - message(STATUS "Hello World!") + message(STATUS "Hello World!") -.. note:: - To ensure consistency of the code, the following commands are not allowed: + .. note:: + To ensure consistency of the code, the following commands are not allowed: - * ``if`` / ``elseif`` / ``else`` / ``endif`` - * ``block`` / ``endblock`` - * ``while`` / ``endwhile`` - * ``foreach`` / ``endforeach`` - * ``function`` / ``endfunction`` - * ``macro`` / ``endmacro`` + * ``if`` / ``elseif`` / ``else`` / ``endif`` + * ``block`` / ``endblock`` + * ``while`` / ``endwhile`` + * ``foreach`` / ``endforeach`` + * ``function`` / ``endfunction`` + * ``macro`` / ``endmacro`` Evaluating Code ^^^^^^^^^^^^^^^ -.. _EVAL: - -.. code-block:: cmake - +.. signature:: cmake_language(EVAL CODE <code>...) + :target: EVAL -Evaluates the ``<code>...`` as CMake code. + Evaluates the ``<code>...`` as CMake code. -For example, the code: + For example, the code: -.. code-block:: cmake + .. code-block:: cmake - set(A TRUE) - set(B TRUE) - set(C TRUE) - set(condition "(A AND B) OR C") + set(A TRUE) + set(B TRUE) + set(C TRUE) + set(condition "(A AND B) OR C") - cmake_language(EVAL CODE " - if (${condition}) - message(STATUS TRUE) - else() - message(STATUS FALSE) - endif()" - ) + cmake_language(EVAL CODE " + if (${condition}) + message(STATUS TRUE) + else() + message(STATUS FALSE) + endif()" + ) -is equivalent to + is equivalent to -.. code-block:: cmake + .. code-block:: cmake - set(A TRUE) - set(B TRUE) - set(C TRUE) - set(condition "(A AND B) OR C") - - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/eval.cmake " - if (${condition}) - message(STATUS TRUE) - else() - message(STATUS FALSE) - endif()" - ) + set(A TRUE) + set(B TRUE) + set(C TRUE) + set(condition "(A AND B) OR C") - include(${CMAKE_CURRENT_BINARY_DIR}/eval.cmake) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/eval.cmake " + if (${condition}) + message(STATUS TRUE) + else() + message(STATUS FALSE) + endif()" + ) + + include(${CMAKE_CURRENT_BINARY_DIR}/eval.cmake) Deferring Calls ^^^^^^^^^^^^^^^ .. versionadded:: 3.19 -.. _DEFER: - -.. code-block:: cmake - +.. signature:: cmake_language(DEFER <options>... CALL <command> [<arg>...]) -Schedules a call to the named ``<command>`` with the given arguments (if any) -to occur at a later time. By default, deferred calls are executed as if -written at the end of the current directory's ``CMakeLists.txt`` file, -except that they run even after a :command:`return` call. Variable -references in arguments are evaluated at the time the deferred call is -executed. + Schedules a call to the named ``<command>`` with the given arguments (if any) + to occur at a later time. By default, deferred calls are executed as if + written at the end of the current directory's ``CMakeLists.txt`` file, + except that they run even after a :command:`return` call. Variable + references in arguments are evaluated at the time the deferred call is + executed. -The options are: + The options are: -``DIRECTORY <dir>`` - Schedule the call for the end of the given directory instead of the - current directory. The ``<dir>`` may reference either a source - directory or its corresponding binary directory. Relative paths are - treated as relative to the current source directory. + ``DIRECTORY <dir>`` + Schedule the call for the end of the given directory instead of the + current directory. The ``<dir>`` may reference either a source + directory or its corresponding binary directory. Relative paths are + treated as relative to the current source directory. - The given directory must be known to CMake, being either the top-level - directory or one added by :command:`add_subdirectory`. Furthermore, - the given directory must not yet be finished processing. This means - it can be the current directory or one of its ancestors. + The given directory must be known to CMake, being either the top-level + directory or one added by :command:`add_subdirectory`. Furthermore, + the given directory must not yet be finished processing. This means + it can be the current directory or one of its ancestors. -``ID <id>`` - Specify an identification for the deferred call. - The ``<id>`` may not be empty and may not begin with a capital letter ``A-Z``. - The ``<id>`` may begin with an underscore (``_``) only if it was generated - automatically by an earlier call that used ``ID_VAR`` to get the id. + ``ID <id>`` + Specify an identification for the deferred call. + The ``<id>`` may not be empty and may not begin with a capital letter ``A-Z``. + The ``<id>`` may begin with an underscore (``_``) only if it was generated + automatically by an earlier call that used ``ID_VAR`` to get the id. -``ID_VAR <var>`` - Specify a variable in which to store the identification for the - deferred call. If ``ID <id>`` is not given, a new identification - will be generated and the generated id will start with an underscore (``_``). + ``ID_VAR <var>`` + Specify a variable in which to store the identification for the + deferred call. If ``ID <id>`` is not given, a new identification + will be generated and the generated id will start with an underscore (``_``). -The currently scheduled list of deferred calls may be retrieved: + The currently scheduled list of deferred calls may be retrieved: -.. code-block:: cmake + .. code-block:: cmake - cmake_language(DEFER [DIRECTORY <dir>] GET_CALL_IDS <var>) + cmake_language(DEFER [DIRECTORY <dir>] GET_CALL_IDS <var>) -This will store in ``<var>`` a :ref:`semicolon-separated list <CMake Language -Lists>` of deferred call ids. The ids are for the directory scope in which -the calls have been deferred to (i.e. where they will be executed), which can -be different to the scope in which they were created. The ``DIRECTORY`` -option can be used to specify the scope for which to retrieve the call ids. -If that option is not given, the call ids for the current directory scope will -be returned. + This will store in ``<var>`` a :ref:`semicolon-separated list <CMake Language + Lists>` of deferred call ids. The ids are for the directory scope in which + the calls have been deferred to (i.e. where they will be executed), which can + be different to the scope in which they were created. The ``DIRECTORY`` + option can be used to specify the scope for which to retrieve the call ids. + If that option is not given, the call ids for the current directory scope + will be returned. -Details of a specific call may be retrieved from its id: + Details of a specific call may be retrieved from its id: -.. code-block:: cmake + .. code-block:: cmake - cmake_language(DEFER [DIRECTORY <dir>] GET_CALL <id> <var>) + cmake_language(DEFER [DIRECTORY <dir>] GET_CALL <id> <var>) -This will store in ``<var>`` a :ref:`semicolon-separated list <CMake Language -Lists>` in which the first element is the name of the command to be -called, and the remaining elements are its unevaluated arguments (any -contained ``;`` characters are included literally and cannot be distinguished -from multiple arguments). If multiple calls are scheduled with the same id, -this retrieves the first one. If no call is scheduled with the given id in -the specified ``DIRECTORY`` scope (or the current directory scope if no -``DIRECTORY`` option is given), this stores an empty string in the variable. + This will store in ``<var>`` a :ref:`semicolon-separated list <CMake Language + Lists>` in which the first element is the name of the command to be + called, and the remaining elements are its unevaluated arguments (any + contained ``;`` characters are included literally and cannot be distinguished + from multiple arguments). If multiple calls are scheduled with the same id, + this retrieves the first one. If no call is scheduled with the given id in + the specified ``DIRECTORY`` scope (or the current directory scope if no + ``DIRECTORY`` option is given), this stores an empty string in the variable. -Deferred calls may be canceled by their id: + Deferred calls may be canceled by their id: -.. code-block:: cmake + .. code-block:: cmake - cmake_language(DEFER [DIRECTORY <dir>] CANCEL_CALL <id>...) + cmake_language(DEFER [DIRECTORY <dir>] CANCEL_CALL <id>...) -This cancels all deferred calls matching any of the given ids in the specified -``DIRECTORY`` scope (or the current directory scope if no ``DIRECTORY`` option -is given). Unknown ids are silently ignored. + This cancels all deferred calls matching any of the given ids in the specified + ``DIRECTORY`` scope (or the current directory scope if no ``DIRECTORY`` option + is given). Unknown ids are silently ignored. Deferred Call Examples """""""""""""""""""""" @@ -229,8 +221,6 @@ also prints:: Deferred Message 1 Deferred Message 2 - -.. _SET_DEPENDENCY_PROVIDER: .. _dependency_providers: Dependency Providers @@ -241,51 +231,50 @@ Dependency Providers .. note:: A high-level introduction to this feature can be found in the :ref:`Using Dependencies Guide <dependency_providers_overview>`. -.. code-block:: cmake - +.. signature:: cmake_language(SET_DEPENDENCY_PROVIDER <command> SUPPORTED_METHODS <methods>...) -When a call is made to :command:`find_package` or -:command:`FetchContent_MakeAvailable`, the call may be forwarded to a -dependency provider which then has the opportunity to fulfill the request. -If the request is for one of the ``<methods>`` specified when the provider -was set, CMake calls the provider's ``<command>`` with a set of -method-specific arguments. If the provider does not fulfill the request, -or if the provider doesn't support the request's method, or no provider -is set, the built-in :command:`find_package` or -:command:`FetchContent_MakeAvailable` implementation is used to fulfill -the request in the usual way. - -One or more of the following values can be specified for the ``<methods>`` -when setting the provider: - -``FIND_PACKAGE`` - The provider command accepts :command:`find_package` requests. - -``FETCHCONTENT_MAKEAVAILABLE_SERIAL`` - The provider command accepts :command:`FetchContent_MakeAvailable` - requests. It expects each dependency to be fed to the provider command - one at a time, not the whole list in one go. - -Only one provider can be set at any point in time. If a provider is already -set when ``cmake_language(SET_DEPENDENCY_PROVIDER)`` is called, the new -provider replaces the previously set one. The specified ``<command>`` must -already exist when ``cmake_language(SET_DEPENDENCY_PROVIDER)`` is called. -As a special case, providing an empty string for the ``<command>`` and no -``<methods>`` will discard any previously set provider. - -The dependency provider can only be set while processing one of the files -specified by the :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variable. -Thus, dependency providers can only be set as part of the first call to -:command:`project`. Calling ``cmake_language(SET_DEPENDENCY_PROVIDER)`` -outside of that context will result in an error. - -.. note:: - The choice of dependency provider should always be under the user's control. - As a convenience, a project may choose to provide a file that users can - list in their :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variable, but - the use of such a file should always be the user's choice. + When a call is made to :command:`find_package` or + :command:`FetchContent_MakeAvailable`, the call may be forwarded to a + dependency provider which then has the opportunity to fulfill the request. + If the request is for one of the ``<methods>`` specified when the provider + was set, CMake calls the provider's ``<command>`` with a set of + method-specific arguments. If the provider does not fulfill the request, + or if the provider doesn't support the request's method, or no provider + is set, the built-in :command:`find_package` or + :command:`FetchContent_MakeAvailable` implementation is used to fulfill + the request in the usual way. + + One or more of the following values can be specified for the ``<methods>`` + when setting the provider: + + ``FIND_PACKAGE`` + The provider command accepts :command:`find_package` requests. + + ``FETCHCONTENT_MAKEAVAILABLE_SERIAL`` + The provider command accepts :command:`FetchContent_MakeAvailable` + requests. It expects each dependency to be fed to the provider command + one at a time, not the whole list in one go. + + Only one provider can be set at any point in time. If a provider is already + set when ``cmake_language(SET_DEPENDENCY_PROVIDER)`` is called, the new + provider replaces the previously set one. The specified ``<command>`` must + already exist when ``cmake_language(SET_DEPENDENCY_PROVIDER)`` is called. + As a special case, providing an empty string for the ``<command>`` and no + ``<methods>`` will discard any previously set provider. + + The dependency provider can only be set while processing one of the files + specified by the :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variable. + Thus, dependency providers can only be set as part of the first call to + :command:`project`. Calling ``cmake_language(SET_DEPENDENCY_PROVIDER)`` + outside of that context will result in an error. + + .. note:: + The choice of dependency provider should always be under the user's control. + As a convenience, a project may choose to provide a file that users can + list in their :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variable, but + the use of such a file should always be the user's choice. Provider commands """"""""""""""""" @@ -499,23 +488,21 @@ Getting current message log level .. versionadded:: 3.25 -.. _GET_MESSAGE_LOG_LEVEL: .. _query_message_log_level: -.. code-block:: cmake - +.. signature:: cmake_language(GET_MESSAGE_LOG_LEVEL <output_variable>) -Writes the current :command:`message` logging level -into the given ``<output_variable>``. + Writes the current :command:`message` logging level + into the given ``<output_variable>``. -See :command:`message` for the possible logging levels. + See :command:`message` for the possible logging levels. -The current message logging level can be set either using the -:option:`--log-level <cmake --log-level>` -command line option of the :manual:`cmake(1)` program or using -the :variable:`CMAKE_MESSAGE_LOG_LEVEL` variable. + The current message logging level can be set either using the + :option:`--log-level <cmake --log-level>` + command line option of the :manual:`cmake(1)` program or using + the :variable:`CMAKE_MESSAGE_LOG_LEVEL` variable. -If both the command line option and the variable are set, the command line -option takes precedence. If neither are set, the default logging level -is returned. + If both the command line option and the variable are set, the command line + option takes precedence. If neither are set, the default logging level + is returned. diff --git a/Help/command/if.rst b/Help/command/if.rst index 684c113..be855e1 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -39,7 +39,7 @@ the ``if``, ``elseif`` and :command:`while` clauses. Compound conditions are evaluated in the following order of precedence: -1. Parentheses. +1. `Parentheses`_. 2. Unary tests such as `EXISTS`_, `COMMAND`_, and `DEFINED`_. @@ -57,262 +57,284 @@ Compound conditions are evaluated in the following order of precedence: Basic Expressions """"""""""""""""" -``if(<constant>)`` - True if the constant is ``1``, ``ON``, ``YES``, ``TRUE``, ``Y``, - or a non-zero number (including floating point numbers). - False if the constant is ``0``, ``OFF``, - ``NO``, ``FALSE``, ``N``, ``IGNORE``, ``NOTFOUND``, the empty string, - or ends in the suffix ``-NOTFOUND``. Named boolean constants are - case-insensitive. If the argument is not one of these specific - constants, it is treated as a variable or string (see `Variable Expansion`_ - further below) and one of the following two forms applies. - -``if(<variable>)`` - True if given a variable that is defined to a value that is not a false - constant. False otherwise, including if the variable is undefined. - Note that macro arguments are not variables. - :ref:`Environment Variables <CMake Language Environment Variables>` also - cannot be tested this way, e.g. ``if(ENV{some_var})`` will always evaluate - to false. - -``if(<string>)`` - A quoted string always evaluates to false unless: - - * The string's value is one of the true constants, or - * Policy :policy:`CMP0054` is not set to ``NEW`` and the string's value - happens to be a variable name that is affected by :policy:`CMP0054`'s - behavior. +.. signature:: if(<constant>) + :target: constant + + True if the constant is ``1``, ``ON``, ``YES``, ``TRUE``, ``Y``, + or a non-zero number (including floating point numbers). + False if the constant is ``0``, ``OFF``, + ``NO``, ``FALSE``, ``N``, ``IGNORE``, ``NOTFOUND``, the empty string, + or ends in the suffix ``-NOTFOUND``. Named boolean constants are + case-insensitive. If the argument is not one of these specific + constants, it is treated as a variable or string (see `Variable Expansion`_ + further below) and one of the following two forms applies. + +.. signature:: if(<variable>) + :target: variable + + True if given a variable that is defined to a value that is not a false + constant. False otherwise, including if the variable is undefined. + Note that macro arguments are not variables. + :ref:`Environment Variables <CMake Language Environment Variables>` also + cannot be tested this way, e.g. ``if(ENV{some_var})`` will always evaluate + to false. + +.. signature:: if(<string>) + :target: string + + A quoted string always evaluates to false unless: + + * The string's value is one of the true constants, or + * Policy :policy:`CMP0054` is not set to ``NEW`` and the string's value + happens to be a variable name that is affected by :policy:`CMP0054`'s + behavior. Logic Operators """"""""""""""" -.. _NOT: +.. signature:: if(NOT <condition>) + + True if the condition is not true. -``if(NOT <condition>)`` - True if the condition is not true. +.. signature:: if(<cond1> AND <cond2>) + :target: AND -.. _AND: + True if both conditions would be considered true individually. -``if(<cond1> AND <cond2>)`` - True if both conditions would be considered true individually. +.. signature:: if(<cond1> OR <cond2>) + :target: OR -.. _OR: + True if either condition would be considered true individually. -``if(<cond1> OR <cond2>)`` - True if either condition would be considered true individually. +.. signature:: if((condition) AND (condition OR (condition))) + :target: parentheses -``if((condition) AND (condition OR (condition)))`` - The conditions inside the parenthesis are evaluated first and then - the remaining condition is evaluated as in the other examples. - Where there are nested parenthesis the innermost are evaluated as part - of evaluating the condition that contains them. + The conditions inside the parenthesis are evaluated first and then + the remaining condition is evaluated as in the other examples. + Where there are nested parenthesis the innermost are evaluated as part + of evaluating the condition that contains them. Existence Checks """""""""""""""" -.. _COMMAND: +.. signature:: if(COMMAND <command-name>) + + True if the given name is a command, macro or function that can be + invoked. + +.. signature:: if(POLICY <policy-id>) + + True if the given name is an existing policy (of the form ``CMP<NNNN>``). -``if(COMMAND command-name)`` - True if the given name is a command, macro or function that can be - invoked. +.. signature:: if(TARGET <target-name>) -``if(POLICY policy-id)`` - True if the given name is an existing policy (of the form ``CMP<NNNN>``). + True if the given name is an existing logical target name created + by a call to the :command:`add_executable`, :command:`add_library`, + or :command:`add_custom_target` command that has already been invoked + (in any directory). -``if(TARGET target-name)`` - True if the given name is an existing logical target name created - by a call to the :command:`add_executable`, :command:`add_library`, - or :command:`add_custom_target` command that has already been invoked - (in any directory). +.. signature:: if(TEST <test-name>) + + .. versionadded:: 3.3 -``if(TEST test-name)`` - .. versionadded:: 3.3 True if the given name is an existing test name created by the :command:`add_test` command. -.. _DEFINED: +.. signature:: if(DEFINED <name>|CACHE{<name>}|ENV{<name>}) -``if(DEFINED <name>|CACHE{<name>}|ENV{<name>})`` - True if a variable, cache variable or environment variable - with given ``<name>`` is defined. The value of the variable - does not matter. Note the following caveats: + True if a variable, cache variable or environment variable + with given ``<name>`` is defined. The value of the variable + does not matter. Note the following caveats: - * Macro arguments are not variables. - * It is not possible to test directly whether a `<name>` is a non-cache - variable. The expression ``if(DEFINED someName)`` will evaluate to true - if either a cache or non-cache variable ``someName`` exists. In - comparison, the expression ``if(DEFINED CACHE{someName})`` will only - evaluate to true if a cache variable ``someName`` exists. Both expressions - need to be tested if you need to know whether a non-cache variable exists: - ``if(DEFINED someName AND NOT DEFINED CACHE{someName})``. + * Macro arguments are not variables. + * It is not possible to test directly whether a `<name>` is a non-cache + variable. The expression ``if(DEFINED someName)`` will evaluate to true + if either a cache or non-cache variable ``someName`` exists. In + comparison, the expression ``if(DEFINED CACHE{someName})`` will only + evaluate to true if a cache variable ``someName`` exists. Both expressions + need to be tested if you need to know whether a non-cache variable exists: + ``if(DEFINED someName AND NOT DEFINED CACHE{someName})``. .. versionadded:: 3.14 Added support for ``CACHE{<name>}`` variables. -``if(<variable|string> IN_LIST <variable>)`` - .. versionadded:: 3.3 +.. signature:: if(<variable|string> IN_LIST <variable>) + :target: IN_LIST + + .. versionadded:: 3.3 + True if the given element is contained in the named list variable. File Operations """"""""""""""" -.. _EXISTS: +.. signature:: if(EXISTS <path-to-file-or-directory>) + + True if the named file or directory exists. Behavior is well-defined + only for explicit full paths (a leading ``~/`` is not expanded as + a home directory and is considered a relative path). + Resolves symbolic links, i.e. if the named file or directory is a + symbolic link, returns true if the target of the symbolic link exists. + + False if the given path is an empty string. -``if(EXISTS path-to-file-or-directory)`` - True if the named file or directory exists. Behavior is well-defined - only for explicit full paths (a leading ``~/`` is not expanded as - a home directory and is considered a relative path). - Resolves symbolic links, i.e. if the named file or directory is a - symbolic link, returns true if the target of the symbolic link exists. +.. signature:: if(<file1> IS_NEWER_THAN <file2>) + :target: IS_NEWER_THAN - False if the given path is an empty string. + True if ``file1`` is newer than ``file2`` or if one of the two files doesn't + exist. Behavior is well-defined only for full paths. If the file + time stamps are exactly the same, an ``IS_NEWER_THAN`` comparison returns + true, so that any dependent build operations will occur in the event + of a tie. This includes the case of passing the same file name for + both file1 and file2. -``if(file1 IS_NEWER_THAN file2)`` - True if ``file1`` is newer than ``file2`` or if one of the two files doesn't - exist. Behavior is well-defined only for full paths. If the file - time stamps are exactly the same, an ``IS_NEWER_THAN`` comparison returns - true, so that any dependent build operations will occur in the event - of a tie. This includes the case of passing the same file name for - both file1 and file2. +.. signature:: if(IS_DIRECTORY <path>) -``if(IS_DIRECTORY path)`` - True if ``path`` is a directory. Behavior is well-defined only - for full paths. + True if ``path`` is a directory. Behavior is well-defined only + for full paths. - False if the given path is an empty string. + False if the given path is an empty string. -``if(IS_SYMLINK file-name)`` - True if the given name is a symbolic link. Behavior is well-defined - only for full paths. +.. signature:: if(IS_SYMLINK <path>) -``if(IS_ABSOLUTE path)`` - True if the given path is an absolute path. Note the following special - cases: + True if the given path is a symbolic link. Behavior is well-defined + only for full paths. - * An empty ``path`` evaluates to false. - * On Windows hosts, any ``path`` that begins with a drive letter and colon - (e.g. ``C:``), a forward slash or a backslash will evaluate to true. - This means a path like ``C:no\base\dir`` will evaluate to true, even - though the non-drive part of the path is relative. - * On non-Windows hosts, any ``path`` that begins with a tilde (``~``) - evaluates to true. +.. signature:: if(IS_ABSOLUTE <path>) + + True if the given path is an absolute path. Note the following special + cases: + + * An empty ``path`` evaluates to false. + * On Windows hosts, any ``path`` that begins with a drive letter and colon + (e.g. ``C:``), a forward slash or a backslash will evaluate to true. + This means a path like ``C:no\base\dir`` will evaluate to true, even + though the non-drive part of the path is relative. + * On non-Windows hosts, any ``path`` that begins with a tilde (``~``) + evaluates to true. Comparisons """"""""""" -.. _MATCHES: +.. signature:: if(<variable|string> MATCHES <regex>) + :target: MATCHES -``if(<variable|string> MATCHES regex)`` - True if the given string or variable's value matches the given regular - expression. See :ref:`Regex Specification` for regex format. + True if the given string or variable's value matches the given regular + expression. See :ref:`Regex Specification` for regex format. - .. versionadded:: 3.9 - ``()`` groups are captured in :variable:`CMAKE_MATCH_<n>` variables. + .. versionadded:: 3.9 + ``()`` groups are captured in :variable:`CMAKE_MATCH_<n>` variables. -.. _LESS: +.. signature:: if(<variable|string> LESS <variable|string>) + :target: LESS -``if(<variable|string> LESS <variable|string>)`` - True if the given string or variable's value is a valid number and less - than that on the right. + True if the given string or variable's value is a valid number and less + than that on the right. -.. _GREATER: +.. signature:: if(<variable|string> GREATER <variable|string>) + :target: GREATER + + True if the given string or variable's value is a valid number and greater + than that on the right. -``if(<variable|string> GREATER <variable|string>)`` - True if the given string or variable's value is a valid number and greater - than that on the right. +.. signature:: if(<variable|string> EQUAL <variable|string>) + :target: EQUAL -.. _EQUAL: + True if the given string or variable's value is a valid number and equal + to that on the right. -``if(<variable|string> EQUAL <variable|string>)`` - True if the given string or variable's value is a valid number and equal - to that on the right. +.. signature:: if(<variable|string> LESS_EQUAL <variable|string>) + :target: LESS_EQUAL -.. _LESS_EQUAL: + .. versionadded:: 3.7 -``if(<variable|string> LESS_EQUAL <variable|string>)`` - .. versionadded:: 3.7 True if the given string or variable's value is a valid number and less than or equal to that on the right. -.. _GREATER_EQUAL: +.. signature:: if(<variable|string> GREATER_EQUAL <variable|string>) + :target: GREATER_EQUAL + + .. versionadded:: 3.7 -``if(<variable|string> GREATER_EQUAL <variable|string>)`` - .. versionadded:: 3.7 True if the given string or variable's value is a valid number and greater than or equal to that on the right. -.. _STRLESS: +.. signature:: if(<variable|string> STRLESS <variable|string>) + :target: STRLESS -``if(<variable|string> STRLESS <variable|string>)`` - True if the given string or variable's value is lexicographically less - than the string or variable on the right. + True if the given string or variable's value is lexicographically less + than the string or variable on the right. -.. _STRGREATER: +.. signature:: if(<variable|string> STRGREATER <variable|string>) + :target: STRGREATER -``if(<variable|string> STRGREATER <variable|string>)`` - True if the given string or variable's value is lexicographically greater - than the string or variable on the right. + True if the given string or variable's value is lexicographically greater + than the string or variable on the right. -.. _STREQUAL: +.. signature:: if(<variable|string> STREQUAL <variable|string>) + :target: STREQUAL -``if(<variable|string> STREQUAL <variable|string>)`` - True if the given string or variable's value is lexicographically equal - to the string or variable on the right. + True if the given string or variable's value is lexicographically equal + to the string or variable on the right. -.. _STRLESS_EQUAL: +.. signature:: if(<variable|string> STRLESS_EQUAL <variable|string>) + :target: STRLESS_EQUAL + + .. versionadded:: 3.7 -``if(<variable|string> STRLESS_EQUAL <variable|string>)`` - .. versionadded:: 3.7 True if the given string or variable's value is lexicographically less than or equal to the string or variable on the right. -.. _STRGREATER_EQUAL: +.. signature:: if(<variable|string> STRGREATER_EQUAL <variable|string>) + :target: STRGREATER_EQUAL + + .. versionadded:: 3.7 -``if(<variable|string> STRGREATER_EQUAL <variable|string>)`` - .. versionadded:: 3.7 True if the given string or variable's value is lexicographically greater than or equal to the string or variable on the right. Version Comparisons """"""""""""""""""" -.. _VERSION_LESS: +.. signature:: if(<variable|string> VERSION_LESS <variable|string>) + :target: VERSION_LESS -``if(<variable|string> VERSION_LESS <variable|string>)`` - Component-wise integer version number comparison (version format is - ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). - Any non-integer version component or non-integer trailing part of a version - component effectively truncates the string at that point. + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). + Any non-integer version component or non-integer trailing part of a version + component effectively truncates the string at that point. -.. _VERSION_GREATER: +.. signature:: if(<variable|string> VERSION_GREATER <variable|string>) + :target: VERSION_GREATER -``if(<variable|string> VERSION_GREATER <variable|string>)`` - Component-wise integer version number comparison (version format is - ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). - Any non-integer version component or non-integer trailing part of a version - component effectively truncates the string at that point. + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). + Any non-integer version component or non-integer trailing part of a version + component effectively truncates the string at that point. -.. _VERSION_EQUAL: +.. signature:: if(<variable|string> VERSION_EQUAL <variable|string>) + :target: VERSION_EQUAL -``if(<variable|string> VERSION_EQUAL <variable|string>)`` - Component-wise integer version number comparison (version format is - ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). - Any non-integer version component or non-integer trailing part of a version - component effectively truncates the string at that point. + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). + Any non-integer version component or non-integer trailing part of a version + component effectively truncates the string at that point. -.. _VERSION_LESS_EQUAL: +.. signature:: if(<variable|string> VERSION_LESS_EQUAL <variable|string>) + :target: VERSION_LESS_EQUAL + + .. versionadded:: 3.7 -``if(<variable|string> VERSION_LESS_EQUAL <variable|string>)`` - .. versionadded:: 3.7 Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). Any non-integer version component or non-integer trailing part of a version component effectively truncates the string at that point. -.. _VERSION_GREATER_EQUAL: +.. signature:: if(<variable|string> VERSION_GREATER_EQUAL <variable|string>) + :target: VERSION_GREATER_EQUAL + + .. versionadded:: 3.7 -``if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)`` - .. versionadded:: 3.7 Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). Any non-integer version component or non-integer trailing part of a version @@ -321,9 +343,9 @@ Version Comparisons Path Comparisons """""""""""""""" -.. _PATH_EQUAL: +.. signature:: if(<variable|string> PATH_EQUAL <variable|string>) + :target: PATH_EQUAL -``if(<variable|string> PATH_EQUAL <variable|string>)`` .. versionadded:: 3.24 Compares the two paths component-by-component. Only if every component of @@ -386,35 +408,35 @@ constant. Automatic evaluation applies in the other cases whenever the above-documented condition syntax accepts ``<variable|string>``: -* The left hand argument to ``MATCHES`` is first checked to see if it is - a defined variable, if so the variable's value is used, otherwise the +* The left hand argument to `MATCHES`_ is first checked to see if it is + a defined variable. If so, the variable's value is used, otherwise the original value is used. -* If the left hand argument to ``MATCHES`` is missing it returns false +* If the left hand argument to `MATCHES`_ is missing it returns false without error -* Both left and right hand arguments to ``LESS``, ``GREATER``, ``EQUAL``, - ``LESS_EQUAL``, and ``GREATER_EQUAL``, are independently tested to see if - they are defined variables, if so their defined values are used otherwise +* Both left and right hand arguments to `LESS`_, `GREATER`_, `EQUAL`_, + `LESS_EQUAL`_, and `GREATER_EQUAL`_, are independently tested to see if + they are defined variables. If so, their defined values are used otherwise the original value is used. -* Both left and right hand arguments to ``STRLESS``, ``STRGREATER``, - ``STREQUAL``, ``STRLESS_EQUAL``, and ``STRGREATER_EQUAL`` are independently - tested to see if they are defined variables, if so their defined values are +* Both left and right hand arguments to `STRLESS`_, `STRGREATER`_, + `STREQUAL`_, `STRLESS_EQUAL`_, and `STRGREATER_EQUAL`_ are independently + tested to see if they are defined variables. If so, their defined values are used otherwise the original value is used. -* Both left and right hand arguments to ``VERSION_LESS``, - ``VERSION_GREATER``, ``VERSION_EQUAL``, ``VERSION_LESS_EQUAL``, and - ``VERSION_GREATER_EQUAL`` are independently tested to see if they are defined - variables, if so their defined values are used otherwise the original value +* Both left and right hand arguments to `VERSION_LESS`_, + `VERSION_GREATER`_, `VERSION_EQUAL`_, `VERSION_LESS_EQUAL`_, and + `VERSION_GREATER_EQUAL`_ are independently tested to see if they are defined + variables. If so, their defined values are used otherwise the original value is used. -* The right hand argument to ``NOT`` is tested to see if it is a boolean - constant, if so the value is used, otherwise it is assumed to be a +* The right hand argument to `NOT`_ is tested to see if it is a boolean + constant. If so, the value is used, otherwise it is assumed to be a variable and it is dereferenced. -* The left and right hand arguments to ``AND`` and ``OR`` are independently - tested to see if they are boolean constants, if so they are used as +* The left and right hand arguments to `AND`_ and `OR`_ are independently + tested to see if they are boolean constants. If so, they are used as such, otherwise they are assumed to be variables and are dereferenced. .. versionchanged:: 3.1 diff --git a/Help/command/install.rst b/Help/command/install.rst index 126888a..d5092ae 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -158,6 +158,9 @@ that may be installed: ``.lib``, in contrast to the ``.dll`` libraries that go to ``RUNTIME``); * On AIX, the *linker import file* created for executables with :prop_tgt:`ENABLE_EXPORTS` enabled. + * On macOS, the *linker import file* created for shared libraries with + :prop_tgt:`ENABLE_EXPORTS` enabled (except when marked as ``FRAMEWORK``, + see below). ``LIBRARY`` Target artifacts of this kind include: @@ -308,6 +311,11 @@ the following additional arguments: value of ``COMPONENT``. It is an error to use this parameter outside of a ``LIBRARY`` block. + .. versionchanged:: 3.27 + This parameter is also usable for an ``ARCHIVE`` block to manage + the linker import file created, on macOS, for shared libraries with + :prop_tgt:`ENABLE_EXPORTS` enabled. + Consider the following example: .. code-block:: cmake @@ -342,6 +350,11 @@ the following additional arguments: option installs nothing. It is an error to use this parameter outside of a ``LIBRARY`` block. + .. versionchanged:: 3.27 + This parameter is also usable for an ``ARCHIVE`` block to manage + the linker import file created, on macOS, for shared libraries with + :prop_tgt:`ENABLE_EXPORTS` enabled. + When ``NAMELINK_ONLY`` is given, either ``NAMELINK_COMPONENT`` or ``COMPONENT`` may be used to specify the installation component of the namelink, but ``COMPONENT`` should generally be preferred. @@ -355,6 +368,11 @@ the following additional arguments: installs the library. It is an error to use this parameter outside of a ``LIBRARY`` block. + .. versionchanged:: 3.27 + This parameter is also usable for an ``ARCHIVE`` block to manage + the linker import file created, on macOS, for shared libraries with + :prop_tgt:`ENABLE_EXPORTS` enabled. + If ``NAMELINK_SKIP`` is specified, ``NAMELINK_COMPONENT`` has no effect. It is not recommended to use ``NAMELINK_SKIP`` in conjunction with ``NAMELINK_COMPONENT``. diff --git a/Help/command/string.rst b/Help/command/string.rst index c24b9bc..b47fa09 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -45,16 +45,16 @@ Synopsis `JSON`_ string(JSON <out-var> [ERROR_VARIABLE <error-var>] - {:ref:`GET <JSON_GET>` | :ref:`TYPE <JSON_TYPE>` | :ref:`LENGTH <JSON_LENGTH>` | :ref:`REMOVE <JSON_REMOVE>`} + {`GET <JSON GET_>`_ | `TYPE <JSON TYPE_>`_ | `LENGTH <JSON LENGTH_>`_ | `REMOVE <JSON REMOVE_>`_} <json-string> <member|index> [<member|index> ...]) string(JSON <out-var> [ERROR_VARIABLE <error-var>] - :ref:`MEMBER <JSON_MEMBER>` <json-string> + `MEMBER <JSON MEMBER_>`_ <json-string> [<member|index> ...] <index>) string(JSON <out-var> [ERROR_VARIABLE <error-var>] - :ref:`SET <JSON_SET>` <json-string> + `SET <JSON SET_>`_ <json-string> <member|index> [<member|index> ...] <value>) string(JSON <out-var> [ERROR_VARIABLE <error-var>] - :ref:`EQUAL <JSON_EQUAL>` <json-string1> <json-string2>) + `EQUAL <JSON EQUAL_>`_ <json-string1> <json-string2>) Search and Replace ^^^^^^^^^^^^^^^^^^ @@ -62,75 +62,60 @@ Search and Replace Search and Replace With Plain Strings """"""""""""""""""""""""""""""""""""" -.. _FIND: - -.. code-block:: cmake - +.. signature:: string(FIND <string> <substring> <output_variable> [REVERSE]) -Return the position where the given ``<substring>`` was found in -the supplied ``<string>``. If the ``REVERSE`` flag was used, the command will -search for the position of the last occurrence of the specified -``<substring>``. If the ``<substring>`` is not found, a position of -1 is -returned. - -The ``string(FIND)`` subcommand treats all strings as ASCII-only characters. -The index stored in ``<output_variable>`` will also be counted in bytes, -so strings containing multi-byte characters may lead to unexpected results. + Return the position where the given ``<substring>`` was found in + the supplied ``<string>``. If the ``REVERSE`` flag was used, the command + will search for the position of the last occurrence of the specified + ``<substring>``. If the ``<substring>`` is not found, a position of -1 is + returned. -.. _REPLACE: - -.. code-block:: cmake + The ``string(FIND)`` subcommand treats all strings as ASCII-only characters. + The index stored in ``<output_variable>`` will also be counted in bytes, + so strings containing multi-byte characters may lead to unexpected results. +.. signature:: string(REPLACE <match_string> <replace_string> <output_variable> <input> [<input>...]) -Replace all occurrences of ``<match_string>`` in the ``<input>`` -with ``<replace_string>`` and store the result in the ``<output_variable>``. + Replace all occurrences of ``<match_string>`` in the ``<input>`` + with ``<replace_string>`` and store the result in the ``<output_variable>``. Search and Replace With Regular Expressions """"""""""""""""""""""""""""""""""""""""""" -.. _`REGEX MATCH`: - -.. code-block:: cmake - +.. signature:: string(REGEX MATCH <regular_expression> <output_variable> <input> [<input>...]) -Match the ``<regular_expression>`` once and store the match in the -``<output_variable>``. -All ``<input>`` arguments are concatenated before matching. -Regular expressions are specified in the subsection just below. - -.. _`REGEX MATCHALL`: - -.. code-block:: cmake + Match the ``<regular_expression>`` once and store the match in the + ``<output_variable>``. + All ``<input>`` arguments are concatenated before matching. + Regular expressions are specified in the subsection just below. +.. signature:: string(REGEX MATCHALL <regular_expression> <output_variable> <input> [<input>...]) -Match the ``<regular_expression>`` as many times as possible and store the -matches in the ``<output_variable>`` as a list. -All ``<input>`` arguments are concatenated before matching. - -.. _`REGEX REPLACE`: - -.. code-block:: cmake + Match the ``<regular_expression>`` as many times as possible and store the + matches in the ``<output_variable>`` as a list. + All ``<input>`` arguments are concatenated before matching. +.. signature:: string(REGEX REPLACE <regular_expression> <replacement_expression> <output_variable> <input> [<input>...]) -Match the ``<regular_expression>`` as many times as possible and substitute -the ``<replacement_expression>`` for the match in the output. -All ``<input>`` arguments are concatenated before matching. + Match the ``<regular_expression>`` as many times as possible and substitute + the ``<replacement_expression>`` for the match in the output. + All ``<input>`` arguments are concatenated before matching. -The ``<replacement_expression>`` may refer to parenthesis-delimited -subexpressions of the match using ``\1``, ``\2``, ..., ``\9``. Note that -two backslashes (``\\1``) are required in CMake code to get a backslash -through argument parsing. + The ``<replacement_expression>`` may refer to parenthesis-delimited + subexpressions of the match using ``\1``, ``\2``, ..., ``\9``. Note that + two backslashes (``\\1``) are required in CMake code to get a backslash + through argument parsing. .. _`Regex Specification`: @@ -201,130 +186,100 @@ newlines, and backslashes (respectively) to pass in a regex. For example: Manipulation ^^^^^^^^^^^^ -.. _APPEND: - -.. code-block:: cmake - +.. signature:: string(APPEND <string_variable> [<input>...]) -.. versionadded:: 3.4 - -Append all the ``<input>`` arguments to the string. + .. versionadded:: 3.4 -.. _PREPEND: - -.. code-block:: cmake + Append all the ``<input>`` arguments to the string. +.. signature:: string(PREPEND <string_variable> [<input>...]) -.. versionadded:: 3.10 - -Prepend all the ``<input>`` arguments to the string. - -.. _CONCAT: + .. versionadded:: 3.10 -.. code-block:: cmake + Prepend all the ``<input>`` arguments to the string. +.. signature:: string(CONCAT <output_variable> [<input>...]) -Concatenate all the ``<input>`` arguments together and store -the result in the named ``<output_variable>``. - -.. _JOIN: - -.. code-block:: cmake + Concatenate all the ``<input>`` arguments together and store + the result in the named ``<output_variable>``. +.. signature:: string(JOIN <glue> <output_variable> [<input>...]) -.. versionadded:: 3.12 - -Join all the ``<input>`` arguments together using the ``<glue>`` -string and store the result in the named ``<output_variable>``. - -To join a list's elements, prefer to use the ``JOIN`` operator -from the :command:`list` command. This allows for the elements to have -special characters like ``;`` in them. + .. versionadded:: 3.12 -.. _TOLOWER: + Join all the ``<input>`` arguments together using the ``<glue>`` + string and store the result in the named ``<output_variable>``. -.. code-block:: cmake + To join a list's elements, prefer to use the ``JOIN`` operator + from the :command:`list` command. This allows for the elements to have + special characters like ``;`` in them. +.. signature:: string(TOLOWER <string> <output_variable>) -Convert ``<string>`` to lower characters. - -.. _TOUPPER: - -.. code-block:: cmake + Convert ``<string>`` to lower characters. +.. signature:: string(TOUPPER <string> <output_variable>) -Convert ``<string>`` to upper characters. - -.. _LENGTH: - -.. code-block:: cmake + Convert ``<string>`` to upper characters. +.. signature:: string(LENGTH <string> <output_variable>) -Store in an ``<output_variable>`` a given string's length in bytes. -Note that this means if ``<string>`` contains multi-byte characters, the -result stored in ``<output_variable>`` will *not* be the number of characters. - -.. _SUBSTRING: - -.. code-block:: cmake + Store in an ``<output_variable>`` a given string's length in bytes. + Note that this means if ``<string>`` contains multi-byte characters, + the result stored in ``<output_variable>`` will *not* be + the number of characters. +.. signature:: string(SUBSTRING <string> <begin> <length> <output_variable>) -Store in an ``<output_variable>`` a substring of a given ``<string>``. If -``<length>`` is ``-1`` the remainder of the string starting at ``<begin>`` -will be returned. - -.. versionchanged:: 3.2 - If ``<string>`` is shorter than ``<length>`` then the end of the string - is used instead. Previous versions of CMake reported an error in this case. - -Both ``<begin>`` and ``<length>`` are counted in bytes, so care must -be exercised if ``<string>`` could contain multi-byte characters. + Store in an ``<output_variable>`` a substring of a given ``<string>``. If + ``<length>`` is ``-1`` the remainder of the string starting at ``<begin>`` + will be returned. -.. _STRIP: + .. versionchanged:: 3.2 + If ``<string>`` is shorter than ``<length>`` + then the end of the string is used instead. + Previous versions of CMake reported an error in this case. -.. code-block:: cmake + Both ``<begin>`` and ``<length>`` are counted in bytes, so care must + be exercised if ``<string>`` could contain multi-byte characters. +.. signature:: string(STRIP <string> <output_variable>) -Store in an ``<output_variable>`` a substring of a given ``<string>`` with -leading and trailing spaces removed. - -.. _GENEX_STRIP: - -.. code-block:: cmake + Store in an ``<output_variable>`` a substring of a given ``<string>`` + with leading and trailing spaces removed. +.. signature:: string(GENEX_STRIP <string> <output_variable>) -.. versionadded:: 3.1 - -Strip any :manual:`generator expressions <cmake-generator-expressions(7)>` -from the input ``<string>`` and store the result in the ``<output_variable>``. - -.. _REPEAT: + .. versionadded:: 3.1 -.. code-block:: cmake + Strip any :manual:`generator expressions <cmake-generator-expressions(7)>` + from the input ``<string>`` and store the result + in the ``<output_variable>``. +.. signature:: string(REPEAT <string> <count> <output_variable>) -.. versionadded:: 3.15 + .. versionadded:: 3.15 -Produce the output string as the input ``<string>`` repeated ``<count>`` times. + Produce the output string as the input ``<string>`` + repeated ``<count>`` times. Comparison ^^^^^^^^^^ .. _COMPARE: -.. code-block:: cmake - +.. signature:: string(COMPARE LESS <string1> <string2> <output_variable>) string(COMPARE GREATER <string1> <string2> <output_variable>) string(COMPARE EQUAL <string1> <string2> <output_variable>) @@ -332,240 +287,217 @@ Comparison string(COMPARE LESS_EQUAL <string1> <string2> <output_variable>) string(COMPARE GREATER_EQUAL <string1> <string2> <output_variable>) -Compare the strings and store true or false in the ``<output_variable>``. + Compare the strings and store true or false in the ``<output_variable>``. -.. versionadded:: 3.7 - Added the ``LESS_EQUAL`` and ``GREATER_EQUAL`` options. + .. versionadded:: 3.7 + Added the ``LESS_EQUAL`` and ``GREATER_EQUAL`` options. .. _`Supported Hash Algorithms`: Hashing ^^^^^^^ -.. _`HASH`: - -.. code-block:: cmake - +.. signature:: string(<HASH> <output_variable> <input>) + :target: HASH + + Compute a cryptographic hash of the ``<input>`` string. + The supported ``<HASH>`` algorithm names are: + + ``MD5`` + Message-Digest Algorithm 5, RFC 1321. + ``SHA1`` + US Secure Hash Algorithm 1, RFC 3174. + ``SHA224`` + US Secure Hash Algorithms, RFC 4634. + ``SHA256`` + US Secure Hash Algorithms, RFC 4634. + ``SHA384`` + US Secure Hash Algorithms, RFC 4634. + ``SHA512`` + US Secure Hash Algorithms, RFC 4634. + ``SHA3_224`` + Keccak SHA-3. + ``SHA3_256`` + Keccak SHA-3. + ``SHA3_384`` + Keccak SHA-3. + ``SHA3_512`` + Keccak SHA-3. -Compute a cryptographic hash of the ``<input>`` string. -The supported ``<HASH>`` algorithm names are: - -``MD5`` - Message-Digest Algorithm 5, RFC 1321. -``SHA1`` - US Secure Hash Algorithm 1, RFC 3174. -``SHA224`` - US Secure Hash Algorithms, RFC 4634. -``SHA256`` - US Secure Hash Algorithms, RFC 4634. -``SHA384`` - US Secure Hash Algorithms, RFC 4634. -``SHA512`` - US Secure Hash Algorithms, RFC 4634. -``SHA3_224`` - Keccak SHA-3. -``SHA3_256`` - Keccak SHA-3. -``SHA3_384`` - Keccak SHA-3. -``SHA3_512`` - Keccak SHA-3. - -.. versionadded:: 3.8 - Added the ``SHA3_*`` hash algorithms. + .. versionadded:: 3.8 + Added the ``SHA3_*`` hash algorithms. Generation ^^^^^^^^^^ -.. _ASCII: - -.. code-block:: cmake - +.. signature:: string(ASCII <number> [<number> ...] <output_variable>) -Convert all numbers into corresponding ASCII characters. - -.. _HEX: - -.. code-block:: cmake + Convert all numbers into corresponding ASCII characters. +.. signature:: string(HEX <string> <output_variable>) -.. versionadded:: 3.18 - -Convert each byte in the input ``<string>`` to its hexadecimal representation -and store the concatenated hex digits in the ``<output_variable>``. Letters in -the output (``a`` through ``f``) are in lowercase. + .. versionadded:: 3.18 -.. _CONFIGURE: - -.. code-block:: cmake + Convert each byte in the input ``<string>`` to its hexadecimal representation + and store the concatenated hex digits in the ``<output_variable>``. + Letters in the output (``a`` through ``f``) are in lowercase. +.. signature:: string(CONFIGURE <string> <output_variable> [@ONLY] [ESCAPE_QUOTES]) -Transform a ``<string>`` like :command:`configure_file` transforms a file. - -.. _MAKE_C_IDENTIFIER: - -.. code-block:: cmake + Transform a ``<string>`` like :command:`configure_file` transforms a file. +.. signature:: string(MAKE_C_IDENTIFIER <string> <output_variable>) -Convert each non-alphanumeric character in the input ``<string>`` to an -underscore and store the result in the ``<output_variable>``. If the first -character of the ``<string>`` is a digit, an underscore will also be prepended -to the result. - -.. _RANDOM: - -.. code-block:: cmake + Convert each non-alphanumeric character in the input ``<string>`` to an + underscore and store the result in the ``<output_variable>``. If the first + character of the ``<string>`` is a digit, an underscore will also be + prepended to the result. +.. signature:: string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>] [RANDOM_SEED <seed>] <output_variable>) -Return a random string of given ``<length>`` consisting of -characters from the given ``<alphabet>``. Default length is 5 characters -and default alphabet is all numbers and upper and lower case letters. -If an integer ``RANDOM_SEED`` is given, its value will be used to seed the -random number generator. - -.. _TIMESTAMP: - -.. code-block:: cmake + Return a random string of given ``<length>`` consisting of + characters from the given ``<alphabet>``. Default length is 5 characters + and default alphabet is all numbers and upper and lower case letters. + If an integer ``RANDOM_SEED`` is given, its value will be used to seed the + random number generator. +.. signature:: string(TIMESTAMP <output_variable> [<format_string>] [UTC]) -Write a string representation of the current date -and/or time to the ``<output_variable>``. - -If the command is unable to obtain a timestamp, the ``<output_variable>`` -will be set to the empty string ``""``. + Write a string representation of the current date + and/or time to the ``<output_variable>``. -The optional ``UTC`` flag requests the current date/time representation to -be in Coordinated Universal Time (UTC) rather than local time. + If the command is unable to obtain a timestamp, the ``<output_variable>`` + will be set to the empty string ``""``. -The optional ``<format_string>`` may contain the following format -specifiers: - -``%%`` - .. versionadded:: 3.8 + The optional ``UTC`` flag requests the current date/time representation to + be in Coordinated Universal Time (UTC) rather than local time. - A literal percent sign (%). + The optional ``<format_string>`` may contain the following format + specifiers: -``%d`` - The day of the current month (01-31). + ``%%`` + .. versionadded:: 3.8 -``%H`` - The hour on a 24-hour clock (00-23). + A literal percent sign (%). -``%I`` - The hour on a 12-hour clock (01-12). + ``%d`` + The day of the current month (01-31). -``%j`` - The day of the current year (001-366). + ``%H`` + The hour on a 24-hour clock (00-23). -``%m`` - The month of the current year (01-12). + ``%I`` + The hour on a 12-hour clock (01-12). -``%b`` - .. versionadded:: 3.7 + ``%j`` + The day of the current year (001-366). - Abbreviated month name (e.g. Oct). + ``%m`` + The month of the current year (01-12). -``%B`` - .. versionadded:: 3.10 + ``%b`` + .. versionadded:: 3.7 - Full month name (e.g. October). + Abbreviated month name (e.g. Oct). -``%M`` - The minute of the current hour (00-59). + ``%B`` + .. versionadded:: 3.10 -``%s`` - .. versionadded:: 3.6 + Full month name (e.g. October). - Seconds since midnight (UTC) 1-Jan-1970 (UNIX time). + ``%M`` + The minute of the current hour (00-59). -``%S`` - The second of the current minute. 60 represents a leap second. (00-60) + ``%s`` + .. versionadded:: 3.6 -``%f`` - .. versionadded:: 3.23 + Seconds since midnight (UTC) 1-Jan-1970 (UNIX time). - The microsecond of the current second (000000-999999). + ``%S`` + The second of the current minute. 60 represents a leap second. (00-60) -``%U`` - The week number of the current year (00-53). + ``%f`` + .. versionadded:: 3.23 -``%V`` - .. versionadded:: 3.22 + The microsecond of the current second (000000-999999). - The ISO 8601 week number of the current year (01-53). + ``%U`` + The week number of the current year (00-53). -``%w`` - The day of the current week. 0 is Sunday. (0-6) + ``%V`` + .. versionadded:: 3.22 -``%a`` - .. versionadded:: 3.7 + The ISO 8601 week number of the current year (01-53). - Abbreviated weekday name (e.g. Fri). + ``%w`` + The day of the current week. 0 is Sunday. (0-6) -``%A`` - .. versionadded:: 3.10 + ``%a`` + .. versionadded:: 3.7 - Full weekday name (e.g. Friday). + Abbreviated weekday name (e.g. Fri). -``%y`` - The last two digits of the current year (00-99). + ``%A`` + .. versionadded:: 3.10 -``%Y`` - The current year. + Full weekday name (e.g. Friday). -``%z`` - .. versionadded:: 3.26 + ``%y`` + The last two digits of the current year (00-99). - The offset of the time zone from UTC, in hours and minutes, - with format ``+hhmm`` or ``-hhmm``. + ``%Y`` + The current year. -``%Z`` - .. versionadded:: 3.26 + ``%z`` + .. versionadded:: 3.26 - The time zone name. + The offset of the time zone from UTC, in hours and minutes, + with format ``+hhmm`` or ``-hhmm``. -Unknown format specifiers will be ignored and copied to the output -as-is. + ``%Z`` + .. versionadded:: 3.26 -If no explicit ``<format_string>`` is given, it will default to: + The time zone name. -:: + Unknown format specifiers will be ignored and copied to the output + as-is. - %Y-%m-%dT%H:%M:%S for local time. - %Y-%m-%dT%H:%M:%SZ for UTC. + If no explicit ``<format_string>`` is given, it will default to: -.. versionadded:: 3.8 - If the ``SOURCE_DATE_EPOCH`` environment variable is set, - its value will be used instead of the current time. - See https://reproducible-builds.org/specs/source-date-epoch/ for details. + :: -.. _UUID: + %Y-%m-%dT%H:%M:%S for local time. + %Y-%m-%dT%H:%M:%SZ for UTC. -.. code-block:: cmake + .. versionadded:: 3.8 + If the ``SOURCE_DATE_EPOCH`` environment variable is set, + its value will be used instead of the current time. + See https://reproducible-builds.org/specs/source-date-epoch/ for details. +.. signature:: string(UUID <output_variable> NAMESPACE <namespace> NAME <name> TYPE <MD5|SHA1> [UPPER]) -.. versionadded:: 3.1 + .. versionadded:: 3.1 -Create a universally unique identifier (aka GUID) as per RFC4122 -based on the hash of the combined values of ``<namespace>`` -(which itself has to be a valid UUID) and ``<name>``. -The hash algorithm can be either ``MD5`` (Version 3 UUID) or -``SHA1`` (Version 5 UUID). -A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` -where each ``x`` represents a lower case hexadecimal character. -Where required, an uppercase representation can be requested -with the optional ``UPPER`` flag. + Create a universally unique identifier (aka GUID) as per RFC4122 + based on the hash of the combined values of ``<namespace>`` + (which itself has to be a valid UUID) and ``<name>``. + The hash algorithm can be either ``MD5`` (Version 3 UUID) or + ``SHA1`` (Version 5 UUID). + A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` + where each ``x`` represents a lower case hexadecimal character. + Where required, an uppercase representation can be requested + with the optional ``UPPER`` flag. .. _JSON: @@ -586,78 +518,72 @@ Functionality for querying a JSON string. option is not present, a fatal error message is generated. If no error occurs, the ``<error-variable>`` will be set to ``NOTFOUND``. -.. _JSON_GET: -.. code-block:: cmake - +.. signature:: string(JSON <out-var> [ERROR_VARIABLE <error-variable>] GET <json-string> <member|index> [<member|index> ...]) + :target: JSON GET -Get an element from ``<json-string>`` at the location given -by the list of ``<member|index>`` arguments. -Array and object elements will be returned as a JSON string. -Boolean elements will be returned as ``ON`` or ``OFF``. -Null elements will be returned as an empty string. -Number and string types will be returned as strings. - -.. _JSON_TYPE: -.. code-block:: cmake + Get an element from ``<json-string>`` at the location given + by the list of ``<member|index>`` arguments. + Array and object elements will be returned as a JSON string. + Boolean elements will be returned as ``ON`` or ``OFF``. + Null elements will be returned as an empty string. + Number and string types will be returned as strings. +.. signature:: string(JSON <out-var> [ERROR_VARIABLE <error-variable>] TYPE <json-string> <member|index> [<member|index> ...]) + :target: JSON TYPE -Get the type of an element in ``<json-string>`` at the location -given by the list of ``<member|index>`` arguments. The ``<out-var>`` -will be set to one of ``NULL``, ``NUMBER``, ``STRING``, ``BOOLEAN``, -``ARRAY``, or ``OBJECT``. - -.. _JSON_MEMBER: -.. code-block:: cmake + Get the type of an element in ``<json-string>`` at the location + given by the list of ``<member|index>`` arguments. The ``<out-var>`` + will be set to one of ``NULL``, ``NUMBER``, ``STRING``, ``BOOLEAN``, + ``ARRAY``, or ``OBJECT``. +.. signature:: string(JSON <out-var> [ERROR_VARIABLE <error-var>] MEMBER <json-string> [<member|index> ...] <index>) + :target: JSON MEMBER -Get the name of the ``<index>``-th member in ``<json-string>`` at the location -given by the list of ``<member|index>`` arguments. -Requires an element of object type. - -.. _JSON_LENGTH: -.. code-block:: cmake + Get the name of the ``<index>``-th member in ``<json-string>`` + at the location given by the list of ``<member|index>`` arguments. + Requires an element of object type. +.. signature:: string(JSON <out-var> [ERROR_VARIABLE <error-variable>] LENGTH <json-string> [<member|index> ...]) + :target: JSON LENGTH -Get the length of an element in ``<json-string>`` at the location -given by the list of ``<member|index>`` arguments. -Requires an element of array or object type. - -.. _JSON_REMOVE: -.. code-block:: cmake + Get the length of an element in ``<json-string>`` at the location + given by the list of ``<member|index>`` arguments. + Requires an element of array or object type. +.. signature:: string(JSON <out-var> [ERROR_VARIABLE <error-variable>] REMOVE <json-string> <member|index> [<member|index> ...]) + :target: JSON REMOVE -Remove an element from ``<json-string>`` at the location -given by the list of ``<member|index>`` arguments. The JSON string -without the removed element will be stored in ``<out-var>``. - -.. _JSON_SET: -.. code-block:: cmake + Remove an element from ``<json-string>`` at the location + given by the list of ``<member|index>`` arguments. The JSON string + without the removed element will be stored in ``<out-var>``. +.. signature:: string(JSON <out-var> [ERROR_VARIABLE <error-variable>] SET <json-string> <member|index> [<member|index> ...] <value>) + :target: JSON SET -Set an element in ``<json-string>`` at the location -given by the list of ``<member|index>`` arguments to ``<value>``. -The contents of ``<value>`` should be valid JSON. - -.. _JSON_EQUAL: -.. code-block:: cmake + Set an element in ``<json-string>`` at the location + given by the list of ``<member|index>`` arguments to ``<value>``. + The contents of ``<value>`` should be valid JSON. +.. signature:: string(JSON <out-var> [ERROR_VARIABLE <error-var>] EQUAL <json-string1> <json-string2>) + :target: JSON EQUAL -Compare the two JSON objects given by ``<json-string1>`` and ``<json-string2>`` -for equality. The contents of ``<json-string1>`` and ``<json-string2>`` -should be valid JSON. The ``<out-var>`` will be set to a true value if the -JSON objects are considered equal, or a false value otherwise. + Compare the two JSON objects given by ``<json-string1>`` + and ``<json-string2>`` for equality. The contents of ``<json-string1>`` + and ``<json-string2>`` should be valid JSON. The ``<out-var>`` + will be set to a true value if the JSON objects are considered equal, + or a false value otherwise. diff --git a/Help/dev/documentation.rst b/Help/dev/documentation.rst index db92022..8cd71b4 100644 --- a/Help/dev/documentation.rst +++ b/Help/dev/documentation.rst @@ -168,46 +168,154 @@ documentation: See the `cmake-variables(7)`_ manual and the `set()`_ command. -Documentation objects in the CMake Domain come from two sources. -First, the CMake extension to Sphinx transforms every document named -with the form ``Help/<type>/<file-name>.rst`` to a domain object with -type ``<type>``. The object name is extracted from the document title, -which is expected to be of the form:: - - <object-name> - ------------- - -and to appear at or near the top of the ``.rst`` file before any other -lines starting in a letter, digit, ``<``, or ``$``. If no such title appears -literally in the ``.rst`` file, the object name is the ``<file-name>``. -If a title does appear, it is expected that ``<file-name>`` is equal -to ``<object-name>`` with any ``<`` and ``>`` characters removed, -or in the case of a ``$<genex-name>`` or ``$<genex-name:...>``, the -``genex-name``. - -Second, the CMake Domain provides directives to define objects inside -other documents: +Documentation objects in the CMake Domain come from two sources: + +1. The CMake extension to Sphinx transforms every document named + with the form ``Help/<type>/<file-name>.rst`` to a domain object with + type ``<type>``. The object name is extracted from the document title, + which is expected to be of the form:: + + <object-name> + ------------- + + and to appear at or near the top of the ``.rst`` file before any other lines + starting in a letter, digit, ``<``, or ``$``. If no such title appears + literally in the ``.rst`` file, the object name is the ``<file-name>``. + If a title does appear, it is expected that ``<file-name>`` is equal + to ``<object-name>`` with any ``<`` and ``>`` characters removed, + or in the case of a ``$<genex-name>`` or ``$<genex-name:...>``, the + ``genex-name``. + +2. `CMake Domain directives`_ may be used in documents to explicitly define + some object types: + + * `command directive`_ + * `envvar directive`_ + * `genex directive`_ + * `variable directive`_ + + Object types for which no directive is available must be defined using + the document transform above. + +CMake Domain Directives +----------------------- + +The CMake Domain provides the following directives. + +``command`` directive +^^^^^^^^^^^^^^^^^^^^^ + +Document a "command" object: .. code-block:: rst - .. command:: <command-name> + .. command:: <command-name> + + This indented block documents <command-name>. - This indented block documents <command-name>. +The directive requires a single argument, the command name. - .. envvar:: <envvar-name> +``envvar`` directive +^^^^^^^^^^^^^^^^^^^^ + +Document an "envvar" object: + +.. code-block:: rst - This indented block documents <envvar-name>. + .. envvar:: <envvar-name> + + This indented block documents <envvar-name>. + +The directive requires a single argument, the environment variable name. + +``genex`` directive +^^^^^^^^^^^^^^^^^^^ + +Document a "genex" object: + +.. code-block:: rst .. genex:: <genex-name> This indented block documents <genex-name>. +The directive requires a single argument, the generator expression name. + +``signature`` directive +^^^^^^^^^^^^^^^^^^^^^^^ + +Document `CMake Command Signatures <Style: CMake Command Signatures_>`_ +within a ``Help/command/<command-name>.rst`` document. + +.. code-block:: rst + + .. signature:: <command-name>(<signature>) + + This indented block documents one or more signatures of a CMake command. + +The ``signature`` directive requires one argument, the signature summary: + +* One or more signatures must immediately follow the ``::``. + The first signature may optionally be placed on the same line. + A blank line following the ``signature`` directive will result in a + documentation generation error: ``1 argument(s) required, 0 supplied``. + +* Signatures may be split across multiple lines, but the final ``)`` of each + signature must be the last character on its line. + +* Blank lines between signatures are not allowed. (Content after a blank line + is treated as part of the description.) + +* Whitespace in signatures is not preserved. To document a complex signature, + abbreviate it in the ``signature`` directive argument and specify the full + signature in a ``code-block`` in the description. + +The ``signature`` directive generates a hyperlink target for each signature: + +* Default target names are automatically extracted from leading "keyword" + arguments in the signatures, where a keyword is any sequence of + non-space starting with a letter. For example, the signature + ``string(REGEX REPLACE <match-regex> ...)`` generates the target + ``REGEX REPLACE``, similar to ``.. _`REGEX REPLACE`:``. + +* Custom target names may be specified using a ``:target:`` option. + For example: + + .. code-block:: rst + + .. signature:: + cmake_path(GET <path-var> ROOT_NAME <out-var>) + cmake_path(GET <path-var> ROOT_PATH <out-var>) + :target: + GET ROOT_NAME + GET ROOT_PATH + + Provide a custom target name for each signature, one per line. + The first target may optionally be placed on the same line as ``:target:``. + +* If a target name is already in use earlier in the document, no hyperlink + target will be generated. + +* The targets may be referenced from within the same document using + ```REF`_`` or ```TEXT <REF_>`_`` syntax. Like reStructuredText section + headers, the targets do not work with Sphinx ``:ref:`` syntax, however + they can be globally referenced using e.g. ``:command:`string(APPEND)```. + +The directive treats its content as the documentation of the signature(s). +Indent the signature documentation accordingly. + +``variable`` directive +^^^^^^^^^^^^^^^^^^^^^^ + +Document a "variable" object: + +.. code-block:: rst + .. variable:: <variable-name> This indented block documents <variable-name>. -Object types for which no directive is available must be defined using -the first approach above. +The directive requires a single argument, the variable name. .. _`Sphinx Domain`: http://sphinx-doc.org/domains.html .. _`cmake(1)`: https://cmake.org/cmake/help/latest/manual/cmake.1.html @@ -329,11 +437,11 @@ paragraph. Style: CMake Command Signatures ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Command signatures should be marked up as plain literal blocks, not as -cmake ``code-blocks``. - -Signatures are separated from preceding content by a section header. -That is, use: +A ``Help/command/<command-name>.rst`` document defines one ``command`` +object in the `CMake Domain`_, but some commands have multiple signatures. +Use the CMake Domain's `signature directive`_ to document each signature. +Separate signatures from preceding content by a section header. +For example: .. code-block:: rst @@ -342,17 +450,23 @@ That is, use: Normal Libraries ^^^^^^^^^^^^^^^^ - :: - + .. signature:: add_library(<lib> ...) - This signature is used for ... + This signature is used for ... + +Use the following conventions in command signature documentation: + +* Use an angle-bracket ``<placeholder>`` for arguments to be specified + by the caller. Refer to them in prose using + `inline literal <Style: Inline Literals_>`_ syntax. + +* Wrap optional parts with square brackets. + +* Mark repeatable parts with a trailing ellipsis (``...``). -Signatures of commands should wrap optional parts with square brackets, -and should mark list of optional arguments with an ellipsis (``...``). -Elements of the signature which are specified by the user should be -specified with angle brackets, and may be referred to in prose using -``inline-literal`` syntax. +The ``signature`` directive may be used multiple times for different +signatures of the same command. Style: Boolean Constants ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst index c97d542..c7581e8 100644 --- a/Help/dev/experimental.rst +++ b/Help/dev/experimental.rst @@ -57,17 +57,36 @@ dependency scanning. This is similar to the Fortran modules support, but relies on external tools to scan C++20 translation units for module dependencies. The approach is described by Kitware's `D1483r1`_ paper. -The ``CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP`` variable can be set to ``1`` -in order to activate this undocumented experimental infrastructure. This -is **intended to make the functionality available to compiler writers** so -they can use it to develop and test their dependency scanning tool. -The ``CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE`` variable must also be set -to tell CMake how to invoke the C++20 module dependency scanning tool. - -MSVC 19.34 (provided with Visual Studio 17.4) and above contains the support -that CMake needs and has these variables already set up as required and only -the UUID and the ``CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP`` variables need to be -set. +In order to activate CMake's experimental support for C++20 module +dependencies, set the following variables: + +``CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API`` + Set this to the UUID documented above. + +``CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP`` + Set this to ``1`` in order to activate this undocumented experimental + infrastructure. This is **intended to make the functionality available + to compiler writers** so they can use it to develop and test their + dependency scanning tool. + +Some compilers already have support for module dependency scanning: + +* MSVC 19.34 and newer (provided with Visual Studio 17.4 and newer) +* LLVM/Clang 16.0 and newer + +For those, only the above variables need to be set by project code. +For compilers with in-development support, additional variables must +be set as follows. + +``CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE`` + Set this to tell CMake how to invoke the C++20 module dependency + scanning tool. + +``CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT`` + Set this for compilers that generate module maps. See below. + +``CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG`` + Set this for compilers that generate module maps. See below. For example, add code like the following to a test project: diff --git a/Help/guide/tutorial/Adding Generator Expressions.rst b/Help/guide/tutorial/Adding Generator Expressions.rst index 08f3eea..aba9f7a 100644 --- a/Help/guide/tutorial/Adding Generator Expressions.rst +++ b/Help/guide/tutorial/Adding Generator Expressions.rst @@ -105,7 +105,7 @@ The specific lines to remove are as follows: :name: CMakeLists.txt-CXX_STANDARD-variable-remove :language: cmake :start-after: # specify the C++ standard - :end-before: # TODO 5: Create helper variables + :end-before: # TODO 6: Create helper variables Next, we need to create an interface library, ``tutorial_compiler_flags``. And then use :command:`target_compile_features` to add the compiler feature @@ -128,7 +128,8 @@ then use :command:`target_compile_features` to add the compiler feature </details> Finally, with our interface library set up, we need to link our -executable ``Target`` and our ``MathFunctions`` library to our new +executable ``Target``, our ``MathFunctions`` library, and our ``SqrtLibrary`` +library to our new ``tutorial_compiler_flags`` library. Respectively, the code will look like this: @@ -147,7 +148,7 @@ this: </details> -and this: +this: .. raw:: html @@ -158,12 +159,30 @@ and this: :name: MathFunctions-CMakeLists.txt-target_link_libraries-step4 :language: cmake :start-after: # link our compiler flags interface library - :end-before: # TODO 1 + :end-before: target_link_libraries(MathFunctions + +.. raw:: html + + </details> + +and this: + +.. raw:: html + + <details><summary>TODO 4: Click to show/hide answer</summary> + +.. literalinclude:: Step5/MathFunctions/CMakeLists.txt + :caption: TODO 4: MathFunctions/CMakeLists.txt + :name: MathFunctions-SqrtLibrary-target_link_libraries-step4 + :language: cmake + :start-after: target_link_libraries(SqrtLibrary + :end-before: endif() .. raw:: html </details> + With this, all of our code still requires C++ 11 to build. Notice though that with this method, it gives us the ability to be specific about which targets get specific requirements. In addition, we create a single @@ -199,8 +218,8 @@ Files to Edit Getting Started --------------- -Start with the resulting files from Exercise 1. Complete ``TODO 4`` through -``TODO 7``. +Start with the resulting files from Exercise 1. Complete ``TODO 5`` through +``TODO 8``. First, in the top level ``CMakeLists.txt`` file, we need to set the :command:`cmake_minimum_required` to ``3.15``. In this exercise we are going @@ -230,10 +249,10 @@ version ``3.15``: .. raw:: html - <details><summary>TODO 4: Click to show/hide answer</summary> + <details><summary>TODO 5: Click to show/hide answer</summary> .. literalinclude:: Step5/CMakeLists.txt - :caption: TODO 4: CMakeLists.txt + :caption: TODO 5: CMakeLists.txt :name: MathFunctions-CMakeLists.txt-minimum-required-step4 :language: cmake :end-before: # set the project name and version @@ -249,10 +268,10 @@ variables ``gcc_like_cxx`` and ``msvc_cxx`` as follows: .. raw:: html - <details><summary>TODO 5: Click to show/hide answer</summary> + <details><summary>TODO 6: Click to show/hide answer</summary> .. literalinclude:: Step5/CMakeLists.txt - :caption: TODO 5: CMakeLists.txt + :caption: TODO 6: CMakeLists.txt :name: CMakeLists.txt-compile_lang_and_id :language: cmake :start-after: # the BUILD_INTERFACE genex @@ -270,10 +289,10 @@ interface library. .. raw:: html - <details><summary>TODO 6: Click to show/hide answer</summary> + <details><summary>TODO 7: Click to show/hide answer</summary> .. code-block:: cmake - :caption: TODO 6: CMakeLists.txt + :caption: TODO 7: CMakeLists.txt :name: CMakeLists.txt-compile_flags target_compile_options(tutorial_compiler_flags INTERFACE @@ -292,10 +311,10 @@ condition. The resulting full code looks like the following: .. raw:: html - <details><summary>TODO 7: Click to show/hide answer</summary> + <details><summary>TODO 8: Click to show/hide answer</summary> .. literalinclude:: Step5/CMakeLists.txt - :caption: TODO 7: CMakeLists.txt + :caption: TODO 8: CMakeLists.txt :name: CMakeLists.txt-target_compile_options-genex :language: cmake :start-after: set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>") diff --git a/Help/guide/tutorial/Adding a Custom Command and Generated File.rst b/Help/guide/tutorial/Adding a Custom Command and Generated File.rst index 9e6311e..c71a889 100644 --- a/Help/guide/tutorial/Adding a Custom Command and Generated File.rst +++ b/Help/guide/tutorial/Adding a Custom Command and Generated File.rst @@ -18,17 +18,16 @@ In the ``MathFunctions`` subdirectory, a new source file named After reviewing the file, we can see that the table is produced as valid C++ code and that the output filename is passed in as an argument. -The next step is to add the appropriate commands to the -``MathFunctions/CMakeLists.txt`` file to build the MakeTable executable and +The next step is to create ``MathFunctions/MakeTable.cmake``. Then, add the +appropriate commands to the file to build the ``MakeTable`` executable and then run it as part of the build process. A few commands are needed to accomplish this. -First, in the ``USE_MYMATH`` section of ``MathFunctions/CMakeLists.txt``, -we add an executable for ``MakeTable``. +First, we add an executable for ``MakeTable``. -.. literalinclude:: Step9/MathFunctions/CMakeLists.txt - :caption: MathFunctions/CMakeLists.txt - :name: MathFunctions/CMakeLists.txt-add_executable-MakeTable +.. literalinclude:: Step9/MathFunctions/MakeTable.cmake + :caption: MathFunctions/MakeTable.cmake + :name: MathFunctions/MakeTable.cmake-add_executable-MakeTable :language: cmake :start-after: # first we add the executable that generates the table :end-before: target_link_libraries @@ -36,9 +35,9 @@ we add an executable for ``MakeTable``. After creating the executable, we add the ``tutorial_compiler_flags`` to our executable using :command:`target_link_libraries`. -.. literalinclude:: Step9/MathFunctions/CMakeLists.txt - :caption: MathFunctions/CMakeLists.txt - :name: MathFunctions/CMakeLists.txt-link-tutorial-compiler-flags +.. literalinclude:: Step9/MathFunctions/MakeTable.cmake + :caption: MathFunctions/MakeTable.cmake + :name: MathFunctions/MakeTable.cmake-link-tutorial-compiler-flags :language: cmake :start-after: add_executable :end-before: # add the command to generate @@ -46,16 +45,15 @@ executable using :command:`target_link_libraries`. Then we add a custom command that specifies how to produce ``Table.h`` by running MakeTable. -.. literalinclude:: Step9/MathFunctions/CMakeLists.txt - :caption: MathFunctions/CMakeLists.txt - :name: MathFunctions/CMakeLists.txt-add_custom_command-Table.h +.. literalinclude:: Step9/MathFunctions/MakeTable.cmake + :caption: MathFunctions/MakeTable.cmake + :name: MathFunctions/MakeTable.cmake-add_custom_command-Table.h :language: cmake :start-after: # add the command to generate the source code - :end-before: # library that just does sqrt Next we have to let CMake know that ``mysqrt.cxx`` depends on the generated file ``Table.h``. This is done by adding the generated ``Table.h`` to the list -of sources for the library MathFunctions. +of sources for the library ``SqrtLibrary``. .. literalinclude:: Step9/MathFunctions/CMakeLists.txt :caption: MathFunctions/CMakeLists.txt @@ -74,17 +72,15 @@ directories so that ``Table.h`` can be found and included by ``mysqrt.cxx``. :start-after: # state that we depend on our bin :end-before: target_link_libraries -As the last thing in our ``USE_MYMATH`` section, we need to link the our -flags onto ``SqrtLibrary`` and then link ``SqrtLibrary`` onto -``MathFunctions``. This makes the resulting ``USE_MYMATH`` section look like -the following: +As the last step, we need to include +``MakeTable.cmake`` at the top of the ``MathFunctions/CMakeLists.txt``. .. literalinclude:: Step9/MathFunctions/CMakeLists.txt :caption: MathFunctions/CMakeLists.txt - :name: MathFunctions/CMakeLists.txt-full_USE_MYMATH-section + :name: MathFunctions/CMakeLists.txt-include-MakeTable.cmake :language: cmake - :start-after: if (USE_MYMATH) - :end-before: endif() + :start-after: # generate Table.h + :end-before: # library that just does sqrt Now let's use the generated table. First, modify ``mysqrt.cxx`` to include ``Table.h``. Next, we can rewrite the ``mysqrt`` function to use the table: diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst index 2dd731f..d606f30 100644 --- a/Help/guide/tutorial/Adding a Library.rst +++ b/Help/guide/tutorial/Adding a Library.rst @@ -100,11 +100,11 @@ source files for the library are passed as an argument to <details><summary>TODO 1: Click to show/hide answer</summary> -.. literalinclude:: Step3/MathFunctions/CMakeLists.txt +.. code-block:: cmake :caption: TODO 1: MathFunctions/CMakeLists.txt :name: MathFunctions/CMakeLists.txt-add_library - :language: cmake - :end-before: # TODO 1 + + add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) .. raw:: html @@ -191,7 +191,7 @@ Lastly, replace ``sqrt`` with our library function ``mathfunctions::mysqrt``. <details><summary>TODO 6: Click to show/hide answer</summary> .. literalinclude:: Step3/tutorial.cxx - :caption: TODO 7: tutorial.cxx + :caption: TODO 6: tutorial.cxx :name: CMakeLists.txt-option :language: cmake :start-after: const double inputValue = std::stod(argv[1]); @@ -238,7 +238,7 @@ Getting Started --------------- Start with the resulting files from Exercise 1. Complete ``TODO 7`` through -``TODO 9``. +``TODO 14``. First create a variable ``USE_MYMATH`` using the :command:`option` command in ``MathFunctions/CMakeLists.txt``. In that same file, use that option @@ -247,6 +247,10 @@ to pass a compile definition to the ``MathFunctions`` library. Then, update ``MathFunctions.cxx`` to redirect compilation based on ``USE_MYMATH``. +Lastly, prevent ``mysqrt.cxx`` from being compiled when ``USE_MYMATH`` is on +by making it its own library inside of the ``USE_MYMATH`` block of +``MathFunctions/CMakeLists.txt``. + Build and Run ------------- @@ -315,16 +319,22 @@ definition ``USE_MYMATH``. <details><summary>TODO 8: Click to show/hide answer</summary> -.. literalinclude:: Step3/MathFunctions/CMakeLists.txt +.. code-block:: cmake :caption: TODO 8: MathFunctions/CMakeLists.txt :name: CMakeLists.txt-USE_MYMATH - :language: cmake - :start-after: USE_MYMATH "Use tutorial provided math implementation" ON) + + if (USE_MYMATH) + target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + endif() .. raw:: html </details> +When ``USE_MYMATH`` is ``ON``, the compile definition ``USE_MYMATH`` will +be set. We can then use this compile definition to enable or disable +sections of our source code. + The corresponding changes to the source code are fairly straightforward. In ``MathFunctions.cxx``, we make ``USE_MYMATH`` control which square root function is used: @@ -377,10 +387,68 @@ Finally, we need to include ``cmath`` now that we are using ``std::sqrt``. </details> -When ``USE_MYMATH`` is ``ON``, the compile definition ``USE_MYMATH`` will -be set. We can then use this compile definition to enable or disable -sections of our source code. With this strategy, we allow users to -toggle ``USE_MYMATH`` to manipulate what library is used in the build. +At this point, if ``USE_MYMATH`` is ``OFF``, ``mysqrt.cxx`` would not be used +but it will still be compiled because the ``MathFunctions`` target has +``mysqrt.cxx`` listed under sources. + +There are a few ways to fix this. The first option is to use +:command:`target_sources` to add ``mysqrt.cxx`` from within the ``USE_MYMATH`` +block. Another option is to create an additional library within the +``USE_MYMATH`` block which is responsible for compiling ``mysqrt.cxx``. For +the sake of this tutorial, we are going to create an additional library. + +First, from within ``USE_MYMATH`` create a library called ``SqrtLibrary`` +that has sources ``mysqrt.cxx``. + +.. raw:: html + + <details><summary>TODO 12: Click to show/hide answer</summary> + +.. literalinclude:: Step3/MathFunctions/CMakeLists.txt + :caption: TODO 12 : MathFunctions/CMakeLists.txt + :name: MathFunctions/CMakeLists.txt-add_library-SqrtLibrary + :language: cmake + :start-after: # library that just does sqrt + :end-before: target_link_libraries(MathFunctions + +.. raw:: html + + </details> + +Next, we link ``SqrtLibrary`` onto ``MathFunctions`` when ``USE_MYMATH`` is +enabled. + +.. raw:: html + + <details><summary>TODO 13: Click to show/hide answer</summary> + +.. literalinclude:: Step3/MathFunctions/CMakeLists.txt + :caption: TODO 13 : MathFunctions/CMakeLists.txt + :name: MathFunctions/CMakeLists.txt-target_link_libraries-SqrtLibrary + :language: cmake + :lines: 16-18 + +.. raw:: html + + </details> + +Finally, we can remove ``mysqrt.cxx`` from our ``MathFunctions`` library +source list because it will be pulled in when ``SqrtLibrary`` is included. + +.. raw:: html + + <details><summary>TODO 14: Click to show/hide answer</summary> + +.. literalinclude:: Step3/MathFunctions/CMakeLists.txt + :caption: TODO 14 : MathFunctions/CMakeLists.txt + :name: MathFunctions/CMakeLists.txt-remove-mysqrt.cxx-MathFunctions + :language: cmake + :end-before: # TODO 1: + +.. raw:: html + + </details> With these changes, the ``mysqrt`` function is now completely optional to -whoever is building and using the ``MathFunctions`` library. +whoever is building and using the ``MathFunctions`` library. Users can toggle +``USE_MYMATH`` to manipulate what library is used in the build. diff --git a/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt index d256db2..b221506 100644 --- a/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt @@ -15,16 +15,7 @@ if(USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") - # first we add the executable that generates the table - add_executable(MakeTable MakeTable.cxx) - target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) - - # add the command to generate the source code - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h - COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h - DEPENDS MakeTable - ) + include(MakeTable.cmake) # generates Table.h # library that just does sqrt add_library(SqrtLibrary STATIC diff --git a/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cmake b/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cmake new file mode 100644 index 0000000..12865a9 --- /dev/null +++ b/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cmake @@ -0,0 +1,10 @@ +# first we add the executable that generates the table +add_executable(MakeTable MakeTable.cxx) +target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) + +# add the command to generate the source code +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) diff --git a/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt index 6f6c430..36b3fe1 100644 --- a/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt @@ -13,16 +13,7 @@ if(USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") - # first we add the executable that generates the table - add_executable(MakeTable MakeTable.cxx) - target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) - - # add the command to generate the source code - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h - COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h - DEPENDS MakeTable - ) + include(MakeTable.cmake) # generates Table.h # library that just does sqrt add_library(SqrtLibrary STATIC diff --git a/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cmake b/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cmake new file mode 100644 index 0000000..12865a9 --- /dev/null +++ b/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cmake @@ -0,0 +1,10 @@ +# first we add the executable that generates the table +add_executable(MakeTable MakeTable.cxx) +target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) + +# add the command to generate the source code +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) diff --git a/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt index a60fb63..813bf90 100644 --- a/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt @@ -13,16 +13,7 @@ if(USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") - # first we add the executable that generates the table - add_executable(MakeTable MakeTable.cxx) - target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) - - # add the command to generate the source code - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h - COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h - DEPENDS MakeTable - ) + include(MakeTable.cmake) # generates Table.h # library that just does sqrt add_library(SqrtLibrary STATIC diff --git a/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cmake b/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cmake new file mode 100644 index 0000000..12865a9 --- /dev/null +++ b/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cmake @@ -0,0 +1,10 @@ +# first we add the executable that generates the table +add_executable(MakeTable MakeTable.cxx) +target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) + +# add the command to generate the source code +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) diff --git a/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt index a85f3cb..38694dd 100644 --- a/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt @@ -15,16 +15,7 @@ if(USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") - # first we add the executable that generates the table - add_executable(MakeTable MakeTable.cxx) - target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) - - # add the command to generate the source code - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h - COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h - DEPENDS MakeTable - ) + include(MakeTable.cmake) # generates Table.h # library that just does sqrt add_library(SqrtLibrary STATIC diff --git a/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cmake b/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cmake new file mode 100644 index 0000000..12865a9 --- /dev/null +++ b/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cmake @@ -0,0 +1,10 @@ +# first we add the executable that generates the table +add_executable(MakeTable MakeTable.cxx) +target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) + +# add the command to generate the source code +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) diff --git a/Help/guide/tutorial/Step2/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step2/MathFunctions/CMakeLists.txt index c468b0e..c3cd806 100644 --- a/Help/guide/tutorial/Step2/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step2/MathFunctions/CMakeLists.txt @@ -1,7 +1,15 @@ -# TODO 1: Add a library called MathFunctions +# TODO 14: Remove mysqrt.cxx from the list of sources + +# TODO 1: Add a library called MathFunctions with sources MathFunctions.cxx +# and mysqrt.cxx # Hint: You will need the add_library command # TODO 7: Create a variable USE_MYMATH using option and set default to ON # TODO 8: If USE_MYMATH is ON, use target_compile_definitions to pass # USE_MYMATH as a precompiled definition to our source files + +# TODO 12: When USE_MYMATH is ON, add a library for SqrtLibrary with +# source mysqrt.cxx + +# TODO 13: When USE_MYMATH is ON, link SqrtLibrary to the MathFunctions Library diff --git a/Help/guide/tutorial/Step3/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step3/MathFunctions/CMakeLists.txt index 90d6c24..6f86ffe 100644 --- a/Help/guide/tutorial/Step3/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step3/MathFunctions/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) +add_library(MathFunctions MathFunctions.cxx) # TODO 1: State that anybody linking to MathFunctions needs to include the # current source directory, while MathFunctions itself doesn't. @@ -8,4 +8,11 @@ add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) option(USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ) + + target_link_libraries(MathFunctions PUBLIC SqrtLibrary) endif() diff --git a/Help/guide/tutorial/Step4/CMakeLists.txt b/Help/guide/tutorial/Step4/CMakeLists.txt index dcda135..7531fb4 100644 --- a/Help/guide/tutorial/Step4/CMakeLists.txt +++ b/Help/guide/tutorial/Step4/CMakeLists.txt @@ -1,4 +1,4 @@ -# TODO 4: Update the minimum required version to 3.15 +# TODO 5: Update the minimum required version to 3.15 cmake_minimum_required(VERSION 3.10) @@ -15,19 +15,19 @@ project(Tutorial VERSION 1.0) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) -# TODO 5: Create helper variables to determine which compiler we are using: +# TODO 6: Create helper variables to determine which compiler we are using: # * Create a new variable gcc_like_cxx that is true if we are using CXX and # any of the following compilers: ARMClang, AppleClang, Clang, GNU, LCC # * Create a new variable msvc_cxx that is true if we are using CXX and MSVC # Hint: Use set() and COMPILE_LANG_AND_ID -# TODO 6: Add warning flag compile options to the interface library +# TODO 7: Add warning flag compile options to the interface library # tutorial_compiler_flags. # * For gcc_like_cxx, add flags -Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused # * For msvc_cxx, add flags -W3 # Hint: Use target_compile_options() -# TODO 7: With nested generator expressions, only use the flags for the +# TODO 8: With nested generator expressions, only use the flags for the # build-tree # Hint: Use BUILD_INTERFACE diff --git a/Help/guide/tutorial/Step4/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step4/MathFunctions/CMakeLists.txt index cc71d86..ffab4f0 100644 --- a/Help/guide/tutorial/Step4/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step4/MathFunctions/CMakeLists.txt @@ -1,4 +1,5 @@ -add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) +# create the MathFunctions library +add_library(MathFunctions MathFunctions.cxx) # state that anybody linking to us needs to include the current source dir # to find MathFunctions.h, while we don't. @@ -10,6 +11,15 @@ target_include_directories(MathFunctions option(USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ) + + # TODO 4: Link to tutorial_compiler_flags + + target_link_libraries(MathFunctions PUBLIC SqrtLibrary) endif() # TODO 3: Link to tutorial_compiler_flags diff --git a/Help/guide/tutorial/Step5/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step5/MathFunctions/CMakeLists.txt index 000a786..0c688f2 100644 --- a/Help/guide/tutorial/Step5/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step5/MathFunctions/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) +add_library(MathFunctions MathFunctions.cxx) # state that anybody linking to us needs to include the current source dir # to find MathFunctions.h, while we don't. @@ -10,6 +10,15 @@ target_include_directories(MathFunctions option(USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ) + + # link our compiler flags interface library + target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags) + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) endif() # link our compiler flags interface library diff --git a/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt index 623cb74..b1b925e 100644 --- a/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) +add_library(MathFunctions MathFunctions.cxx) # state that anybody linking to us needs to include the current source dir # to find MathFunctions.h, while we don't. @@ -10,6 +10,14 @@ target_include_directories(MathFunctions option(USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ) + + target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags) + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) endif() # link our compiler flags interface library @@ -17,6 +25,9 @@ target_link_libraries(MathFunctions PUBLIC tutorial_compiler_flags) # install libs set(installable_libs MathFunctions tutorial_compiler_flags) +if(TARGET SqrtLibrary) + list(APPEND installable_libs SqrtLibrary) +endif() install(TARGETS ${installable_libs} DESTINATION lib) # install include headers install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step7/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step7/MathFunctions/CMakeLists.txt index c0d1e72..897ec0e 100644 --- a/Help/guide/tutorial/Step7/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step7/MathFunctions/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) +add_library(MathFunctions MathFunctions.cxx) # state that anybody linking to us needs to include the current source dir # to find MathFunctions.h, while we don't. @@ -11,6 +11,13 @@ option(USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ) + + target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags) + # TODO 1: Include CheckCXXSourceCompiles # TODO 2: Use check_cxx_source_compiles with simple C++ code to verify @@ -27,9 +34,11 @@ if (USE_MYMATH) # } # TODO 3: Conditionally on HAVE_LOG and HAVE_EXP, add private compile - # definitions "HAVE_LOG" and "HAVE_EXP" to the MathFunctions target. + # definitions "HAVE_LOG" and "HAVE_EXP" to the SqrtLibrary target. # Hint: Use target_compile_definitions() + + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) endif() # link our compiler flags interface library @@ -37,6 +46,9 @@ target_link_libraries(MathFunctions PUBLIC tutorial_compiler_flags) # install libs set(installable_libs MathFunctions tutorial_compiler_flags) +if(TARGET SqrtLibrary) + list(APPEND installable_libs SqrtLibrary) +endif() install(TARGETS ${installable_libs} DESTINATION lib) # install include headers install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step8/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step8/MathFunctions/CMakeLists.txt index 861014d..872a24a 100644 --- a/Help/guide/tutorial/Step8/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step8/MathFunctions/CMakeLists.txt @@ -1,10 +1,17 @@ -add_library(MathFunctions MathFunctions.cxx mysqrt.cxx) +add_library(MathFunctions MathFunctions.cxx) # should we use our own math functions option(USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ) + + target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags) + # does this system provide the log and exp functions? include(CheckCXXSourceCompiles) check_cxx_source_compiles(" @@ -24,10 +31,12 @@ if (USE_MYMATH) # add compile definitions if(HAVE_LOG AND HAVE_EXP) - target_compile_definitions(MathFunctions + target_compile_definitions(SqrtLibrary PRIVATE "HAVE_LOG" "HAVE_EXP" ) endif() + + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) endif() # state that anybody linking to us needs to include the current source dir @@ -41,6 +50,9 @@ target_link_libraries(MathFunctions PUBLIC tutorial_compiler_flags) # install libs set(installable_libs MathFunctions tutorial_compiler_flags) +if(TARGET SqrtLibrary) + list(APPEND installable_libs SqrtLibrary) +endif() install(TARGETS ${installable_libs} DESTINATION lib) # install include headers install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt index 05c8616..54cecf8 100644 --- a/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt @@ -11,16 +11,8 @@ option(USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") - # first we add the executable that generates the table - add_executable(MakeTable MakeTable.cxx) - target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) - - # add the command to generate the source code - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h - COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h - DEPENDS MakeTable - ) + # generate Table.h + include(MakeTable.cmake) # library that just does sqrt add_library(SqrtLibrary STATIC @@ -30,8 +22,8 @@ if (USE_MYMATH) # state that we depend on our binary dir to find Table.h target_include_directories(SqrtLibrary PRIVATE - ${CMAKE_CURRENT_BINARY_DIR} - ) + ${CMAKE_CURRENT_BINARY_DIR} + ) target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags) target_link_libraries(MathFunctions PRIVATE SqrtLibrary) diff --git a/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cmake b/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cmake new file mode 100644 index 0000000..12865a9 --- /dev/null +++ b/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cmake @@ -0,0 +1,10 @@ +# first we add the executable that generates the table +add_executable(MakeTable MakeTable.cxx) +target_link_libraries(MakeTable PRIVATE tutorial_compiler_flags) + +# add the command to generate the source code +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index b9d621b..b88b864 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -37,6 +37,8 @@ is defined as an executable formed by compiling and linking ``zipapp.cpp``. When linking the ``zipapp`` executable, the ``archive`` static library is linked in. +.. _`Binary Executables`: + Binary Executables ------------------ @@ -797,6 +799,10 @@ An *archive* output artifact of a buildsystem target may be: created by the :command:`add_executable` command when its :prop_tgt:`ENABLE_EXPORTS` target property is set. +* On macOS: the linker import file (e.g. ``.tbd``) of a shared library target + created by the :command:`add_library` command with the ``SHARED`` option and + when its :prop_tgt:`ENABLE_EXPORTS` target property is set. + The :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY` and :prop_tgt:`ARCHIVE_OUTPUT_NAME` target properties may be used to control archive output artifact locations and names in the build tree. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index ae52ba1..a640c13 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -1503,6 +1503,76 @@ In the following, the phrase "the ``tgt`` filename" means the name of the Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on (see policy :policy:`CMP0112`). +.. genex:: $<TARGET_IMPORT_FILE:tgt> + + .. versionadded:: 3.27 + + Full path to the linker import file. On DLL platforms, it would be the + ``.lib`` file. On AIX, for the executables, and on macOS, for the shared + libraries, it could be, respectively, the ``.imp`` or ``.tbd`` import file, + depending of the value of :prop_tgt:`ENABLE_EXPORTS` property. + + An empty string is returned when there is no import file associated with the + target. + +.. genex:: $<TARGET_IMPORT_FILE_BASE_NAME:tgt> + + .. versionadded:: 3.27 + + Base name of file linker import file of the target ``tgt`` without prefix and + suffix. For example, if target file name is ``libbase.tbd``, the base name is + ``base``. + + See also the :prop_tgt:`OUTPUT_NAME` and :prop_tgt:`ARCHIVE_OUTPUT_NAME` + target properties and their configuration specific variants + :prop_tgt:`OUTPUT_NAME_<CONFIG>` and :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>`. + + The :prop_tgt:`<CONFIG>_POSTFIX` and :prop_tgt:`DEBUG_POSTFIX` target + properties can also be considered. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_IMPORT_FILE_PREFIX:tgt> + + .. versionadded:: 3.27 + + Prefix of the import file of the target ``tgt``. + + See also the :prop_tgt:`IMPORT_PREFIX` target property. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_IMPORT_FILE_SUFFIX:tgt> + + .. versionadded:: 3.27 + + Suffix of the import file of the target ``tgt``. + + The suffix corresponds to the file extension (such as ".lib" or ".tbd"). + + See also the :prop_tgt:`IMPORT_SUFFIX` target property. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_IMPORT_FILE_NAME:tgt> + + .. versionadded:: 3.27 + + Name of the import file of the target target ``tgt``. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_IMPORT_FILE_DIR:tgt> + + Directory of the import file of the target ``tgt``. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + .. genex:: $<TARGET_LINKER_FILE:tgt> File used when linking to the ``tgt`` target. This will usually @@ -1510,13 +1580,22 @@ In the following, the phrase "the ``tgt`` filename" means the name of the but for a shared library on DLL platforms, it would be the ``.lib`` import library associated with the DLL. + .. versionadded:: 3.27 + On macOS, it could be the ``.tbd`` import file associated with the shared + library, depending of the value of :prop_tgt:`ENABLE_EXPORTS` property. + + This generator expression is equivalent to + :genex:`$<TARGET_LINKER_LIBRARY_FILE>` or + :genex:`$<TARGET_LINKER_IMPORT_FILE>` generator expressions, depending of the + characteristics of the target and the platform. + .. genex:: $<TARGET_LINKER_FILE_BASE_NAME:tgt> .. versionadded:: 3.15 Base name of file used to link the target ``tgt``, i.e. - ``$<TARGET_LINKER_FILE_NAME:tgt>`` without prefix and suffix. For example, - if target file name is ``libbase.a``, the base name is ``base``. + :genex:`$<TARGET_LINKER_FILE_NAME:tgt>` without prefix and suffix. For + example, if target file name is ``libbase.a``, the base name is ``base``. See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`, and :prop_tgt:`LIBRARY_OUTPUT_NAME` target properties and their configuration @@ -1570,9 +1649,151 @@ In the following, the phrase "the ``tgt`` filename" means the name of the Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on (see policy :policy:`CMP0112`). +.. genex:: $<TARGET_LINKER_LIBRARY_FILE:tgt> + + .. versionadded:: 3.27 + + File used when linking o the ``tgt`` target is done using directly the + library, and not an import file. This will usually be the library that + ``tgt`` represents (``.a``, ``.so``, ``.dylib``). So, on DLL platforms, it + will be an empty string. + +.. genex:: $<TARGET_LINKER_LIBRARY_FILE_BASE_NAME:tgt> + + .. versionadded:: 3.27 + + Base name of library file used to link the target ``tgt``, i.e. + :genex:`$<TARGET_LINKER_LIBRARY_FILE_NAME:tgt>` without prefix and suffix. + For example, if target file name is ``libbase.a``, the base name is ``base``. + + See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`, + and :prop_tgt:`LIBRARY_OUTPUT_NAME` target properties and their configuration + specific variants :prop_tgt:`OUTPUT_NAME_<CONFIG>`, + :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>` and + :prop_tgt:`LIBRARY_OUTPUT_NAME_<CONFIG>`. + + The :prop_tgt:`<CONFIG>_POSTFIX` and :prop_tgt:`DEBUG_POSTFIX` target + properties can also be considered. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_LIBRARY_FILE_PREFIX:tgt> + + .. versionadded:: 3.27 + + Prefix of the library file used to link target ``tgt``. + + See also the :prop_tgt:`PREFIX` target property. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_LIBRARY_FILE_SUFFIX:tgt> + + .. versionadded:: 3.27 + + Suffix of the library file used to link target ``tgt``. + + The suffix corresponds to the file extension (such as ".a" or ".dylib"). + + See also the :prop_tgt:`SUFFIX` target property. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_LIBRARY_FILE_NAME:tgt> + + .. versionadded:: 3.27 + + Name of the library file used to link target ``tgt``. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_LIBRARY_FILE_DIR:tgt> + + .. versionadded:: 3.27 + + Directory of the library file used to link target ``tgt``. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_IMPORT_FILE:tgt> + + .. versionadded:: 3.27 + + File used when linking to the ``tgt`` target is done using an import + file. This will usually be the import file that ``tgt`` represents + (``.lib``, ``.tbd``). So, when no import file is involved in the link step, + an empty string is returned. + +.. genex:: $<TARGET_LINKER_IMPORT_FILE_BASE_NAME:tgt> + + .. versionadded:: 3.27 + + Base name of the import file used to link the target ``tgt``, i.e. + :genex:`$<TARGET_LINKER_IMPORT_FILE_NAME:tgt>` without prefix and suffix. + For example, if target file name is ``libbase.tbd``, the base name is ``base``. + + See also the :prop_tgt:`OUTPUT_NAME` and :prop_tgt:`ARCHIVE_OUTPUT_NAME`, + target properties and their configuration + specific variants :prop_tgt:`OUTPUT_NAME_<CONFIG>` and + :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>`. + + The :prop_tgt:`<CONFIG>_POSTFIX` and :prop_tgt:`DEBUG_POSTFIX` target + properties can also be considered. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_IMPORT_FILE_PREFIX:tgt> + + .. versionadded:: 3.27 + + Prefix of the import file used to link target ``tgt``. + + See also the :prop_tgt:`IMPORT_PREFIX` target property. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_IMPORT_FILE_SUFFIX:tgt> + + .. versionadded:: 3.27 + + Suffix of the import file used to link target ``tgt``. + + The suffix corresponds to the file extension (such as ".lib" or ".tbd"). + + See also the :prop_tgt:`IMPORT_SUFFIX` target property. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_IMPORT_FILE_NAME:tgt> + + .. versionadded:: 3.27 + + Name of the import file used to link target ``tgt``. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_LINKER_IMPORT_FILE_DIR:tgt> + + .. versionadded:: 3.27 + + Directory of the import file used to link target ``tgt``. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + .. genex:: $<TARGET_SONAME_FILE:tgt> File with soname (``.so.3``) where ``tgt`` is the name of a target. + .. genex:: $<TARGET_SONAME_FILE_NAME:tgt> Name of file with soname (``.so.3``). @@ -1582,11 +1803,35 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. genex:: $<TARGET_SONAME_FILE_DIR:tgt> - Directory of with soname (``.so.3``). + Directory of file with soname (``.so.3``). Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on (see policy :policy:`CMP0112`). +.. genex:: $<TARGET_SONAME_IMPORT_FILE:tgt> + + .. versionadded:: 3.27 + + Import file with soname (``.3.tbd``) where ``tgt`` is the name of a target. + +.. genex:: $<TARGET_SONAME_IMPORT_FILE_NAME:tgt> + + .. versionadded:: 3.27 + + Name of the import file with soname (``.3.tbd``). + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + +.. genex:: $<TARGET_SONAME_IMPORT_FILE_DIR:tgt> + + .. versionadded:: 3.27 + + Directory of the import file with soname (``.3.tbd``). + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. + .. genex:: $<TARGET_PDB_FILE:tgt> .. versionadded:: 3.1 @@ -1677,7 +1922,9 @@ In the following, the phrase "the ``tgt`` filename" means the name of the List of DLLs that the target depends on at runtime. This is determined by the locations of all the ``SHARED`` targets in the target's transitive - dependencies. Using this generator expression on targets other than + dependencies. If only the directories of the DLLs are needed, see the + :genex:`TARGET_RUNTIME_DLL_DIRS` generator expression. + Using this generator expression on targets other than executables, ``SHARED`` libraries, and ``MODULE`` libraries is an error. **On non-DLL platforms, this expression always evaluates to an empty string**. @@ -1709,6 +1956,20 @@ On platforms that support runtime paths (``RPATH``), refer to the :prop_tgt:`INSTALL_RPATH` target property. On Apple platforms, refer to the :prop_tgt:`INSTALL_NAME_DIR` target property. +.. genex:: $<TARGET_RUNTIME_DLL_DIRS:tgt> + + .. versionadded:: 3.27 + + List of the directories which contain the DLLs that the target depends on at + runtime (see :genex:`TARGET_RUNTIME_DLLS`). This is determined by + the locations of all the ``SHARED`` targets in the target's transitive + dependencies. Using this generator expression on targets other than + executables, ``SHARED`` libraries, and ``MODULE`` libraries is an error. + **On non-DLL platforms, this expression always evaluates to an empty string**. + + This generator expression can e.g. be used to create a batch file using + :command:`file(GENERATE)` which sets the PATH environment variable accordingly. + Export And Install Expressions ------------------------------ diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index a0d872f..d0774cb 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -530,6 +530,9 @@ of alphanumeric characters plus ``_`` and ``-``. Variables have dynamic scope. Each variable "set" or "unset" creates a binding in the current scope: +Block Scope + The :command:`block` command may create a new scope for variable bindings. + Function Scope `Command Definitions`_ created by the :command:`function` command create commands that, when invoked, process the recorded commands diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 28272ad..a37a45c 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,8 @@ Policies Introduced by CMake 3.27 .. toctree:: :maxdepth: 1 + CMP0147: Visual Studio generators build custom commands in parallel. </policy/CMP0147> + CMP0146: The FindCUDA module is removed. </policy/CMP0146> CMP0145: The Dart and FindDart modules are removed. </policy/CMP0145> CMP0144: find_package uses upper-case PACKAGENAME_ROOT variables. </policy/CMP0144> diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 373450d..99ea564 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -429,6 +429,7 @@ Variables that Control the Build /variable/CMAKE_DISABLE_PRECOMPILE_HEADERS /variable/CMAKE_DLL_NAME_WITH_SOVERSION /variable/CMAKE_ENABLE_EXPORTS + /variable/CMAKE_EXECUTABLE_ENABLE_EXPORTS /variable/CMAKE_EXE_LINKER_FLAGS /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG_INIT @@ -508,6 +509,7 @@ Variables that Control the Build /variable/CMAKE_POSITION_INDEPENDENT_CODE /variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY /variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY_CONFIG + /variable/CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS /variable/CMAKE_SHARED_LINKER_FLAGS /variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG /variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG_INIT diff --git a/Help/policy/CMP0146.rst b/Help/policy/CMP0146.rst new file mode 100644 index 0000000..c7cac22 --- /dev/null +++ b/Help/policy/CMP0146.rst @@ -0,0 +1,29 @@ +CMP0146 +------- + +.. versionadded:: 3.27 + +The :module:`FindCUDA` module is removed. + +The :module:`FindCUDA` module has been deprecated since CMake 3.10. +CMake 3.27 and above prefer to not provide the module. +This policy provides compatibility for projects that have not been +ported away from it. + +Projects using the :module:`FindCUDA` module should be updated to use +CMake's first-class ``CUDA`` language support. List ``CUDA`` among the +languages named in the top-level call to the :command:`project` command, +or call the :command:`enable_language` command with ``CUDA``. +Then one can add CUDA (``.cu``) sources directly to targets, +similar to other languages. + +The ``OLD`` behavior of this policy is for ``find_package(CUDA)`` to +load the deprecated module. The ``NEW`` behavior is for uses of the +module to fail as if it does not exist. + +This policy was introduced in CMake version 3.27. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0147.rst b/Help/policy/CMP0147.rst new file mode 100644 index 0000000..0f25096 --- /dev/null +++ b/Help/policy/CMP0147.rst @@ -0,0 +1,24 @@ +CMP0147 +------- + +.. versionadded:: 3.27 + +:ref:`Visual Studio Generators` build custom commands in parallel. + +Visual Studio 15.8 (2017) and newer support building custom commands in +parallel. CMake 3.27 and above prefer to enable this behavior by adding +a ``BuildInParallel`` setting to custom commands in ``.vcxproj`` files. +This policy provides compatibility for projects that have not been updated +to expect this, e.g., because their custom commands were accidentally +relying on serial execution by MSBuild. + +The ``OLD`` behavior for this policy is to not add ``BuildInParallel``. +The ``NEW`` behavior for this policy is to add ``BuildInParallel`` for +VS 15.8 and newer. + +This policy was introduced in CMake version 3.27. 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/ARCHIVE_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.rst index 677e06d..abb627c 100644 --- a/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.rst +++ b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.rst @@ -6,4 +6,7 @@ ARCHIVE_OUTPUT_DIRECTORY .. |CMAKE_XXX_OUTPUT_DIRECTORY| replace:: :variable:`CMAKE_ARCHIVE_OUTPUT_DIRECTORY` .. include:: XXX_OUTPUT_DIRECTORY.txt +.. |IDEM| replace:: in the same directory +.. include:: MACOS_IMPORT_FILES.txt + See also the :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>` target property. diff --git a/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst b/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst index 6150193..1f1c467 100644 --- a/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst +++ b/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst @@ -5,4 +5,7 @@ ARCHIVE_OUTPUT_NAME .. |xxx| replace:: archive .. include:: XXX_OUTPUT_NAME.txt +.. |IDEM| replace:: with the same name +.. include:: MACOS_IMPORT_FILES.txt + See also the :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>` target property. diff --git a/Help/prop_tgt/ENABLE_EXPORTS.rst b/Help/prop_tgt/ENABLE_EXPORTS.rst index 0b1064a..3e9b285 100644 --- a/Help/prop_tgt/ENABLE_EXPORTS.rst +++ b/Help/prop_tgt/ENABLE_EXPORTS.rst @@ -1,7 +1,7 @@ ENABLE_EXPORTS -------------- -Specify whether an executable exports symbols for loadable modules. +Specify whether an executable or a shared library exports symbols. Normally an executable does not export any symbols because it is the final program. It is possible for an executable to export symbols to @@ -28,4 +28,29 @@ varies by platform: automatically bind symbols when the module is loaded. This property is initialized by the value of the variable -:variable:`CMAKE_ENABLE_EXPORTS` if it is set when a target is created. +:variable:`CMAKE_EXECUTABLE_ENABLE_EXPORTS` if it is set when an executable +target is created. + +.. versionadded:: 3.27 + On macOS, to link with a shared library (standard one as well as framework), + a linker import file (e.g. a text-based stubs file, with ``.tbd`` extension) + can be used instead of the shared library itself. + +The generation of these linker import files, as well as the consumption, is +controlled by this property. When this property is set to true, CMake will +generate a ``.tbd`` file for each shared library created by +:command:`add_library` command. This allow other targets to use this ``.tbd`` +file to link to the library with the :command:`target_link_libraries` +command. + +.. note:: + + For compatibility purpose, this property will be ignored if + :prop_tgt:`XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS <XCODE_ATTRIBUTE_<an-attribute>>` + target property or the + :variable:`CMAKE_XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS <CMAKE_XCODE_ATTRIBUTE_<an-attribute>>` + variable is set to ``NO``. + +This property is initialized by the value of the variable +:variable:`CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS` if it is set when a shared +library target is created. diff --git a/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst b/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst index 6de1baa..a4746d3 100644 --- a/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst +++ b/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst @@ -1,11 +1,22 @@ IMPORTED_CONFIGURATIONS ----------------------- -Configurations provided for an IMPORTED target. - -Set this to the list of configuration names available for an IMPORTED -target. The names correspond to configurations defined in the project -from which the target is imported. If the importing project uses a -different set of configurations the names may be mapped using the -MAP_IMPORTED_CONFIG_<CONFIG> property. Ignored for non-imported -targets. +Configurations provided for an :ref:`imported target <Imported targets>`. + +Set this to the list of configuration names available for an imported +target. For each configuration named, the imported target's artifacts +must be specified in other target properties: + +* :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`, or +* :prop_tgt:`IMPORTED_IMPLIB_<CONFIG>` (on DLL platforms, on AIX for + :ref:`Executables <Binary Executables>` or on Apple for + :ref:`Shared Libraries <Normal Libraries>`), or +* :prop_tgt:`IMPORTED_OBJECTS_<CONFIG>` (for :ref:`Object Libraries`), or +* :prop_tgt:`IMPORTED_LIBNAME_<CONFIG>` (for :ref:`Interface Libraries`). + +The configuration names correspond to those defined in the project from +which the target is imported. If the importing project uses a different +set of configurations, the names may be mapped using the +:prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property. + +The ``IMPORTED_CONFIGURATIONS`` property is ignored for non-imported targets. diff --git a/Help/prop_tgt/IMPORTED_IMPLIB.rst b/Help/prop_tgt/IMPORTED_IMPLIB.rst index c8b6fde..e67acba 100644 --- a/Help/prop_tgt/IMPORTED_IMPLIB.rst +++ b/Help/prop_tgt/IMPORTED_IMPLIB.rst @@ -3,7 +3,22 @@ IMPORTED_IMPLIB Full path to the import library for an ``IMPORTED`` target. -Set this to the location of the ``.lib`` part of a Windows DLL, or on -AIX set it to an import file created for executables that export symbols -(see the :prop_tgt:`ENABLE_EXPORTS` target property). -Ignored for non-imported targets. +This property may be set: + +* On DLL platforms, to the location of the ``.lib`` part of the DLL. +* On AIX, to an import file (e.g. ``.imp``) created for executables that export + symbols (see the :prop_tgt:`ENABLE_EXPORTS` target property). +* On macOS, to an import file (e.g. ``.tbd``) created for shared libraries (see + the :prop_tgt:`ENABLE_EXPORTS` target property). For frameworks this is the + location of the ``.tbd`` file symlink just inside the framework folder. + +The ``IMPORTED_IMPLIB`` target property may be overridden for a +given configuration ``<CONFIG>`` by the configuration-specific +:prop_tgt:`IMPORTED_IMPLIB_<CONFIG>` target property. Furthermore, +the :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property may be +used to map between a project's configurations and those of an imported +target. If none of these is set then the name of any other configuration +listed in the :prop_tgt:`IMPORTED_CONFIGURATIONS` target property may be +selected and its :prop_tgt:`IMPORTED_IMPLIB_<CONFIG>` value used. + +This property is ignored for non-imported targets. diff --git a/Help/prop_tgt/IMPORTED_LOCATION.rst b/Help/prop_tgt/IMPORTED_LOCATION.rst index ddd910a..a7207d8 100644 --- a/Help/prop_tgt/IMPORTED_LOCATION.rst +++ b/Help/prop_tgt/IMPORTED_LOCATION.rst @@ -27,5 +27,5 @@ selected and its :prop_tgt:`IMPORTED_LOCATION_<CONFIG>` value used. To get the location of an imported target read one of the :prop_tgt:`LOCATION` or ``LOCATION_<CONFIG>`` properties. -For platforms with import libraries (e.g. Windows) see also +For platforms with import libraries (e.g. Windows, AIX or macOS) see also :prop_tgt:`IMPORTED_IMPLIB`. diff --git a/Help/prop_tgt/MACOS_IMPORT_FILES.txt b/Help/prop_tgt/MACOS_IMPORT_FILES.txt new file mode 100644 index 0000000..3c98fc8 --- /dev/null +++ b/Help/prop_tgt/MACOS_IMPORT_FILES.txt @@ -0,0 +1,12 @@ +.. note:: + + On macOS, this property will be ignored for the linker import files (e.g. + ``.tbd`` files, see :prop_tgt:`ENABLE_EXPORTS` property for details) when: + + * The :prop_tgt:`FRAMEWORK` is set, because the framework layout cannot be + changed. + * The :generator:`Xcode` generator is used, due to the limitations and + constraints of the ``Xcode`` tool. + + In both cases, the linker import files will be generated |IDEM| as the shared + library. diff --git a/Help/release/3.24.rst b/Help/release/3.24.rst index f484e1a..e7ddf2a 100644 --- a/Help/release/3.24.rst +++ b/Help/release/3.24.rst @@ -380,3 +380,10 @@ Changes made since CMake 3.24.0 include the following. * Some implementation updates were made to support ecosystem changes and/or fix regressions. + +3.24.4 +------ + +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. diff --git a/Help/release/3.25.rst b/Help/release/3.25.rst index 2d04741..cb6984c 100644 --- a/Help/release/3.25.rst +++ b/Help/release/3.25.rst @@ -257,3 +257,10 @@ Changes made since CMake 3.25.0 include the following. * On Windows, the ``icpx`` compiler now provided by Intel oneAPI 2023.0 and above is no longer selected because its GNU-like command-line is not yet supported by CMake. + +3.25.3 +------ + +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. diff --git a/Help/release/dev/Apple-tbd-files-management.rst b/Help/release/dev/Apple-tbd-files-management.rst new file mode 100644 index 0000000..edcfe55 --- /dev/null +++ b/Help/release/dev/Apple-tbd-files-management.rst @@ -0,0 +1,6 @@ +Apple-tbd-files-management +-------------------------- + +* Support for text-based stubs (i.e. ``.tbd`` files) was added on macOS + platform. This capability is managed through the :prop_tgt:`ENABLE_EXPORTS` + property. diff --git a/Help/release/dev/FindCUDA-remove.rst b/Help/release/dev/FindCUDA-remove.rst new file mode 100644 index 0000000..e8b09d4 --- /dev/null +++ b/Help/release/dev/FindCUDA-remove.rst @@ -0,0 +1,6 @@ +FindCUDA-remove +--------------- + +* The :module:`FindCUDA` module has been fully deprecated via policy + :policy:`CMP0146`. Port projects to CMake's first-class ``CUDA`` + language support. diff --git a/Help/release/dev/FindCUDAToolkit-target-for-cudla.rst b/Help/release/dev/FindCUDAToolkit-target-for-cudla.rst new file mode 100644 index 0000000..9de456e --- /dev/null +++ b/Help/release/dev/FindCUDAToolkit-target-for-cudla.rst @@ -0,0 +1,4 @@ +FindCUDAToolkit-target-for-cudla +-------------------------------- + +* The :module:`FindCUDAToolkit` module now provides an imported target for ``cudla``, if found. diff --git a/Help/release/dev/FindOpenGL-gles.rst b/Help/release/dev/FindOpenGL-gles.rst new file mode 100644 index 0000000..fcbc516 --- /dev/null +++ b/Help/release/dev/FindOpenGL-gles.rst @@ -0,0 +1,5 @@ +FindOpenGL-gles +--------------- + +* The :module:`FindOpenGL` module gained support for components + ``GLES2`` and ``GLES3``. diff --git a/Help/release/dev/FindwxWidgets-imported-target.rst b/Help/release/dev/FindwxWidgets-imported-target.rst new file mode 100644 index 0000000..c04e0ac --- /dev/null +++ b/Help/release/dev/FindwxWidgets-imported-target.rst @@ -0,0 +1,4 @@ +FindwxWidgets-imported-target +----------------------------- + +* The :module:`FindwxWidgets` module now provides an imported target. diff --git a/Help/release/dev/cxx-module-extensions.rst b/Help/release/dev/cxx-module-extensions.rst new file mode 100644 index 0000000..92df86a --- /dev/null +++ b/Help/release/dev/cxx-module-extensions.rst @@ -0,0 +1,5 @@ +cxx-module-extensions +--------------------- + +* Source file extensions ``.ccm``, ``.cxxm``, or ``.c++m`` are now + treated as C++. diff --git a/Help/release/dev/vs-BuildInParallel.rst b/Help/release/dev/vs-BuildInParallel.rst new file mode 100644 index 0000000..ef344c7 --- /dev/null +++ b/Help/release/dev/vs-BuildInParallel.rst @@ -0,0 +1,5 @@ +vs-BuildInParallel +------------------ + +* :ref:`Visual Studio Generators`, for VS 15.8 (2017) and newer, now + build custom commands in parallel. See policy :policy:`CMP0147`. diff --git a/Help/variable/CMAKE_ENABLE_EXPORTS.rst b/Help/variable/CMAKE_ENABLE_EXPORTS.rst index 9f43de3..d2c5ed0 100644 --- a/Help/variable/CMAKE_ENABLE_EXPORTS.rst +++ b/Help/variable/CMAKE_ENABLE_EXPORTS.rst @@ -8,3 +8,7 @@ Specify whether executables export symbols for loadable modules. This variable is used to initialize the :prop_tgt:`ENABLE_EXPORTS` target property for executable targets when they are created by calls to the :command:`add_executable` command. See the property documentation for details. + +This command has been superseded by the +:variable:`CMAKE_EXECUTABLE_ENABLE_EXPORTS` command. It is provided for +compatibility with older CMake code. diff --git a/Help/variable/CMAKE_EXECUTABLE_ENABLE_EXPORTS.rst b/Help/variable/CMAKE_EXECUTABLE_ENABLE_EXPORTS.rst new file mode 100644 index 0000000..aa6dda2 --- /dev/null +++ b/Help/variable/CMAKE_EXECUTABLE_ENABLE_EXPORTS.rst @@ -0,0 +1,12 @@ +CMAKE_EXECUTABLE_ENABLE_EXPORTS +------------------------------- + +.. versionadded:: 3.27 + +Specify whether executables export symbols for loadable modules. + +This variable is used to initialize the :prop_tgt:`ENABLE_EXPORTS` target +property for executable targets when they are created by calls to the +:command:`add_executable` command. See the property documentation for details. + +This variable supersede the :variable:`CMAKE_ENABLE_EXPORTS` variable. diff --git a/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst b/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst index a8c4035..79a65b8 100644 --- a/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst +++ b/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst @@ -3,27 +3,38 @@ CMAKE_NINJA_OUTPUT_PATH_PREFIX .. versionadded:: 3.6 -Set output files path prefix for the :generator:`Ninja` generator. +Tell the :ref:`Ninja Generators` to add a prefix to every output path in +``build.ninja``. A trailing slash is appended to the prefix, if missing. -Every output files listed in the generated ``build.ninja`` will be -prefixed by the contents of this variable (a trailing slash is -appended if missing). This is useful when the generated ninja file is -meant to be embedded as a ``subninja`` file into a *super* ninja -project. For example, a ninja build file generated with a command -like:: +This is useful when the generated ninja file is meant to be embedded as a +``subninja`` file into a *super* ninja project. For example, the command: - cd top-build-dir/sub && - cmake -G Ninja -DCMAKE_NINJA_OUTPUT_PATH_PREFIX=sub/ path/to/source +.. code-block:: shell -can be embedded in ``top-build-dir/build.ninja`` with a directive like -this:: + cd super-build-dir && + cmake -G Ninja -S /path/to/src -B sub -DCMAKE_NINJA_OUTPUT_PATH_PREFIX=sub/ + # ^^^---------- these match -----------^^^ + +generates a build directory with its top-level (:variable:`CMAKE_BINARY_DIR`) +in ``super-build-dir/sub``. The path to the build directory ends in the +output path prefix. This makes it suitable for use in a separately-written +``super-build-dir/build.ninja`` file with a directive like this:: subninja sub/build.ninja -The ``auto-regeneration`` rule in ``top-build-dir/build.ninja`` must have an -order-only dependency on ``sub/build.ninja``. +The ``auto-regeneration`` rule in ``super-build-dir/build.ninja`` must +have an order-only dependency on ``sub/build.ninja``. + +.. versionadded:: 3.27 + + The :generator:`Ninja Multi-Config` generator supports this variable. .. note:: When ``CMAKE_NINJA_OUTPUT_PATH_PREFIX`` is set, the project generated by CMake cannot be used as a standalone project. No default targets are specified. + + The value of ``CMAKE_NINJA_OUTPUT_PATH_PREFIX`` must match one or more + path components at the *end* of :variable:`CMAKE_BINARY_DIR`, or the + behavior is undefined. However, this requirement is not checked + automatically. diff --git a/Help/variable/CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS.rst b/Help/variable/CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS.rst new file mode 100644 index 0000000..3e2c6df --- /dev/null +++ b/Help/variable/CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS.rst @@ -0,0 +1,10 @@ +CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS +----------------------------------- + +.. versionadded:: 3.27 + +Specify whether shared library generates an import file. + +This variable is used to initialize the :prop_tgt:`ENABLE_EXPORTS` target +property for shared library targets when they are created by calls to the +:command:`add_library` command. See the property documentation for details. diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index 3953b30..e300782 100644 --- a/Modules/CMakeASMCompiler.cmake.in +++ b/Modules/CMakeASMCompiler.cmake.in @@ -6,6 +6,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1) set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_VERSION "@_CMAKE_ASM_COMPILER_VERSION@") diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 2b24ff2..8ae07a3 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -27,6 +27,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_C_COMPILER_RANLIB "@CMAKE_C_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) set(CMAKE_C_COMPILER_LOADED 1) set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 534e960..834c2e6 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -28,6 +28,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_CXX_COMPILER_RANLIB "@CMAKE_CXX_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) set(CMAKE_CXX_COMPILER_LOADED 1) set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@) @@ -36,7 +37,7 @@ set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@) set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") set(CMAKE_CXX_COMPILER_ID_RUN 1) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) foreach (lang C OBJC OBJCXX) diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index cd978d5..bda1d71 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -12,7 +12,6 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) FAIL_REGEX "switch .* is no longer supported" # GNU FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "optimization flag .* not supported" # Clang - FAIL_REGEX "argument unused during compilation: .*" # Clang FAIL_REGEX "unknown argument ignored" # Clang (cl) FAIL_REGEX "ignoring unknown option" # MSVC, Intel FAIL_REGEX "warning D9002" # MSVC, any lang diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 1f89c74..0878dff 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -401,6 +401,9 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} endif() endif() set(id_toolset_version_props "<Import Project=\"${CMAKE_GENERATOR_INSTANCE}\\VC\\Auxiliary\\Build${id_sep}${CMAKE_VS_PLATFORM_TOOLSET_VERSION}\\Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props\" />") + if(lang STREQUAL CXX OR lang STREQUAL C) + set(id_toolset_version_props "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />${id_toolset_version_props}") + endif() unset(id_sep) endif() endif() diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 2ac8879..190117c 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -165,6 +165,7 @@ else() set(_CMAKE_READELF_NAMES "readelf") set(_CMAKE_DLLTOOL_NAMES "dlltool") set(_CMAKE_ADDR2LINE_NAMES "addr2line") + set(_CMAKE_TAPI_NAMES "tapi") # Prepend toolchain-specific names. if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL Clang) @@ -201,7 +202,7 @@ else() list(PREPEND _CMAKE_LINKER_NAMES "armlink") endif() - list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE) + list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE TAPI) endif() foreach(_CMAKE_TOOL IN LISTS _CMAKE_TOOL_VARS) @@ -225,6 +226,20 @@ if(NOT CMAKE_RANLIB) set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") endif() +if(NOT CMAKE_TAPI) + # try to pick-up from Apple toolchain + execute_process(COMMAND xcrun --find tapi + OUTPUT_VARIABLE _xcrun_out + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + RESULT_VARIABLE _xcrun_failed) + if(NOT _xcrun_failed AND EXISTS "${_xcrun_out}") + set_property(CACHE CMAKE_TAPI PROPERTY VALUE "${_xcrun_out}") + endif() + unset(_xcrun_out) + unset(_xcrun_failed) +endif() + if(CMAKE_PLATFORM_HAS_INSTALLNAME) find_program(CMAKE_INSTALL_NAME_TOOL NAMES ${_CMAKE_TOOLCHAIN_PREFIX}install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index f52ad02..b8b409a 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -14,6 +14,7 @@ set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_Fortran_COMPILER_AR "@CMAKE_Fortran_COMPILER_AR@") set(CMAKE_RANLIB "@CMAKE_RANLIB@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_Fortran_COMPILER_RANLIB "@CMAKE_Fortran_COMPILER_RANLIB@") set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) set(CMAKE_Fortran_COMPILER_LOADED 1) diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in index ce4e2cf..8a747c6 100644 --- a/Modules/CMakeHIPCompiler.cmake.in +++ b/Modules/CMakeHIPCompiler.cmake.in @@ -58,3 +58,4 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_HIP_COMPILER_RANLIB "@CMAKE_HIP_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index 36f6ec1..ea11a7a 100644 --- a/Modules/CMakeOBJCCompiler.cmake.in +++ b/Modules/CMakeOBJCCompiler.cmake.in @@ -25,6 +25,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_OBJC_COMPILER_RANLIB "@CMAKE_OBJC_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUOBJC @CMAKE_COMPILER_IS_GNUOBJC@) set(CMAKE_OBJC_COMPILER_LOADED 1) set(CMAKE_OBJC_COMPILER_WORKS @CMAKE_OBJC_COMPILER_WORKS@) diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in index 4f27100..5d0b381 100644 --- a/Modules/CMakeOBJCXXCompiler.cmake.in +++ b/Modules/CMakeOBJCXXCompiler.cmake.in @@ -26,6 +26,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_OBJCXX_COMPILER_RANLIB "@CMAKE_OBJCXX_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUOBJCXX @CMAKE_COMPILER_IS_GNUOBJCXX@) set(CMAKE_OBJCXX_COMPILER_LOADED 1) set(CMAKE_OBJCXX_COMPILER_WORKS @CMAKE_OBJCXX_COMPILER_WORKS@) diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 2e56a19..69913a3 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -36,7 +36,7 @@ Example: include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0126 NEW) macro(check_language lang) @@ -114,4 +114,4 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" endif() endmacro() -cmake_policy(POP) +endblock() diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index c4a1574..21d2ff5 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -62,7 +62,7 @@ For example: include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) @@ -166,4 +166,4 @@ int main(int argc, char** argv) endif() endmacro() -cmake_policy(POP) +endblock() diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 579d189..a2a5b72 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -92,7 +92,7 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) #----------------------------------------------------------------------------- @@ -294,4 +294,4 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE) endmacro() #----------------------------------------------------------------------------- -cmake_policy(POP) +endblock() diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 84b05d7..33154fd 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -29,3 +29,17 @@ if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) endif() endif() + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) + string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE + "${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}" + " -format=p1689" + " --" + " <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>" + " -x c++ <SOURCE> -c -o <OBJECT>" + " -MT <DYNDEP_FILE>" + " -MD -MF <DEP_FILE>" + " > <DYNDEP_FILE>") + set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang") + set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>") +endif () diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 18068cb..9a6cbd6 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1857,11 +1857,7 @@ function(_ep_get_build_command else() set(cmd "${CMAKE_COMMAND}") endif() - if(step STREQUAL "INSTALL") - set(args --install ".") - else() - set(args --build ".") - endif() + set(args --build ".") get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) if (CMAKE_CFG_INTDIR AND @@ -1883,6 +1879,9 @@ function(_ep_get_build_command endif() list(APPEND args --config ${config}) endif() + if(step STREQUAL "INSTALL") + list(APPEND args --target install) + endif() # But for "TEST" drive the project with corresponding "ctest". if("x${step}x" STREQUAL "xTESTx") string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") diff --git a/Modules/ExternalProject/download.cmake.in b/Modules/ExternalProject/download.cmake.in index ff8c659..bf7f209 100644 --- a/Modules/ExternalProject/download.cmake.in +++ b/Modules/ExternalProject/download.cmake.in @@ -108,7 +108,7 @@ message(STATUS "Downloading... timeout='@TIMEOUT_MSG@' inactivity timeout='@INACTIVITY_TIMEOUT_MSG@'" ) -set(download_retry_codes 7 6 8 15) +set(download_retry_codes 7 6 8 15 28) set(skip_url_list) set(status_code) foreach(i RANGE ${retry_number}) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index c928157..f65bb73 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -2,7 +2,12 @@ FindCUDA -------- -.. warning:: *Deprecated since version 3.10.* +.. versionchanged:: 3.27 + This module is available only if policy :policy:`CMP0146` is not set to ``NEW``. + Port projects to CMake's first-class ``CUDA`` language support. + +.. deprecated:: 3.10 + Do not use this module in new code. It is no longer necessary to use this module or call ``find_package(CUDA)`` for compiling CUDA code. Instead, list ``CUDA`` among the languages named @@ -555,6 +560,23 @@ The script defines the following variables: # ############################################################################### +cmake_policy(GET CMP0146 _FindCUDA_CMP0146) +if(_FindCUDA_CMP0146 STREQUAL "NEW") + message(FATAL_ERROR "The FindCUDA module has been removed by policy CMP0146.") +endif() + +if(CMAKE_GENERATOR MATCHES "Visual Studio") + cmake_policy(GET CMP0147 _FindCUDA_CMP0147) + if(_FindCUDA_CMP0147 STREQUAL "NEW") + message(FATAL_ERROR "The FindCUDA module does not work in Visual Studio with policy CMP0147.") + endif() +endif() + +if(_FindCUDA_testing) + set(_FindCUDA_included TRUE) + return() +endif() + # FindCUDA.cmake # This macro helps us find the location of helper files we will need the full path to diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index d7c6d5e..713f3b8 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -109,6 +109,7 @@ of the following libraries that are part of the CUDAToolkit: - :ref:`CUDA Runtime Library<cuda_toolkit_rt_lib>` - :ref:`CUDA Driver Library<cuda_toolkit_driver_lib>` - :ref:`cuBLAS<cuda_toolkit_cuBLAS>` +- :ref:`cuDLA<cuda_toolkit_cuDLA>` - :ref:`cuFile<cuda_toolkit_cuFile>` - :ref:`cuFFT<cuda_toolkit_cuFFT>` - :ref:`cuRAND<cuda_toolkit_cuRAND>` @@ -166,6 +167,19 @@ Targets Created: - ``CUDA::cublasLt`` starting in CUDA 10.1 - ``CUDA::cublasLt_static`` starting in CUDA 10.1 +.. _`cuda_toolkit_cuDLA`: + +cuDLA +"""""" + +.. versionadded:: 3.27 + +The NVIDIA Tegra Deep Learning Accelerator `cuDLA <https://docs.nvidia.com/cuda/cublas/index.html>`_ library. + +Targets Created: + +- ``CUDA::cudla`` starting in CUDA 11.6 + .. _`cuda_toolkit_cuFile`: cuFile @@ -1046,6 +1060,11 @@ if(CUDAToolkit_FOUND) _CUDAToolkit_find_and_add_import_lib(cuFile_rdma_static DEPS cuFile_static culibos) endif() + if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.6) + _CUDAToolkit_find_and_add_import_lib(cudla) + endif() + + # cuFFTW depends on cuFFT _CUDAToolkit_find_and_add_import_lib(cufftw DEPS cufft) _CUDAToolkit_find_and_add_import_lib(cufftw_static DEPS cufft_static) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 0f1e451..cbf0445 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -137,6 +137,12 @@ Result variables ``Matlab_FOUND`` ``TRUE`` if the Matlab installation is found, ``FALSE`` otherwise. All variable below are defined if Matlab is found. +``Matlab_VERSION`` + .. versionadded:: 3.27 + + the numerical version (e.g. 9.13) of Matlab found. Not to be confused with + Matlab release name (e.g. R2022b) that can be obtained with + :command:`matlab_get_release_name_from_version`. ``Matlab_ROOT_DIR`` the final root of the Matlab installation determined by the FindMatlab module. @@ -336,7 +342,14 @@ endif() #[=======================================================================[.rst: .. command:: matlab_get_version_from_release_name - Returns the version of Matlab (17.58) from a release name (R2017k) + .. code-block:: cmake + + matlab_get_version_from_release_name(release version) + + * Input: ``release`` is the release name (R2022b) + * Output: ``version`` is the version of Matlab (9.13) + + Returns the version of Matlab from a release name #]=======================================================================] macro(matlab_get_version_from_release_name release_name version_name) @@ -353,13 +366,17 @@ macro(matlab_get_version_from_release_name release_name version_name) endmacro() +#[=======================================================================[.rst: +.. command:: matlab_get_release_name_from_version + .. code-block:: cmake + matlab_get_release_name_from_version(version release_name) -#[=======================================================================[.rst: -.. command:: matlab_get_release_name_from_version + * Input: ``version`` is the version of Matlab (9.13) + * Output: ``release_name`` is the release name (R2022b) - Returns the release name (R2017k) from the version of Matlab (17.58) + Returns the release name from the version of Matlab #]=======================================================================] macro(matlab_get_release_name_from_version version release_name) @@ -370,7 +387,7 @@ macro(matlab_get_release_name_from_version version release_name) set(${release_name} ${CMAKE_MATCH_1}) break() endif() - endforeach(_var) + endforeach() unset(_var) unset(_matched) @@ -381,10 +398,7 @@ macro(matlab_get_release_name_from_version version release_name) endmacro() - - - -# extracts all the supported release names (R2017k...) of Matlab +# extracts all the supported release names (R2022b...) of Matlab # internal use macro(matlab_get_supported_releases list_releases) set(${list_releases}) @@ -395,7 +409,7 @@ macro(matlab_get_supported_releases list_releases) endif() unset(_matched) unset(CMAKE_MATCH_1) - endforeach(_var) + endforeach() unset(_var) endmacro() @@ -412,7 +426,7 @@ macro(matlab_get_supported_versions list_versions) endif() unset(_matched) unset(CMAKE_MATCH_1) - endforeach(_var) + endforeach() unset(_var) endmacro() @@ -420,8 +434,15 @@ endmacro() #[=======================================================================[.rst: .. command:: matlab_extract_all_installed_versions_from_registry - This function parses the registry and founds the Matlab versions that are - installed. The found versions are returned in `matlab_versions`. + .. code-block:: cmake + + matlab_extract_all_installed_versions_from_registry(win64 matlab_versions) + + * Input: ``win64`` is a boolean to search for the 64 bit version of Matlab + * Output: ``matlab_versions`` is a list of all the versions of Matlab found + + This function parses the Windows registry and founds the Matlab versions that + are installed. The found versions are returned in `matlab_versions`. Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for The returned list contains all versions under ``HKLM\\SOFTWARE\\Mathworks\\MATLAB`` and @@ -504,31 +525,6 @@ macro(extract_matlab_versions_from_registry_brute_force matlab_versions) set(matlab_supported_versions) matlab_get_supported_versions(matlab_supported_versions) - - # this is a manual population of the versions we want to look for - # this can be done as is, but preferably with the call to - # matlab_get_supported_versions and variable - - # populating the versions we want to look for - # set(matlab_supported_versions) - - # # Matlab 7 - # set(matlab_major 7) - # foreach(current_matlab_minor RANGE 4 20) - # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") - # endforeach(current_matlab_minor) - - # # Matlab 8 - # set(matlab_major 8) - # foreach(current_matlab_minor RANGE 0 5) - # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") - # endforeach(current_matlab_minor) - - # # taking into account the possible additional versions provided by the user - # if(DEFINED MATLAB_ADDITIONAL_VERSIONS) - # list(APPEND matlab_supported_versions MATLAB_ADDITIONAL_VERSIONS) - # endif() - # we order from more recent to older if(matlab_supported_versions) list(REMOVE_DUPLICATES matlab_supported_versions) @@ -540,8 +536,6 @@ macro(extract_matlab_versions_from_registry_brute_force matlab_versions) endmacro() - - #[=======================================================================[.rst: .. command:: matlab_get_all_valid_matlab_roots_from_registry @@ -551,16 +545,12 @@ endmacro() ``(type,version_number,matlab_root_path)``, where ``type`` indicates either ``MATLAB`` or ``MCR``. - :: + .. code-block:: cmake - matlab_get_all_valid_matlab_roots_from_registry( - matlab_versions - matlab_roots) + matlab_get_all_valid_matlab_roots_from_registry(matlab_versions matlab_roots) - ``matlab_versions`` - the versions of each of the Matlab or MCR installations - ``matlab_roots`` - the location of each of the Matlab or MCR installations + * Input: ``matlab_versions`` of each of the Matlab or MCR installations + * Output: ``matlab_roots`` location of each of the Matlab or MCR installations #]=======================================================================] function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots) @@ -570,7 +560,7 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ set(_matlab_roots_list ) # check for Matlab installations - foreach(_matlab_current_version ${matlab_versions}) + foreach(_matlab_current_version IN LISTS matlab_versions) get_filename_component( current_MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]" @@ -583,7 +573,7 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ endforeach() # Check for MCR installations - foreach(_matlab_current_version ${matlab_versions}) + foreach(_matlab_current_version IN LISTS matlab_versions) get_filename_component( current_MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Runtime\\${_matlab_current_version};MATLABROOT]" @@ -599,7 +589,7 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ endforeach() # Check for old MCR installations - foreach(_matlab_current_version ${matlab_versions}) + foreach(_matlab_current_version IN LISTS matlab_versions) get_filename_component( current_MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Compiler Runtime\\${_matlab_current_version};MATLABROOT]" @@ -623,16 +613,12 @@ endfunction() This function should not be called before the appropriate Matlab root has been found. - :: + .. code-block:: cmake - matlab_get_mex_suffix( - matlab_root - mex_suffix) + matlab_get_mex_suffix(matlab_root mex_suffix) - ``matlab_root`` - the root of the Matlab/MCR installation - ``mex_suffix`` - the variable name in which the suffix will be returned. + * Input: ``matlab_root`` root of Matlab/MCR install e.g. ``Matlab_ROOT_DIR`` + * Output: ``mex_suffix`` variable name in which the suffix will be returned. #]=======================================================================] function(matlab_get_mex_suffix matlab_root mex_suffix) @@ -710,8 +696,6 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) endfunction() - - #[=======================================================================[.rst: .. command:: matlab_get_version_from_matlab_run @@ -719,16 +703,12 @@ endfunction() version. If the path provided for the Matlab installation points to an MCR installation, the version is extracted from the installed files. - :: + .. code-block:: cmake - matlab_get_version_from_matlab_run( - matlab_binary_path - matlab_list_versions) + matlab_get_version_from_matlab_run(matlab_binary_path matlab_list_versions) - ``matlab_binary_path`` - the location of the `matlab` binary executable - ``matlab_list_versions`` - the version extracted from Matlab + * Input: ``matlab_binary_path`` path of the `matlab` binary executable + * Output: ``matlab_list_versions`` the version extracted from Matlab #]=======================================================================] function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_versions) @@ -898,7 +878,7 @@ endfunction() non 0 failure). Additional arguments accepted by :command:`add_test` can be passed through ``TEST_ARGS`` (eg. ``CONFIGURATION <config> ...``). - :: + .. code-block:: cmake matlab_add_unit_test( NAME <name> @@ -912,7 +892,7 @@ endfunction() [NO_UNITTEST_FRAMEWORK] ) - The function arguments are: + Function Parameters: ``NAME`` name of the unittest in ctest. @@ -1010,7 +990,7 @@ endfunction() for the MEX file. Remaining arguments of the call are passed to the :command:`add_library` or :command:`add_executable` command. - :: + .. code-block:: cmake matlab_add_mex( NAME <name> @@ -1025,6 +1005,8 @@ endfunction() [...] ) + Function Parameters: + ``NAME`` name of the target. ``SRC`` @@ -1209,18 +1191,17 @@ function(matlab_add_mex) if (MSVC) - set(_link_flags "${_link_flags} /EXPORT:mexFunction") + string(APPEND _link_flags " /EXPORT:mexFunction") if(NOT Matlab_VERSION_STRING VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, export version - set(_link_flags "${_link_flags} /EXPORT:mexfilerequiredapiversion") + string(APPEND _link_flags " /EXPORT:mexfilerequiredapiversion") endif() set_property(TARGET ${${prefix}_NAME} APPEND PROPERTY LINK_FLAGS ${_link_flags}) endif() # No other compiler currently supported on Windows. - set_target_properties(${${prefix}_NAME} - PROPERTIES - DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)") + set_property(TARGET ${${prefix}_NAME} PROPERTY + DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)") else() @@ -1246,7 +1227,7 @@ function(matlab_add_mex) if(Matlab_HAS_CPP_API) list(APPEND _ver_map_files ${Matlab_EXTERN_LIBRARY_DIR}/cppMexFunction.map) # This one doesn't exist on Linux - set(_link_flags "${_link_flags} -Wl,-U,_mexCreateMexFunction -Wl,-U,_mexDestroyMexFunction -Wl,-U,_mexFunctionAdapter") + string(APPEND _link_flags " -Wl,-U,_mexCreateMexFunction -Wl,-U,_mexDestroyMexFunction -Wl,-U,_mexFunctionAdapter") # On MacOS, the MEX command adds the above, without it the link breaks # because we indiscriminately use "cppMexFunction.map" even for C API MEX-files. endif() @@ -1261,14 +1242,14 @@ function(matlab_add_mex) target_compile_options(${${prefix}_NAME} PRIVATE "-pthread") endif() - set(_link_flags "${_link_flags} -Wl,--as-needed") + string(APPEND _link_flags " -Wl,--as-needed") set(_export_flag_name --version-script) endif() - foreach(_file ${_ver_map_files}) - set(_link_flags "${_link_flags} -Wl,${_export_flag_name},${_file}") + foreach(_file IN LISTS _ver_map_files) + string(APPEND _link_flags " -Wl,${_export_flag_name},${_file}") endforeach() # The `mex` command doesn't add this define. It is specified here in order @@ -2020,11 +2001,13 @@ _Matlab_add_imported_target(MAT mat) _Matlab_add_imported_target(ENGINE MatlabEngine) _Matlab_add_imported_target(DATAARRAY MatlabDataArray) +set(Matlab_VERSION ${Matlab_VERSION_STRING}) + find_package_handle_standard_args( Matlab FOUND_VAR Matlab_FOUND REQUIRED_VARS ${_matlab_required_variables} - VERSION_VAR Matlab_VERSION_STRING + VERSION_VAR Matlab_VERSION HANDLE_COMPONENTS) unset(_matlab_required_variables) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index a9a1b2a..a773601 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -18,8 +18,26 @@ Optional COMPONENTS .. versionadded:: 3.10 -This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and -``OpenGL``. There are corresponding import targets for each of these flags. +This module respects several optional COMPONENTS: + +``EGL`` + The EGL interface between OpenGL, OpenGL ES and the underlying windowing system. + +``GLX`` + An extension to X that interfaces OpenGL, OpenGL ES with X window system. + +``OpenGL`` + The cross platform API for 3D graphics. + +``GLES2`` + .. versionadded:: 3.27 + + A subset of OpenGL API for embedded systems with limited capabilities. + +``GLES3`` + .. versionadded:: 3.27 + + A subset of OpenGL API for embedded systems with more capabilities. IMPORTED Targets ^^^^^^^^^^^^^^^^ @@ -42,6 +60,14 @@ This module defines the :prop_tgt:`IMPORTED` targets: Defined if the system has OpenGL Extension to the X Window System (GLX). ``OpenGL::EGL`` Defined if the system has EGL. +``OpenGL::GLES2`` + .. versionadded:: 3.27 + + Defined if the system has GLES2. +``OpenGL::GLES3`` + .. versionadded:: 3.27 + + Defined if the system has GLES3. Result Variables ^^^^^^^^^^^^^^^^ @@ -60,6 +86,10 @@ This module sets the following variables: True, if the system has GLX. ``OpenGL_EGL_FOUND`` True, if the system has EGL. +``OpenGL::GLES2`` + Defined if the system has GLES2. +``OpenGL::GLES3`` + Defined if the system has GLES3. ``OPENGL_INCLUDE_DIR`` Path to the OpenGL include directory. ``OPENGL_EGL_INCLUDE_DIRS`` @@ -88,6 +118,14 @@ The following cache variables may also be set: ``OPENGL_gl_LIBRARY`` Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import targets. +``OPENGL_gles2_LIBRARY`` + .. versionadded:: 3.27 + + Path to the OpenGL GLES2 library. +``OPENGL_gles3_LIBRARY`` + .. versionadded:: 3.27 + + Path to the OpenGL GLES3 library. .. versionadded:: 3.10 Variables for GLVND-specific libraries ``OpenGL``, ``EGL`` and ``GLX``. @@ -182,7 +220,10 @@ elseif (APPLE) OPENGL_glu_LIBRARY ) else() - if (CMAKE_SYSTEM_NAME MATCHES "HP-UX") + if (CMAKE_ANDROID_NDK) + set(_OPENGL_INCLUDE_PATH ${CMAKE_ANDROID_NDK}/sysroot/usr/include) + set(_OPENGL_LIB_PATH ${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}/arch-${CMAKE_ANDROID_ARCH}/usr/lib) + elseif (CMAKE_SYSTEM_NAME MATCHES "HP-UX") # Handle HP-UX cases where we only want to find OpenGL in either hpux64 # or hpux32 depending on if we're doing a 64 bit build. if(CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -198,6 +239,13 @@ else() /boot/develop/lib/x86) set(_OPENGL_INCLUDE_PATH /boot/develop/headers/os/opengl) + elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # CMake doesn't support arbitrary globs in search paths. + file(GLOB _OPENGL_LIB_PATH + # The NVidia driver installation tool on Linux installs libraries to a + # `nvidia-<version>` subdirectory. + "/usr/lib/nvidia-*" + "/usr/lib32/nvidia-*") endif() # The first line below is to make sure that the proper headers @@ -215,15 +263,20 @@ else() ) find_path(OPENGL_GLX_INCLUDE_DIR GL/glx.h ${_OPENGL_INCLUDE_PATH}) find_path(OPENGL_EGL_INCLUDE_DIR EGL/egl.h ${_OPENGL_INCLUDE_PATH}) + find_path(OPENGL_GLES2_INCLUDE_DIR GLES2/gl2.h ${_OPENGL_INCLUDE_PATH}) + find_path(OPENGL_GLES3_INCLUDE_DIR GLES3/gl3.h ${_OPENGL_INCLUDE_PATH}) find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h /usr/share/doc/NVIDIA_GLX-1.0/include /usr/openwin/share/include /opt/graphics/OpenGL/include ) + list(APPEND _OpenGL_CACHE_VARS OPENGL_INCLUDE_DIR OPENGL_GLX_INCLUDE_DIR OPENGL_EGL_INCLUDE_DIR + OPENGL_GLES2_INCLUDE_DIR + OPENGL_GLES3_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR ) @@ -246,6 +299,17 @@ else() PATH_SUFFIXES libglvnd ) + find_library(OPENGL_gles2_LIBRARY + NAMES GLESv2 + PATHS ${_OPENGL_LIB_PATH} + ) + + find_library(OPENGL_gles3_LIBRARY + NAMES GLESv3 + GLESv2 # mesa provides only libGLESv2 + PATHS ${_OPENGL_LIB_PATH} + ) + find_library(OPENGL_glu_LIBRARY NAMES GLU MesaGLU PATHS ${OPENGL_gl_LIBRARY} @@ -258,6 +322,8 @@ else() OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY OPENGL_egl_LIBRARY + OPENGL_gles2_LIBRARY + OPENGL_gles3_LIBRARY OPENGL_glu_LIBRARY ) @@ -338,12 +404,16 @@ else() OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR (NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND NOT OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR (NOT OPENGL_USE_EGL AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) OR - ( OPENGL_USE_EGL)) + (NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND + OPENGL_USE_EGL)) list(APPEND _OpenGL_REQUIRED_VARS OPENGL_opengl_LIBRARY) endif() @@ -351,13 +421,19 @@ else() if((NOT OPENGL_USE_OPENGL AND NOT OPENGL_USE_GLX AND NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND NOT OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR ( OPENGL_USE_GLX AND NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND NOT OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR (NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) OR (OPENGL_USE_GLX AND OPENGL_USE_EGL)) @@ -369,6 +445,16 @@ else() list(APPEND _OpenGL_REQUIRED_VARS OPENGL_egl_LIBRARY) endif() + # GLVND GLES2 library. + if(OPENGL_USE_GLES2) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_gles2_LIBRARY) + endif() + + # GLVND GLES3 library. + if(OPENGL_USE_GLES3) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_gles3_LIBRARY) + endif() + # Old-style "libGL" library: used as a fallback when GLVND isn't available. if((NOT OPENGL_USE_EGL AND NOT OPENGL_opengl_LIBRARY AND @@ -381,7 +467,11 @@ else() endif() # We always need the 'gl.h' include dir. - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) + if(OPENGL_USE_EGL) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_EGL_INCLUDE_DIR) + else() + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) + endif() unset(_OPENGL_INCLUDE_PATH) unset(_OPENGL_LIB_PATH) @@ -428,6 +518,18 @@ else() set(OpenGL_EGL_FOUND FALSE) endif() +if(OPENGL_gles2_LIBRARY AND OPENGL_GLES2_INCLUDE_DIR) + set(OpenGL_GLES2_FOUND TRUE) +else() + set(OpenGL_GLES2_FOUND FALSE) +endif() + +if(OPENGL_gles3_LIBRARY AND OPENGL_GLES3_INCLUDE_DIR) + set(OpenGL_GLES3_FOUND TRUE) +else() + set(OpenGL_GLES3_FOUND FALSE) +endif() + # User-visible names should be plural. if(OPENGL_EGL_INCLUDE_DIR) set(OPENGL_EGL_INCLUDE_DIRS ${OPENGL_EGL_INCLUDE_DIR}) @@ -461,6 +563,7 @@ if(OPENGL_FOUND) endif() set_target_properties(OpenGL::OpenGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}") + set(_OpenGL_EGL_IMPL OpenGL::OpenGL) endif() # ::GLX is a GLVND library, and thus Linux-only: we don't bother checking @@ -481,6 +584,73 @@ if(OPENGL_FOUND) "${OPENGL_GLX_INCLUDE_DIR}") endif() + # ::GLES2 is a GLVND library, and thus Linux-only: we don't bother checking + # for a framework version of this library. + if(OpenGL_GLES2_FOUND AND NOT TARGET OpenGL::GLES2) + + # Initialize target + if(NOT OPENGL_gles2_LIBRARY) + add_library(OpenGL::GLES2 INTERFACE IMPORTED) + else() + if(IS_ABSOLUTE "${OPENGL_gles2_LIBRARY}") + add_library(OpenGL::GLES2 UNKNOWN IMPORTED) + set_target_properties(OpenGL::GLES2 PROPERTIES + IMPORTED_LOCATION "${OPENGL_gles2_LIBRARY}" + ) + else() + add_library(OpenGL::GLES2 INTERFACE IMPORTED) + set_target_properties(OpenGL::GLES2 PROPERTIES + IMPORTED_LIBNAME "${OPENGL_gles2_LIBRARY}" + ) + endif() + endif() + + # Attach target properties + set_target_properties(OpenGL::GLES2 + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${OPENGL_GLES2_INCLUDE_DIR}" + ) + + if (OPENGL_USE_GLES2) + set(_OpenGL_EGL_IMPL OpenGL::GLES2) + endif () + + endif() + + # ::GLES3 is a GLVND library, and thus Linux-only: we don't bother checking + # for a framework version of this library. + if(OpenGL_GLES3_FOUND AND NOT TARGET OpenGL::GLES3) + + # Initialize target + if(NOT OPENGL_gles3_LIBRARY) + add_library(OpenGL::GLES3 INTERFACE IMPORTED) + else() + if(IS_ABSOLUTE "${OPENGL_gles3_LIBRARY}") + add_library(OpenGL::GLES3 UNKNOWN IMPORTED) + set_target_properties(OpenGL::GLES3 PROPERTIES + IMPORTED_LOCATION "${OPENGL_gles3_LIBRARY}" + ) + else() + add_library(OpenGL::GLES3 INTERFACE IMPORTED) + set_target_properties(OpenGL::GLES3 PROPERTIES + IMPORTED_LIBNAME "${OPENGL_gles3_LIBRARY}" + ) + endif() + endif() + + # Attach target properties + set_target_properties(OpenGL::GLES3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${OPENGL_GLES3_INCLUDE_DIR}" + ) + + if (OPENGL_USE_GLES3) + set(_OpenGL_EGL_IMPL OpenGL::GLES3) + endif () + + endif() + if(OPENGL_gl_LIBRARY AND NOT TARGET OpenGL::GL) # A legacy GL library is available, so use it for the legacy GL target. if(IS_ABSOLUTE "${OPENGL_gl_LIBRARY}") @@ -517,10 +687,9 @@ if(OPENGL_FOUND) # ::EGL is a GLVND library, and thus Linux-only: we don't bother checking # for a framework version of this library. - # Note we test for OpenGL::OpenGL as a target. When this module is updated to - # support GLES, we would additionally want to check for the hypothetical GLES - # target and enable EGL if either ::GLES or ::OpenGL is created. - if(TARGET OpenGL::OpenGL AND OpenGL_EGL_FOUND AND NOT TARGET OpenGL::EGL) + # Note we test whether _OpenGL_EGL_IMPL is set. Based on the OpenGL implementation, + # _OpenGL_EGL_IMPL will be one of OpenGL::OpenGL, OpenGL::GLES2, OpenGL::GLES3 + if(_OpenGL_EGL_IMPL AND OpenGL_EGL_FOUND AND NOT TARGET OpenGL::EGL) if(IS_ABSOLUTE "${OPENGL_egl_LIBRARY}") add_library(OpenGL::EGL UNKNOWN IMPORTED) set_target_properties(OpenGL::EGL PROPERTIES IMPORTED_LOCATION @@ -531,7 +700,7 @@ if(OPENGL_FOUND) "${OPENGL_egl_LIBRARY}") endif() set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_LINK_LIBRARIES - OpenGL::OpenGL) + "${_OpenGL_EGL_IMPL}") # Note that EGL's include directory is different from OpenGL/GLX's! set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_EGL_INCLUDE_DIR}") diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 3159ff7..cc76b35 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -113,6 +113,16 @@ If wxWidgets is required (i.e., not an optional part): include(${wxWidgets_USE_FILE}) # and for each of your dependent executable/library targets: target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES}) + +Imported targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.27 + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``wxWidgets::wxWidgets`` + An interface library providing usage requirements for the found components. #]=======================================================================] # @@ -981,6 +991,17 @@ find_package_handle_standard_args(wxWidgets ) unset(wxWidgets_HANDLE_COMPONENTS) +if(wxWidgets_FOUND AND NOT TARGET wxWidgets::wxWidgets) + add_library(wxWidgets::wxWidgets INTERFACE IMPORTED) + target_link_libraries(wxWidgets::wxWidgets INTERFACE ${wxWidgets_LIBRARIES}) + target_link_directories(wxWidgets::wxWidgets INTERFACE ${wxWidgets_LIBRARY_DIRS}) + target_include_directories(wxWidgets::wxWidgets INTERFACE ${wxWidgets_INCLUDE_DIRS}) + target_compile_options(wxWidgets::wxWidgets INTERFACE ${wxWidgets_CXX_FLAGS}) + target_compile_definitions(wxWidgets::wxWidgets INTERFACE ${wxWidgets_DEFINITIONS}) + # FIXME: Add "$<$<CONFIG:Debug>:${wxWidgets_DEFINITIONS_DEBUG}>" + # if the debug library variant is available. +endif() + #===================================================================== # Macros for use in wxWidgets apps. # - This module will not fail to find wxWidgets based on the code diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 2bd0cc9..de0f7d6 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -134,7 +134,7 @@ function(gtest_discover_tests_impl) # Module; remove trailing '.' to get just the name... string(REGEX REPLACE "\\.( *#.*)?$" "" suite "${line}") if(line MATCHES "#") - string(REGEX REPLACE "/.*" "" pretty_suite "${line}") + string(REGEX REPLACE "/[0-9].*" "" pretty_suite "${line}") if(NOT _NO_PRETTY_TYPES) string(REGEX REPLACE ".*/[0-9]+[ .#]+TypeParam = (.*)" "\\1" type_parameter "${line}") else() diff --git a/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake index ff8908b..b671b4a 100644 --- a/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake +++ b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake @@ -69,6 +69,7 @@ function(CMAKE_TRY_COMPILER_OR_LINKER_FLAG lang flag result) set (CCCF_COMMAND_PATTERN "<FLAG> -o <OUTPUT> <SOURCE>") endif() + list (APPEND CCCF_FAIL_REGEX "argument unused during compilation") # clang if (check_lang STREQUAL "C") list(APPEND CCCF_FAIL_REGEX "command line option .* is valid for .* but not for C") # GNU diff --git a/Modules/Internal/CheckFlagCommonConfig.cmake b/Modules/Internal/CheckFlagCommonConfig.cmake index 61eada2..8c5703d 100644 --- a/Modules/Internal/CheckFlagCommonConfig.cmake +++ b/Modules/Internal/CheckFlagCommonConfig.cmake @@ -7,7 +7,8 @@ # It's content may change in any way between releases. include_guard(GLOBAL) -cmake_policy(PUSH) + +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST @@ -22,26 +23,30 @@ macro(CMAKE_CHECK_FLAG_COMMON_INIT _FUNC _LANG _SRC _PATTERNS) FAIL_REGEX "-Werror=.* argument .* is not valid for C\\+\\+") elseif("${_LANG}" STREQUAL "CUDA") set(${_SRC} "__host__ int main() { return 0; }") - set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+") # Host GNU + set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+" # Host GNU + FAIL_REGEX "argument unused during compilation: .*") # Clang elseif("${_LANG}" STREQUAL "Fortran") set(${_SRC} " program test\n stop\n end program") set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Fortran") elseif("${_LANG}" STREQUAL "HIP") set(${_SRC} "__host__ int main() { return 0; }") + set(${_PATTERNS} FAIL_REGEX "argument unused during compilation: .*") # Clang elseif("${_LANG}" STREQUAL "OBJC") set(${_SRC} [=[ #ifndef __OBJC__ # error "Not an Objective-C compiler" #endif int main(void) { return 0; }]=]) - set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C") # GNU + set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C" # GNU + FAIL_REGEX "argument unused during compilation: .*") # Clang elseif("${_LANG}" STREQUAL "OBJCXX") set(${_SRC} [=[ #ifndef __OBJC__ # error "Not an Objective-C++ compiler" #endif int main(void) { return 0; }]=]) - set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C\\+\\+") # GNU + set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C\\+\\+" # GNU + FAIL_REGEX "argument unused during compilation: .*") # Clang elseif("${_LANG}" STREQUAL "ISPC") set(${_SRC} "float func(uniform int32, float a) { return a / 2.25; }") elseif("${_LANG}" STREQUAL "Swift") @@ -70,4 +75,4 @@ macro(CMAKE_CHECK_FLAG_COMMON_FINISH) endforeach() endmacro() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/CheckLinkerFlag.cmake b/Modules/Internal/CheckLinkerFlag.cmake index 7613105..b872b51 100644 --- a/Modules/Internal/CheckLinkerFlag.cmake +++ b/Modules/Internal/CheckLinkerFlag.cmake @@ -6,7 +6,7 @@ include(Internal/CheckFlagCommonConfig) include(Internal/CheckSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var) @@ -49,4 +49,4 @@ function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var) cmake_check_flag_common_finish() endfunction() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake index 83d7020..14a9a61 100644 --- a/Modules/Internal/CheckSourceCompiles.cmake +++ b/Modules/Internal/CheckSourceCompiles.cmake @@ -3,7 +3,7 @@ include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST @@ -131,4 +131,4 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var) endif() endfunction() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake index 805d98d..c01081e 100644 --- a/Modules/Internal/CheckSourceRuns.cmake +++ b/Modules/Internal/CheckSourceRuns.cmake @@ -3,7 +3,7 @@ include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST @@ -124,4 +124,4 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var) endif() endfunction() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/HeaderpadWorkaround.cmake b/Modules/Internal/HeaderpadWorkaround.cmake index 9a7f9f5..fccfaae 100644 --- a/Modules/Internal/HeaderpadWorkaround.cmake +++ b/Modules/Internal/HeaderpadWorkaround.cmake @@ -9,7 +9,7 @@ if(NOT APPLE) return() endif() -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced function(__cmake_internal_workaround_headerpad_flag_conflict _LANG) @@ -66,4 +66,4 @@ endforeach() unset(__lang) unset(__enabled_languages) -cmake_policy(POP) +endblock() diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake index d651cdd..8973231 100644 --- a/Modules/MatlabTestsRedirect.cmake +++ b/Modules/MatlabTestsRedirect.cmake @@ -19,8 +19,8 @@ # -P FindMatlab_TestsRedirect.cmake set(Matlab_UNIT_TESTS_CMD -nosplash -nodesktop -nodisplay ${Matlab_ADDITIONAL_STARTUP_OPTIONS}) -if(WIN32) - set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait) +if(WIN32 AND maut_BATCH_OPTION STREQUAL "-r") + list(APPEND Matlab_UNIT_TESTS_CMD -wait) endif() if(NOT test_timeout) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index ac2478b..a6c86f1 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -45,6 +45,8 @@ set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so") set(CMAKE_SHARED_MODULE_PREFIX "lib") set(CMAKE_SHARED_MODULE_SUFFIX ".so") +set(CMAKE_APPLE_IMPORT_FILE_PREFIX "lib") +set(CMAKE_APPLE_IMPORT_FILE_SUFFIX ".tbd") set(CMAKE_MODULE_EXISTS 1) set(CMAKE_DL_LIBS "") if(NOT "${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5") @@ -108,6 +110,9 @@ foreach(lang C CXX Fortran OBJC OBJCXX) set(CMAKE_${lang}_FRAMEWORK_SEARCH_FLAG -F) endforeach() +# To generate text-based stubs +set(CMAKE_CREATE_TEXT_STUBS "<CMAKE_TAPI> stubify -isysroot <CMAKE_OSX_SYSROOT> -o <TARGET_IMPLIB> <TARGET>") + # Defines LINK_LIBRARY features for frameworks set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>") set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index e99da49..163dab3 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -16,6 +16,8 @@ if(NOT CMake_DEFAULT_RECURSION_LIMIT) set(CMake_DEFAULT_RECURSION_LIMIT 100) elseif(MINGW OR MSYS) set(CMake_DEFAULT_RECURSION_LIMIT 400) + elseif(WIN32 AND CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") + set(CMake_DEFAULT_RECURSION_LIMIT 400) elseif(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM") set(CMake_DEFAULT_RECURSION_LIMIT 600) else() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 616c7e8..73bda5f 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 26) -set(CMake_VERSION_PATCH 20230301) +set(CMake_VERSION_PATCH 20230314) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 73e7ef2..f5b7587 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -38,6 +38,8 @@ function(cm_check_cxx_feature name) string(REGEX REPLACE " +0 Warning\\(s\\)" "" check_output "${check_output}") # Filter out MSBuild output that looks like a warning. string(REGEX REPLACE "[^\n]*warning MSB[0-9][0-9][0-9][0-9][^\n]*" "" check_output "${check_output}") + # Filter out MSVC output that looks like a command-line warning. + string(REGEX REPLACE "[^\n]*warning D[0-9][0-9][0-9][0-9][^\n]*" "" check_output "${check_output}") # Filter out warnings caused by user flags. string(REGEX REPLACE "[^\n]*warning:[^\n]*-Winvalid-command-line-argument[^\n]*" "" check_output "${check_output}") # Filter out warnings caused by local configuration. diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 1705763..5601bf2 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -25,7 +25,6 @@ #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" -#include "cmTarget.h" #include "cmValue.h" cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) @@ -248,7 +247,7 @@ std::string cmCommonTargetGenerator::GetManifests(const std::string& config) std::string cmCommonTargetGenerator::GetAIXExports(std::string const&) { std::string aixExports; - if (this->GeneratorTarget->Target->IsAIX()) { + if (this->GeneratorTarget->IsAIX()) { if (cmValue exportAll = this->GeneratorTarget->GetProperty("AIX_EXPORT_ALL_SYMBOLS")) { if (cmIsOff(*exportAll)) { diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index ff688a4..a93477b 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1157,7 +1157,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) // Pass the full path to the target file. BT<std::string> lib = BT<std::string>( tgt->GetFullPath(config, artifact, true), item.Backtrace); - if (tgt->Target->IsAIX() && cmHasLiteralSuffix(lib.Value, "-NOTFOUND") && + if (tgt->IsAIX() && cmHasLiteralSuffix(lib.Value, "-NOTFOUND") && artifact == cmStateEnums::ImportLibraryArtifact) { // This is an imported executable on AIX that has ENABLE_EXPORTS // but not IMPORTED_IMPLIB. CMake used to produce and accept such @@ -1185,7 +1185,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) if (cmHasSuffix(entry.Feature, "FRAMEWORK"_s) || (entry.Feature == DEFAULT && cmSystemTools::IsPathToFramework(item.Value) && - this->Makefile->IsOn("APPLE"))) { + this->Target->IsApple())) { // This is a framework. this->AddFrameworkItem(entry); } else if (cmSystemTools::FileIsFullPath(item.Value)) { @@ -1563,7 +1563,7 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry) this->OldLinkDirItems.push_back(item.Value); } - if (target->IsFrameworkOnApple() && !this->GlobalGenerator->IsXcode()) { + if (target->IsFrameworkOnApple()) { // Add the framework directory and the framework item itself auto fwDescriptor = this->GlobalGenerator->SplitFrameworkPath( item.Value, cmGlobalGenerator::FrameworkFormat::Extended); @@ -1579,26 +1579,32 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry) // Add the directory portion to the framework search path. this->AddFrameworkPath(fwDescriptor->Directory); } - if (cmHasSuffix(entry.Feature, "FRAMEWORK"_s)) { - this->Items.emplace_back(fwDescriptor->GetLinkName(), ItemIsPath::Yes, - target, - this->FindLibraryFeature(entry.Feature)); - } else { + + if (this->GlobalGenerator->IsXcode()) { this->Items.emplace_back( item, ItemIsPath::Yes, target, - this->FindLibraryFeature( - entry.Feature == DEFAULT ? "__CMAKE_LINK_LIBRARY" : entry.Feature)); + this->FindLibraryFeature(entry.Feature == DEFAULT + ? "__CMAKE_LINK_FRAMEWORK" + : entry.Feature)); + } else { + if (cmHasSuffix(entry.Feature, "FRAMEWORK"_s)) { + this->Items.emplace_back(fwDescriptor->GetLinkName(), ItemIsPath::Yes, + target, + this->FindLibraryFeature(entry.Feature)); + } else { + this->Items.emplace_back( + item, ItemIsPath::Yes, target, + this->FindLibraryFeature(entry.Feature == DEFAULT + ? "__CMAKE_LINK_LIBRARY" + : entry.Feature)); + } } } else { // Now add the full path to the library. this->Items.emplace_back( item, ItemIsPath::Yes, target, this->FindLibraryFeature( - entry.Feature == DEFAULT - ? (target->IsFrameworkOnApple() && this->GlobalGenerator->IsXcode() - ? "__CMAKE_LINK_FRAMEWORK" - : "__CMAKE_LINK_LIBRARY") - : entry.Feature)); + entry.Feature == DEFAULT ? "__CMAKE_LINK_LIBRARY" : entry.Feature)); } } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index acf1c20..3149ccf 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -72,6 +72,10 @@ SETUP_LANGUAGE(swift_properties, Swift); std::string const kCMAKE_CUDA_ARCHITECTURES = "CMAKE_CUDA_ARCHITECTURES"; std::string const kCMAKE_CUDA_RUNTIME_LIBRARY = "CMAKE_CUDA_RUNTIME_LIBRARY"; std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS"; +std::string const kCMAKE_EXECUTABLE_ENABLE_EXPORTS = + "CMAKE_EXECUTABLE_ENABLE_EXPORTS"; +std::string const kCMAKE_SHARED_LIBRARY_ENABLE_EXPORTS = + "CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS"; std::string const kCMAKE_HIP_ARCHITECTURES = "CMAKE_HIP_ARCHITECTURES"; std::string const kCMAKE_HIP_RUNTIME_LIBRARY = "CMAKE_HIP_RUNTIME_LIBRARY"; std::string const kCMAKE_ISPC_INSTRUCTION_SETS = "CMAKE_ISPC_INSTRUCTION_SETS"; @@ -997,6 +1001,8 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode( vars.insert(kCMAKE_CUDA_ARCHITECTURES); vars.insert(kCMAKE_CUDA_RUNTIME_LIBRARY); vars.insert(kCMAKE_ENABLE_EXPORTS); + vars.insert(kCMAKE_EXECUTABLE_ENABLE_EXPORTS); + vars.insert(kCMAKE_SHARED_LIBRARY_ENABLE_EXPORTS); vars.insert(kCMAKE_HIP_ARCHITECTURES); vars.insert(kCMAKE_HIP_RUNTIME_LIBRARY); vars.insert(kCMAKE_ISPC_INSTRUCTION_SETS); diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index ed199ea..caf8ac2 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -254,7 +254,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty( if (target->HasImportLibrary(config)) { std::string prop = cmStrCat("IMPORTED_IMPLIB", suffix); std::string value = - target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact); + target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact, true); if (mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { target->GetImplibGNUtoMS(config, value, value, "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 7f1afba..6e7ef4e 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1063,7 +1063,8 @@ void cmExportFileGenerator::GenerateImportTargetCode( } // Mark the imported executable if it has exports. - if (target->IsExecutableWithExports()) { + if (target->IsExecutableWithExports() || + (target->IsSharedLibraryWithExports() && target->HasImportLibrary(""))) { os << "set_property(TARGET " << targetName << " PROPERTY ENABLE_EXPORTS 1)\n"; } diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 5e190f4..def8227 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -409,7 +409,7 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( // Append the installed file name. value += cmInstallTargetGenerator::GetInstallFilename( - target, config, cmInstallTargetGenerator::NameImplib); + target, config, cmInstallTargetGenerator::NameImplibReal); // Store the property. properties[prop] = value; @@ -430,6 +430,19 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( properties[prop] = cmJoin(objects, ";"); importedLocations.insert(prop); } else { + if (target->IsFrameworkOnApple() && target->HasImportLibrary(config)) { + // store as well IMPLIB value + auto importProp = cmStrCat("IMPORTED_IMPLIB", suffix); + auto importValue = + cmStrCat(value, + cmInstallTargetGenerator::GetInstallFilename( + target, config, cmInstallTargetGenerator::NameImplibReal)); + + // Store the property. + properties[importProp] = importValue; + importedLocations.insert(importProp); + } + // Construct the property name. std::string prop = cmStrCat("IMPORTED_LOCATION", suffix); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 8acfe83..4024dff 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -502,6 +502,7 @@ cmFindPackageCommand::cmFindPackageCommand(cmExecutionStatus& status) this->DebugMode = false; this->AppendSearchPathGroups(); + this->DeprecatedFindModules["CUDA"] = cmPolicies::CMP0146; this->DeprecatedFindModules["Dart"] = cmPolicies::CMP0145; this->DeprecatedFindModules["Qt"] = cmPolicies::CMP0084; } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 5c7d217..6e78f55 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2402,15 +2402,12 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode } } targetObjectsNode; -static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode +struct TargetRuntimeDllsBaseNode : public cmGeneratorExpressionNode { - TargetRuntimeDllsNode() {} // NOLINT(modernize-use-equals-default) - - std::string Evaluate( + std::vector<std::string> CollectDlls( const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + const GeneratorExpressionContent* content) const { std::string const& tgtName = parameters.front(); cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName); @@ -2419,7 +2416,7 @@ static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode e << "Objects of target \"" << tgtName << "\" referenced but no such target exists."; reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); + return std::vector<std::string>(); } cmStateEnums::TargetType type = gt->GetType(); if (type != cmStateEnums::EXECUTABLE && @@ -2430,7 +2427,7 @@ static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode << "\" referenced but is not one of the allowed target types " << "(EXECUTABLE, SHARED, MODULE)."; reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); + return std::vector<std::string>(); } if (auto* cli = gt->GetLinkInformation(context->Config)) { @@ -2443,13 +2440,51 @@ static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode } } - return cmJoin(dllPaths, ";"); + return dllPaths; } - return ""; + return std::vector<std::string>(); + } +}; + +static const struct TargetRuntimeDllsNode : public TargetRuntimeDllsBaseNode +{ + TargetRuntimeDllsNode() {} // NOLINT(modernize-use-equals-default) + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + std::vector<std::string> dlls = CollectDlls(parameters, context, content); + return cmJoin(dlls, ";"); } } targetRuntimeDllsNode; +static const struct TargetRuntimeDllDirsNode : public TargetRuntimeDllsBaseNode +{ + TargetRuntimeDllDirsNode() {} // NOLINT(modernize-use-equals-default) + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + std::vector<std::string> dlls = CollectDlls(parameters, context, content); + std::vector<std::string> dllDirs; + for (const std::string& dll : dlls) { + std::string directory = cmSystemTools::GetFilenamePath(dll); + if (std::find(dllDirs.begin(), dllDirs.end(), directory) == + dllDirs.end()) { + dllDirs.push_back(directory); + } + } + return cmJoin(dllDirs, ";"); + } +} targetRuntimeDllDirsNode; + static const struct CompileFeaturesNode : public cmGeneratorExpressionNode { CompileFeaturesNode() {} // NOLINT(modernize-use-equals-default) @@ -2658,10 +2693,14 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactDirTag; class ArtifactLinkerTag; +class ArtifactLinkerLibraryTag; +class ArtifactLinkerImportTag; class ArtifactNameTag; +class ArtifactImportTag; class ArtifactPathTag; class ArtifactPdbTag; class ArtifactSonameTag; +class ArtifactSonameImportTag; class ArtifactBundleDirTag; class ArtifactBundleDirNameTag; class ArtifactBundleContentDirTag; @@ -2771,6 +2810,38 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag> }; template <> +struct TargetFilesystemArtifactResultCreator<ArtifactSonameImportTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + // The target soname file (.so.1). + if (target->IsDLLPlatform()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_IMPORT_FILE is not allowed " + "for DLL target platforms."); + return std::string(); + } + if (target->GetType() != cmStateEnums::SHARED_LIBRARY) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_IMPORT_FILE is allowed only for " + "SHARED libraries."); + return std::string(); + } + + if (target->HasImportLibrary(context->Config)) { + return cmStrCat(target->GetDirectory( + context->Config, cmStateEnums::ImportLibraryArtifact), + '/', + target->GetSOName(context->Config, + cmStateEnums::ImportLibraryArtifact)); + } + return std::string{}; + } +}; + +template <> struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag> { static std::string Create(cmGeneratorTarget* target, @@ -2817,7 +2888,8 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag> cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content) { - // The file used to link to the target (.so, .lib, .a). + // The file used to link to the target (.so, .lib, .a) or import file + // (.lib, .tbd). if (!target->IsLinkable()) { ::reportError(context, content->GetOriginalExpression(), "TARGET_LINKER_FILE is allowed only for libraries and " @@ -2833,6 +2905,55 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag> }; template <> +struct TargetFilesystemArtifactResultCreator<ArtifactLinkerLibraryTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + // The file used to link to the target (.dylib, .so, .a). + if (!target->IsLinkable() || + target->GetType() == cmStateEnums::EXECUTABLE) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_LIBRARY_FILE is allowed only for libraries " + "with ENABLE_EXPORTS."); + return std::string(); + } + + if (!target->IsDLLPlatform() || + target->GetType() == cmStateEnums::STATIC_LIBRARY) { + return target->GetFullPath(context->Config, + cmStateEnums::RuntimeBinaryArtifact); + } + return std::string{}; + } +}; + +template <> +struct TargetFilesystemArtifactResultCreator<ArtifactLinkerImportTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + // The file used to link to the target (.lib, .tbd). + if (!target->IsLinkable()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_LINKER_IMPORT_FILE is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + + if (target->HasImportLibrary(context->Config)) { + return target->GetFullPath(context->Config, + cmStateEnums::ImportLibraryArtifact); + } + return std::string{}; + } +}; + +template <> struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirTag> { static std::string Create(cmGeneratorTarget* target, @@ -2929,6 +3050,21 @@ struct TargetFilesystemArtifactResultCreator<ArtifactNameTag> } }; +template <> +struct TargetFilesystemArtifactResultCreator<ArtifactImportTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* /*unused*/) + { + if (target->HasImportLibrary(context->Config)) { + return target->GetFullPath(context->Config, + cmStateEnums::ImportLibraryArtifact, true); + } + return std::string{}; + } +}; + template <typename ArtifactT> struct TargetFilesystemArtifactResultGetter { @@ -3054,12 +3190,24 @@ struct TargetFilesystemArtifactNodeGroup static const TargetFilesystemArtifactNodeGroup<ArtifactNameTag> targetNodeGroup; +static const TargetFilesystemArtifactNodeGroup<ArtifactImportTag> + targetImportNodeGroup; + static const TargetFilesystemArtifactNodeGroup<ArtifactLinkerTag> targetLinkerNodeGroup; +static const TargetFilesystemArtifactNodeGroup<ArtifactLinkerLibraryTag> + targetLinkerLibraryNodeGroup; + +static const TargetFilesystemArtifactNodeGroup<ArtifactLinkerImportTag> + targetLinkerImportNodeGroup; + static const TargetFilesystemArtifactNodeGroup<ArtifactSonameTag> targetSoNameNodeGroup; +static const TargetFilesystemArtifactNodeGroup<ArtifactSonameImportTag> + targetSoNameImportNodeGroup; + static const TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> targetPdbNodeGroup; @@ -3099,13 +3247,30 @@ struct TargetOutputNameArtifactResultGetter<ArtifactNameTag> }; template <> +struct TargetOutputNameArtifactResultGetter<ArtifactImportTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* /*unused*/) + { + if (target->HasImportLibrary(context->Config)) { + return target->GetOutputName(context->Config, + cmStateEnums::ImportLibraryArtifact) + + target->GetFilePostfix(context->Config); + } + return std::string{}; + } +}; + +template <> struct TargetOutputNameArtifactResultGetter<ArtifactLinkerTag> { static std::string Get(cmGeneratorTarget* target, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content) { - // The file used to link to the target (.so, .lib, .a). + // The library file used to link to the target (.so, .lib, .a) or import + // file (.lin, .tbd). if (!target->IsLinkable()) { ::reportError(context, content->GetOriginalExpression(), "TARGET_LINKER_FILE_BASE_NAME is allowed only for " @@ -3122,6 +3287,56 @@ struct TargetOutputNameArtifactResultGetter<ArtifactLinkerTag> }; template <> +struct TargetOutputNameArtifactResultGetter<ArtifactLinkerLibraryTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + // The library file used to link to the target (.so, .lib, .a). + if (!target->IsLinkable() || + target->GetType() == cmStateEnums::EXECUTABLE) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_LIBRARY_FILE_BASE_NAME is allowed only for " + "libraries with ENABLE_EXPORTS."); + return std::string(); + } + + if (!target->IsDLLPlatform() || + target->GetType() == cmStateEnums::STATIC_LIBRARY) { + return target->GetOutputName(context->Config, + cmStateEnums::ImportLibraryArtifact) + + target->GetFilePostfix(context->Config); + } + return std::string{}; + } +}; + +template <> +struct TargetOutputNameArtifactResultGetter<ArtifactLinkerImportTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + // The import file used to link to the target (.lib, .tbd). + if (!target->IsLinkable()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_IMPORT_FILE_BASE_NAME is allowed only for " + "libraries and executables with ENABLE_EXPORTS."); + return std::string(); + } + + if (target->HasImportLibrary(context->Config)) { + return target->GetOutputName(context->Config, + cmStateEnums::ImportLibraryArtifact) + + target->GetFilePostfix(context->Config); + } + return std::string{}; + } +}; + +template <> struct TargetOutputNameArtifactResultGetter<ArtifactPdbTag> { static std::string Get(cmGeneratorTarget* target, @@ -3192,15 +3407,27 @@ struct TargetFileBaseNameArtifact : public TargetArtifactBase static const TargetFileBaseNameArtifact<ArtifactNameTag> targetFileBaseNameNode; +static const TargetFileBaseNameArtifact<ArtifactImportTag> + targetImportFileBaseNameNode; static const TargetFileBaseNameArtifact<ArtifactLinkerTag> targetLinkerFileBaseNameNode; +static const TargetFileBaseNameArtifact<ArtifactLinkerLibraryTag> + targetLinkerLibraryFileBaseNameNode; +static const TargetFileBaseNameArtifact<ArtifactLinkerImportTag> + targetLinkerImportFileBaseNameNode; static const TargetFileBaseNameArtifact<ArtifactPdbTag> targetPdbFileBaseNameNode; class ArtifactFilePrefixTag; +class ArtifactImportFilePrefixTag; class ArtifactLinkerFilePrefixTag; +class ArtifactLinkerLibraryFilePrefixTag; +class ArtifactLinkerImportFilePrefixTag; class ArtifactFileSuffixTag; +class ArtifactImportFileSuffixTag; class ArtifactLinkerFileSuffixTag; +class ArtifactLinkerLibraryFileSuffixTag; +class ArtifactLinkerImportFileSuffixTag; template <typename ArtifactT> struct TargetFileArtifactResultGetter @@ -3221,6 +3448,20 @@ struct TargetFileArtifactResultGetter<ArtifactFilePrefixTag> } }; template <> +struct TargetFileArtifactResultGetter<ArtifactImportFilePrefixTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent*) + { + if (target->HasImportLibrary(context->Config)) { + return target->GetFilePrefix(context->Config, + cmStateEnums::ImportLibraryArtifact); + } + return std::string{}; + } +}; +template <> struct TargetFileArtifactResultGetter<ArtifactLinkerFilePrefixTag> { static std::string Get(cmGeneratorTarget* target, @@ -3228,9 +3469,10 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerFilePrefixTag> const GeneratorExpressionContent* content) { if (!target->IsLinkable()) { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_PREFIX is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_LINKER_FILE_PREFIX is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); return std::string(); } @@ -3243,6 +3485,52 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerFilePrefixTag> } }; template <> +struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFilePrefixTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (!target->IsLinkable() || + target->GetType() == cmStateEnums::EXECUTABLE) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_LINKER_LIBRARY_FILE_PREFIX is allowed only for libraries " + "with ENABLE_EXPORTS."); + return std::string(); + } + + if (!target->IsDLLPlatform() || + target->GetType() == cmStateEnums::STATIC_LIBRARY) { + return target->GetFilePrefix(context->Config, + cmStateEnums::RuntimeBinaryArtifact); + } + return std::string{}; + } +}; +template <> +struct TargetFileArtifactResultGetter<ArtifactLinkerImportFilePrefixTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (!target->IsLinkable()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_LINKER_IMPORT_FILE_PREFIX is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + + if (target->HasImportLibrary(context->Config)) { + return target->GetFilePrefix(context->Config, + cmStateEnums::ImportLibraryArtifact); + } + return std::string{}; + } +}; +template <> struct TargetFileArtifactResultGetter<ArtifactFileSuffixTag> { static std::string Get(cmGeneratorTarget* target, @@ -3253,6 +3541,20 @@ struct TargetFileArtifactResultGetter<ArtifactFileSuffixTag> } }; template <> +struct TargetFileArtifactResultGetter<ArtifactImportFileSuffixTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent*) + { + if (target->HasImportLibrary(context->Config)) { + return target->GetFileSuffix(context->Config, + cmStateEnums::ImportLibraryArtifact); + } + return std::string{}; + } +}; +template <> struct TargetFileArtifactResultGetter<ArtifactLinkerFileSuffixTag> { static std::string Get(cmGeneratorTarget* target, @@ -3260,9 +3562,10 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerFileSuffixTag> const GeneratorExpressionContent* content) { if (!target->IsLinkable()) { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_SUFFIX is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_LINKER_FILE_SUFFIX is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); return std::string(); } @@ -3274,6 +3577,51 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerFileSuffixTag> return target->GetFileSuffix(context->Config, artifact); } }; +template <> +struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFileSuffixTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (!target->IsLinkable() || + target->GetType() == cmStateEnums::STATIC_LIBRARY) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_LIBRARY_FILE_SUFFIX is allowed only for " + "libraries with ENABLE_EXPORTS."); + return std::string(); + } + + if (!target->IsDLLPlatform() || + target->GetType() == cmStateEnums::STATIC_LIBRARY) { + return target->GetFileSuffix(context->Config, + cmStateEnums::RuntimeBinaryArtifact); + } + return std::string{}; + } +}; +template <> +struct TargetFileArtifactResultGetter<ArtifactLinkerImportFileSuffixTag> +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (!target->IsLinkable()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_LINKER_IMPORT_FILE_SUFFIX is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + + if (target->HasImportLibrary(context->Config)) { + return target->GetFileSuffix(context->Config, + cmStateEnums::ImportLibraryArtifact); + } + return std::string{}; + } +}; template <typename ArtifactT> struct TargetFileArtifact : public TargetArtifactBase @@ -3304,11 +3652,23 @@ struct TargetFileArtifact : public TargetArtifactBase }; static const TargetFileArtifact<ArtifactFilePrefixTag> targetFilePrefixNode; +static const TargetFileArtifact<ArtifactImportFilePrefixTag> + targetImportFilePrefixNode; static const TargetFileArtifact<ArtifactLinkerFilePrefixTag> targetLinkerFilePrefixNode; +static const TargetFileArtifact<ArtifactLinkerLibraryFilePrefixTag> + targetLinkerLibraryFilePrefixNode; +static const TargetFileArtifact<ArtifactLinkerImportFilePrefixTag> + targetLinkerImportFilePrefixNode; static const TargetFileArtifact<ArtifactFileSuffixTag> targetFileSuffixNode; +static const TargetFileArtifact<ArtifactImportFileSuffixTag> + targetImportFileSuffixNode; static const TargetFileArtifact<ArtifactLinkerFileSuffixTag> targetLinkerFileSuffixNode; +static const TargetFileArtifact<ArtifactLinkerLibraryFileSuffixTag> + targetLinkerLibraryFileSuffixNode; +static const TargetFileArtifact<ArtifactLinkerImportFileSuffixTag> + targetLinkerImportFileSuffixNode; static const struct ShellPathNode : public cmGeneratorExpressionNode { @@ -3376,23 +3736,52 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "CONFIGURATION", &configurationNode }, { "CONFIG", &configurationTestNode }, { "TARGET_FILE", &targetNodeGroup.File }, + { "TARGET_IMPORT_FILE", &targetImportNodeGroup.File }, { "TARGET_LINKER_FILE", &targetLinkerNodeGroup.File }, + { "TARGET_LINKER_LIBRARY_FILE", &targetLinkerLibraryNodeGroup.File }, + { "TARGET_LINKER_IMPORT_FILE", &targetLinkerImportNodeGroup.File }, { "TARGET_SONAME_FILE", &targetSoNameNodeGroup.File }, + { "TARGET_SONAME_IMPORT_FILE", &targetSoNameImportNodeGroup.File }, { "TARGET_PDB_FILE", &targetPdbNodeGroup.File }, { "TARGET_FILE_BASE_NAME", &targetFileBaseNameNode }, + { "TARGET_IMPORT_FILE_BASE_NAME", &targetImportFileBaseNameNode }, { "TARGET_LINKER_FILE_BASE_NAME", &targetLinkerFileBaseNameNode }, + { "TARGET_LINKER_LIBRARY_FILE_BASE_NAME", + &targetLinkerLibraryFileBaseNameNode }, + { "TARGET_LINKER_IMPORT_FILE_BASE_NAME", + &targetLinkerImportFileBaseNameNode }, { "TARGET_PDB_FILE_BASE_NAME", &targetPdbFileBaseNameNode }, { "TARGET_FILE_PREFIX", &targetFilePrefixNode }, + { "TARGET_IMPORT_FILE_PREFIX", &targetImportFilePrefixNode }, { "TARGET_LINKER_FILE_PREFIX", &targetLinkerFilePrefixNode }, + { "TARGET_LINKER_LIBRARY_FILE_PREFIX", + &targetLinkerLibraryFilePrefixNode }, + { "TARGET_LINKER_IMPORT_FILE_PREFIX", &targetLinkerImportFilePrefixNode }, { "TARGET_FILE_SUFFIX", &targetFileSuffixNode }, + { "TARGET_IMPORT_FILE_SUFFIX", &targetImportFileSuffixNode }, { "TARGET_LINKER_FILE_SUFFIX", &targetLinkerFileSuffixNode }, + { "TARGET_LINKER_LIBRARY_FILE_SUFFIX", + &targetLinkerLibraryFileSuffixNode }, + { "TARGET_LINKER_IMPORT_FILE_SUFFIX", &targetLinkerImportFileSuffixNode }, { "TARGET_FILE_NAME", &targetNodeGroup.FileName }, + { "TARGET_IMPORT_FILE_NAME", &targetImportNodeGroup.FileName }, { "TARGET_LINKER_FILE_NAME", &targetLinkerNodeGroup.FileName }, + { "TARGET_LINKER_LIBRARY_FILE_NAME", + &targetLinkerLibraryNodeGroup.FileName }, + { "TARGET_LINKER_IMPORT_FILE_NAME", + &targetLinkerImportNodeGroup.FileName }, { "TARGET_SONAME_FILE_NAME", &targetSoNameNodeGroup.FileName }, + { "TARGET_SONAME_IMPORT_FILE_NAME", + &targetSoNameImportNodeGroup.FileName }, { "TARGET_PDB_FILE_NAME", &targetPdbNodeGroup.FileName }, { "TARGET_FILE_DIR", &targetNodeGroup.FileDir }, + { "TARGET_IMPORT_FILE_DIR", &targetImportNodeGroup.FileDir }, { "TARGET_LINKER_FILE_DIR", &targetLinkerNodeGroup.FileDir }, + { "TARGET_LINKER_LIBRARY_FILE_DIR", + &targetLinkerLibraryNodeGroup.FileDir }, + { "TARGET_LINKER_IMPORT_FILE_DIR", &targetLinkerImportNodeGroup.FileDir }, { "TARGET_SONAME_FILE_DIR", &targetSoNameNodeGroup.FileDir }, + { "TARGET_SONAME_IMPORT_FILE_DIR", &targetSoNameImportNodeGroup.FileDir }, { "TARGET_PDB_FILE_DIR", &targetPdbNodeGroup.FileDir }, { "TARGET_BUNDLE_DIR", &targetBundleDirNode }, { "TARGET_BUNDLE_DIR_NAME", &targetBundleDirNameNode }, @@ -3420,6 +3809,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_NAME_IF_EXISTS", &targetNameIfExistsNode }, { "TARGET_GENEX_EVAL", &targetGenexEvalNode }, { "TARGET_RUNTIME_DLLS", &targetRuntimeDllsNode }, + { "TARGET_RUNTIME_DLL_DIRS", &targetRuntimeDllDirsNode }, { "GENEX_EVAL", &genexEvalNode }, { "BUILD_INTERFACE", &buildInterfaceNode }, { "INSTALL_INTERFACE", &installInterfaceNode }, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 112a87f..4cfa1d7 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -459,6 +459,11 @@ std::string const& cmGeneratorTarget::GetSafeProperty( const char* cmGeneratorTarget::GetOutputTargetType( cmStateEnums::ArtifactType artifact) const { + if (this->IsFrameworkOnApple() || this->GetGlobalGenerator()->IsXcode()) { + // import file (i.e. .tbd file) is always in same location as library + artifact = cmStateEnums::RuntimeBinaryArtifact; + } + switch (this->GetType()) { case cmStateEnums::SHARED_LIBRARY: if (this->IsDLLPlatform()) { @@ -471,9 +476,15 @@ const char* cmGeneratorTarget::GetOutputTargetType( return "ARCHIVE"; } } else { - // For non-DLL platforms shared libraries are treated as - // library targets. - return "LIBRARY"; + switch (artifact) { + case cmStateEnums::RuntimeBinaryArtifact: + // For non-DLL platforms shared libraries are treated as + // library targets. + return "LIBRARY"; + case cmStateEnums::ImportLibraryArtifact: + // Library import libraries are treated as archive targets. + return "ARCHIVE"; + } } break; case cmStateEnums::STATIC_LIBRARY: @@ -1730,7 +1741,8 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget, std::move(entryCge), fileSet); entries.Entries.emplace_back( EvaluateTargetPropertyEntry(headTarget, config, "", dagChecker, tpe)); - for (auto const& file : entries.Entries.back().Values) { + EvaluatedTargetPropertyEntry const& entry = entries.Entries.back(); + for (auto const& file : entry.Values) { auto* sf = headTarget->Makefile->GetOrCreateSource(file); if (fileSet->GetType() == "HEADERS"_s) { sf->SetProperty("HEADER_FILE_ONLY", "TRUE"); @@ -1741,13 +1753,11 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget, std::string w; auto path = sf->ResolveFullPath(&e, &w); if (!w.empty()) { - cm->IssueMessage(MessageType::AUTHOR_WARNING, w, - headTarget->GetBacktrace()); + cm->IssueMessage(MessageType::AUTHOR_WARNING, w, entry.Backtrace); } if (path.empty()) { if (!e.empty()) { - cm->IssueMessage(MessageType::FATAL_ERROR, e, - headTarget->GetBacktrace()); + cm->IssueMessage(MessageType::FATAL_ERROR, e, entry.Backtrace); } return; } @@ -1822,11 +1832,11 @@ bool processSources(cmGeneratorTarget const* tgt, std::string fullPath = sf->ResolveFullPath(&e, &w); cmake* cm = tgt->GetLocalGenerator()->GetCMakeInstance(); if (!w.empty()) { - cm->IssueMessage(MessageType::AUTHOR_WARNING, w, tgt->GetBacktrace()); + cm->IssueMessage(MessageType::AUTHOR_WARNING, w, entry.Backtrace); } if (fullPath.empty()) { if (!e.empty()) { - cm->IssueMessage(MessageType::FATAL_ERROR, e, tgt->GetBacktrace()); + cm->IssueMessage(MessageType::FATAL_ERROR, e, entry.Backtrace); } return contextDependent; } @@ -2534,7 +2544,8 @@ bool cmGeneratorTarget::CanGenerateInstallNameDir( return !skip; } -std::string cmGeneratorTarget::GetSOName(const std::string& config) const +std::string cmGeneratorTarget::GetSOName( + const std::string& config, cmStateEnums::ArtifactType artifact) const { if (this->IsImported()) { // Lookup the imported soname. @@ -2562,7 +2573,9 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const return ""; } // Compute the soname that will be built. - return this->GetLibraryNames(config).SharedObject; + return artifact == cmStateEnums::RuntimeBinaryArtifact + ? this->GetLibraryNames(config).SharedObject + : this->GetLibraryNames(config).ImportLibrary; } namespace { @@ -3090,6 +3103,16 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo( } } +bool cmGeneratorTarget::IsAIX() const +{ + return this->Target->IsAIX(); +} + +bool cmGeneratorTarget::IsApple() const +{ + return this->Target->IsApple(); +} + bool cmGeneratorTarget::IsDLLPlatform() const { return this->Target->IsDLLPlatform(); @@ -3428,7 +3451,7 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory( void cmGeneratorTarget::GetAppleArchs(const std::string& config, std::vector<std::string>& archVec) const { - if (!this->Makefile->IsOn("APPLE")) { + if (!this->IsApple()) { return; } cmValue archs = nullptr; @@ -3926,7 +3949,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories( AddInterfaceEntries(this, config, "INTERFACE_INCLUDE_DIRECTORIES", lang, &dagChecker, entries, IncludeRuntimeInterface::Yes); - if (this->Makefile->IsOn("APPLE")) { + if (this->IsApple()) { if (cmLinkImplementationLibraries const* impl = this->GetLinkImplementationLibraries(config, LinkInterfaceFor::Usage)) { @@ -5094,10 +5117,18 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const f = cmStrCat(dir, '/', targetNames.PDB); gg->AddToManifest(f); } + + dir = this->GetDirectory(config, cmStateEnums::ImportLibraryArtifact); + if (!targetNames.ImportOutput.empty()) { + f = cmStrCat(dir, '/', targetNames.ImportOutput); + gg->AddToManifest(f); + } if (!targetNames.ImportLibrary.empty()) { - f = - cmStrCat(this->GetDirectory(config, cmStateEnums::ImportLibraryArtifact), - '/', targetNames.ImportLibrary); + f = cmStrCat(dir, '/', targetNames.ImportLibrary); + gg->AddToManifest(f); + } + if (!targetNames.ImportReal.empty()) { + f = cmStrCat(dir, '/', targetNames.ImportReal); gg->AddToManifest(f); } } @@ -5217,14 +5248,20 @@ std::string cmGeneratorTarget::NormalGetFullPath( } break; case cmStateEnums::ImportLibraryArtifact: - fpath += this->GetFullName(config, cmStateEnums::ImportLibraryArtifact); + if (realname) { + fpath += + this->NormalGetRealName(config, cmStateEnums::ImportLibraryArtifact); + } else { + fpath += + this->GetFullName(config, cmStateEnums::ImportLibraryArtifact); + } break; } return fpath; } std::string cmGeneratorTarget::NormalGetRealName( - const std::string& config) const + const std::string& config, cmStateEnums::ArtifactType artifact) const { // This should not be called for imported targets. // TODO: Split cmTarget into a class hierarchy to get compile-time @@ -5235,12 +5272,13 @@ std::string cmGeneratorTarget::NormalGetRealName( this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); } - if (this->GetType() == cmStateEnums::EXECUTABLE) { - // Compute the real name that will be built. - return this->GetExecutableNames(config).Real; - } + Names names = this->GetType() == cmStateEnums::EXECUTABLE + ? this->GetExecutableNames(config) + : this->GetLibraryNames(config); + // Compute the real name that will be built. - return this->GetLibraryNames(config).Real; + return artifact == cmStateEnums::RuntimeBinaryArtifact ? names.Real + : names.ImportReal; } cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames( @@ -5285,17 +5323,16 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames( // The library name. targetNames.Base = components.base; targetNames.Output = - components.prefix + targetNames.Base + components.suffix; + cmStrCat(components.prefix, targetNames.Base, components.suffix); if (this->IsFrameworkOnApple()) { targetNames.Real = components.prefix; if (!this->Makefile->PlatformIsAppleEmbedded()) { - targetNames.Real += "Versions/"; - targetNames.Real += this->GetFrameworkVersion(); - targetNames.Real += "/"; + targetNames.Real += + cmStrCat("Versions/", this->GetFrameworkVersion(), '/'); } - targetNames.Real += targetNames.Base + components.suffix; - targetNames.SharedObject = targetNames.Real + components.suffix; + targetNames.Real += cmStrCat(targetNames.Base, components.suffix); + targetNames.SharedObject = targetNames.Real; } else { // The library's soname. this->ComputeVersionedName(targetNames.SharedObject, components.prefix, @@ -5308,11 +5345,36 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames( targetNames.Output, version); } - // The import library name. + // The import library names. if (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->GetType() == cmStateEnums::MODULE_LIBRARY) { - targetNames.ImportLibrary = - this->GetFullNameInternal(config, cmStateEnums::ImportLibraryArtifact); + NameComponents const& importComponents = + this->GetFullNameInternalComponents(config, + cmStateEnums::ImportLibraryArtifact); + targetNames.ImportOutput = cmStrCat( + importComponents.prefix, importComponents.base, importComponents.suffix); + + if (this->IsFrameworkOnApple() && this->IsSharedLibraryWithExports()) { + targetNames.ImportReal = components.prefix; + if (!this->Makefile->PlatformIsAppleEmbedded()) { + targetNames.ImportReal += + cmStrCat("Versions/", this->GetFrameworkVersion(), '/'); + } + targetNames.ImportReal += + cmStrCat(importComponents.base, importComponents.suffix); + targetNames.ImportLibrary = targetNames.ImportOutput; + } else { + // The import library's soname. + this->ComputeVersionedName( + targetNames.ImportLibrary, importComponents.prefix, + importComponents.base, importComponents.suffix, + targetNames.ImportOutput, soversion); + + // The import library's real name on disk. + this->ComputeVersionedName( + targetNames.ImportReal, importComponents.prefix, importComponents.base, + importComponents.suffix, targetNames.ImportOutput, version); + } } // The program database file name. @@ -5374,6 +5436,8 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames( // The import library name. targetNames.ImportLibrary = this->GetFullNameInternal(config, cmStateEnums::ImportLibraryArtifact); + targetNames.ImportReal = targetNames.ImportLibrary; + targetNames.ImportOutput = targetNames.ImportLibrary; // The program database file name. targetNames.PDB = this->GetPDBName(config); @@ -5455,15 +5519,18 @@ cmGeneratorTarget::GetFullNameInternalComponents( } // Compute the full name for main target types. - const std::string configPostfix = this->GetFilePostfix(config); + std::string configPostfix = this->GetFilePostfix(config); - // frameworks have directory prefix but no suffix + // frameworks have directory prefix std::string fw_prefix; if (this->IsFrameworkOnApple()) { fw_prefix = cmStrCat(this->GetFrameworkDirectory(config, ContentLevel), '/'); targetPrefix = cmValue(fw_prefix); - targetSuffix = nullptr; + if (!isImportedLibraryArtifact) { + // no suffix + targetSuffix = nullptr; + } } if (this->IsCFBundleOnApple()) { @@ -5482,8 +5549,8 @@ cmGeneratorTarget::GetFullNameInternalComponents( // When using Xcode, the postfix should be part of the suffix rather than // the base, because the suffix ends up being used in Xcode's // EXECUTABLE_SUFFIX attribute. - if (this->IsFrameworkOnApple() && - this->GetGlobalGenerator()->GetName() == "Xcode") { + if (this->IsFrameworkOnApple() && this->GetGlobalGenerator()->IsXcode()) { + configPostfix += *targetSuffix; targetSuffix = cmValue(configPostfix); } else { outBase += configPostfix; @@ -6779,12 +6846,12 @@ void cmGeneratorTarget::ComputeVersionedName( std::string& vName, std::string const& prefix, std::string const& base, std::string const& suffix, std::string const& name, cmValue version) const { - vName = this->Makefile->IsOn("APPLE") ? (prefix + base) : name; + vName = this->IsApple() ? (prefix + base) : name; if (version) { vName += "."; vName += *version; } - vName += this->Makefile->IsOn("APPLE") ? suffix : std::string(); + vName += this->IsApple() ? suffix : std::string(); } std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const @@ -8553,19 +8620,38 @@ bool cmGeneratorTarget::HasContextDependentSources() const bool cmGeneratorTarget::IsExecutableWithExports() const { - return (this->GetType() == cmStateEnums::EXECUTABLE && - this->GetPropertyAsBool("ENABLE_EXPORTS")); + return this->Target->IsExecutableWithExports(); +} + +bool cmGeneratorTarget::IsSharedLibraryWithExports() const +{ + return this->Target->IsSharedLibraryWithExports(); } bool cmGeneratorTarget::HasImportLibrary(std::string const& config) const { + bool generate_Stubs = true; + if (this->GetGlobalGenerator()->IsXcode()) { + // take care of CMAKE_XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS variable + // as well as XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS property + if (cmValue propGenStubs = + this->GetProperty("XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS")) { + generate_Stubs = propGenStubs == "YES"; + } else if (cmValue varGenStubs = this->Makefile->GetDefinition( + "CMAKE_XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS")) { + generate_Stubs = varGenStubs == "YES"; + } + } + return (this->IsDLLPlatform() && (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->IsExecutableWithExports()) && // Assemblies which have only managed code do not have // import libraries. this->GetManagedType(config) != ManagedType::Managed) || - (this->Target->IsAIX() && this->IsExecutableWithExports()); + (this->IsAIX() && this->IsExecutableWithExports()) || + (this->Makefile->PlatformSupportsAppleTextStubs() && + this->IsSharedLibraryWithExports() && generate_Stubs); } bool cmGeneratorTarget::NeedImportLibraryName(std::string const& config) const @@ -8603,17 +8689,12 @@ bool cmGeneratorTarget::IsLinkable() const bool cmGeneratorTarget::IsFrameworkOnApple() const { - return ((this->GetType() == cmStateEnums::SHARED_LIBRARY || - this->GetType() == cmStateEnums::STATIC_LIBRARY) && - this->Makefile->IsOn("APPLE") && - this->GetPropertyAsBool("FRAMEWORK")); + return this->Target->IsFrameworkOnApple(); } bool cmGeneratorTarget::IsAppBundleOnApple() const { - return (this->GetType() == cmStateEnums::EXECUTABLE && - this->Makefile->IsOn("APPLE") && - this->GetPropertyAsBool("MACOSX_BUNDLE")); + return this->Target->IsAppBundleOnApple(); } bool cmGeneratorTarget::IsXCTestOnApple() const @@ -8623,8 +8704,8 @@ bool cmGeneratorTarget::IsXCTestOnApple() const bool cmGeneratorTarget::IsCFBundleOnApple() const { - return (this->GetType() == cmStateEnums::MODULE_LIBRARY && - this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("BUNDLE")); + return (this->GetType() == cmStateEnums::MODULE_LIBRARY && this->IsApple() && + this->GetPropertyAsBool("BUNDLE")); } cmGeneratorTarget::ManagedType cmGeneratorTarget::CheckManagedType( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index e46c719..5d26191 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -273,7 +273,9 @@ public: std::string NormalGetFullPath(const std::string& config, cmStateEnums::ArtifactType artifact, bool realname) const; - std::string NormalGetRealName(const std::string& config) const; + std::string NormalGetRealName(const std::string& config, + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; /** Get the names of an object library's object files underneath its object file directory. */ @@ -348,7 +350,9 @@ public: const std::string* GetExportMacro() const; /** Get the soname of the target. Allowed only for a shared library. */ - std::string GetSOName(const std::string& config) const; + std::string GetSOName(const std::string& config, + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; struct NameComponents { @@ -389,6 +393,11 @@ public: ModuleDefinitionInfo const* GetModuleDefinitionInfo( std::string const& config) const; + /** Return whether or not we are targeting AIX. */ + bool IsAIX() const; + /** Return whether or not we are targeting Apple. */ + bool IsApple() const; + /** Return whether or not the target is for a DLL platform. */ bool IsDLLPlatform() const; @@ -735,6 +744,8 @@ public: std::string Base; std::string Output; std::string Real; + std::string ImportOutput; + std::string ImportReal; std::string ImportLibrary; std::string PDB; std::string SharedObject; @@ -781,6 +792,10 @@ public: bool IsExecutableWithExports() const; + /* Return whether this target is a shared library with capability to generate + * a file describing symbols exported (for example, .tbd file on Apple). */ + bool IsSharedLibraryWithExports() const; + /** Return whether or not the target has a DLL import library. */ bool HasImportLibrary(std::string const& config) const; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index b5e1529..650d0aa 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -8,7 +8,6 @@ #include <cstdio> #include <functional> #include <sstream> -#include <tuple> #include <utility> #include <cm/iterator> @@ -571,6 +570,7 @@ void cmGlobalNinjaGenerator::Generate() msg.str()); return; } + this->InitOutputPathPrefix(); if (!this->OpenBuildFileStreams()) { return; } @@ -579,10 +579,9 @@ void cmGlobalNinjaGenerator::Generate() } for (auto& it : this->Configs) { - it.second.TargetDependsClosureLocalOutputs.clear(); + it.second.TargetDependsClosures.clear(); } - this->InitOutputPathPrefix(); this->TargetAll = this->NinjaOutputPath("all"); this->CMakeCacheFile = this->NinjaOutputPath("CMakeCache.txt"); this->DiagnosedCxxModuleNinjaSupport = false; @@ -1270,6 +1269,10 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( } CM_FALLTHROUGH; case cmStateEnums::EXECUTABLE: { + if (target->IsApple() && target->HasImportLibrary(config)) { + outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath( + config, cmStateEnums::ImportLibraryArtifact, realname))); + } outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath( config, cmStateEnums::RuntimeBinaryArtifact, realname))); break; @@ -1359,85 +1362,70 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure( cmGeneratorTarget const* target, cmNinjaDeps& outputs, const std::string& config, const std::string& fileConfig, bool genexOutput) { - struct Entry - { - Entry(cmGeneratorTarget const* target_, std::string config_, - std::string fileConfig_) - : target(target_) - , config(std::move(config_)) - , fileConfig(std::move(fileConfig_)) - { - } + cmNinjaOuts outs; + this->AppendTargetDependsClosure(target, outs, config, fileConfig, + genexOutput, true); + cm::append(outputs, outs); +} - bool operator<(Entry const& other) const - { - return std::tie(target, config, fileConfig) < - std::tie(other.target, other.config, other.fileConfig); - } +void cmGlobalNinjaGenerator::AppendTargetDependsClosure( + cmGeneratorTarget const* target, cmNinjaOuts& outputs, + const std::string& config, const std::string& fileConfig, bool genexOutput, + bool omit_self) +{ - cmGeneratorTarget const* target; - std::string config; - std::string fileConfig; + // try to locate the target in the cache + ByConfig::TargetDependsClosureKey key{ + target, + config, + genexOutput, }; - - cmNinjaOuts outputSet; - std::vector<Entry> stack; - stack.emplace_back(target, config, fileConfig); - std::set<Entry> seen = { stack.back() }; - - do { - Entry entry = std::move(stack.back()); - stack.pop_back(); - - // generate the outputs of the target itself, if applicable - if (entry.target != target) { - // try to locate the target in the cache - ByConfig::TargetDependsClosureKey localCacheKey{ - entry.target, - entry.config, - genexOutput, - }; - auto& configs = this->Configs[entry.fileConfig]; - auto lb = - configs.TargetDependsClosureLocalOutputs.lower_bound(localCacheKey); - - if (lb == configs.TargetDependsClosureLocalOutputs.end() || - lb->first != localCacheKey) { - cmNinjaDeps outs; - this->AppendTargetOutputs(entry.target, outs, entry.config, - DependOnTargetArtifact); - configs.TargetDependsClosureLocalOutputs.emplace_hint( - lb, localCacheKey, outs); - for (auto& value : outs) { - outputSet.emplace(std::move(value)); - } - } else { - outputSet.insert(lb->second.begin(), lb->second.end()); - } - } - - // push next dependencies - for (const auto& dep_target : this->GetTargetDirectDepends(entry.target)) { + auto find = this->Configs[fileConfig].TargetDependsClosures.lower_bound(key); + + if (find == this->Configs[fileConfig].TargetDependsClosures.end() || + find->first != key) { + // We now calculate the closure outputs by inspecting the dependent + // targets recursively. + // For that we have to distinguish between a local result set that is only + // relevant for filling the cache entries properly isolated and a global + // result set that is relevant for the result of the top level call to + // AppendTargetDependsClosure. + cmNinjaOuts this_outs; // this will be the new cache entry + + for (auto const& dep_target : this->GetTargetDirectDepends(target)) { if (!dep_target->IsInBuildSystem()) { continue; } - if (!this->IsSingleConfigUtility(entry.target) && + if (!this->IsSingleConfigUtility(target) && !this->IsSingleConfigUtility(dep_target) && this->EnableCrossConfigBuild() && !dep_target.IsCross() && !genexOutput) { continue; } - auto emplaceRes = seen.emplace( - dep_target, dep_target.IsCross() ? entry.fileConfig : entry.config, - entry.fileConfig); - if (emplaceRes.second) { - stack.emplace_back(*emplaceRes.first); + if (dep_target.IsCross()) { + this->AppendTargetDependsClosure(dep_target, this_outs, fileConfig, + fileConfig, genexOutput, false); + } else { + this->AppendTargetDependsClosure(dep_target, this_outs, config, + fileConfig, genexOutput, false); } } - } while (!stack.empty()); - cm::append(outputs, outputSet); + find = this->Configs[fileConfig].TargetDependsClosures.emplace_hint( + find, key, std::move(this_outs)); + } + + // now fill the outputs of the final result from the newly generated cache + // entry + outputs.insert(find->second.begin(), find->second.end()); + + // finally generate the outputs of the target itself, if applicable + cmNinjaDeps outs; + if (!omit_self) { + this->AppendTargetOutputs(target, outs, config, DependOnTargetArtifact); + } + outputs.insert(outs.begin(), outs.end()); } void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, @@ -2075,9 +2063,10 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) build.Outputs.front() = this->BuildAlias( this->NinjaOutputPath(this->GetCleanTargetName()), config); if (this->IsMultiConfig()) { - build.Variables["TARGETS"] = - cmStrCat(this->BuildAlias(GetByproductsForCleanTargetName(), config), - " ", GetByproductsForCleanTargetName()); + build.Variables["TARGETS"] = cmStrCat( + this->BuildAlias( + this->NinjaOutputPath(GetByproductsForCleanTargetName()), config), + " ", this->NinjaOutputPath(GetByproductsForCleanTargetName())); } build.ExplicitDeps.clear(); if (additionalFiles) { @@ -2092,7 +2081,8 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) if (this->IsMultiConfig()) { build.Variables["FILE_ARG"] = cmStrCat( "-f ", - cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig)); + this->NinjaOutputPath( + cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig))); } this->WriteBuild(*this->GetImplFileStream(fileConfig), build); } @@ -2114,8 +2104,8 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) std::vector<std::string> byproducts; byproducts.reserve(this->CrossConfigs.size()); for (auto const& config : this->CrossConfigs) { - byproducts.push_back( - this->BuildAlias(GetByproductsForCleanTargetName(), config)); + byproducts.push_back(this->BuildAlias( + this->NinjaOutputPath(GetByproductsForCleanTargetName()), config)); } byproducts.emplace_back(GetByproductsForCleanTargetName()); build.Variables["TARGETS"] = cmJoin(byproducts, " "); @@ -2123,7 +2113,8 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) for (auto const& fileConfig : configs) { build.Variables["FILE_ARG"] = cmStrCat( "-f ", - cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig)); + this->NinjaOutputPath( + cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig))); this->WriteBuild(*this->GetImplFileStream(fileConfig), build); } } @@ -2906,7 +2897,8 @@ bool cmGlobalNinjaMultiGenerator::OpenBuildFileStreams() *this->DefaultFileStream << "# Build using rules for '" << this->DefaultFileConfig << "'.\n\n" << "include " - << GetNinjaImplFilename(this->DefaultFileConfig) + << this->NinjaOutputPath( + GetNinjaImplFilename(this->DefaultFileConfig)) << "\n\n"; // Write a comment about this file. @@ -2939,7 +2931,8 @@ bool cmGlobalNinjaMultiGenerator::OpenBuildFileStreams() *this->ConfigFileStreams[config] << "# This file contains aliases specific to the \"" << config << "\"\n# configuration.\n\n" - << "include " << GetNinjaImplFilename(config) << "\n\n"; + << "include " << this->NinjaOutputPath(GetNinjaImplFilename(config)) + << "\n\n"; return true; }); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 6d23e89..c08bb46 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -354,6 +354,11 @@ public: const std::string& config, const std::string& fileConfig, bool genexOutput); + void AppendTargetDependsClosure(cmGeneratorTarget const* target, + cmNinjaOuts& outputs, + const std::string& config, + const std::string& fileConfig, + bool genexOutput, bool omit_self); void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, @@ -611,8 +616,7 @@ private: bool GenexOutput; }; - std::map<TargetDependsClosureKey, cmNinjaDeps> - TargetDependsClosureLocalOutputs; + std::map<TargetDependsClosureKey, cmNinjaOuts> TargetDependsClosures; TargetAliasMap TargetAliases; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d4ce69e..5b3ac60 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1739,7 +1739,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( std::string str_so_file = cmStrCat("$<TARGET_SONAME_FILE:", gtgt->GetName(), '>'); std::string str_link_file = - cmStrCat("$<TARGET_LINKER_FILE:", gtgt->GetName(), '>'); + cmStrCat("$<TARGET_LINKER_LIBRARY_FILE:", gtgt->GetName(), '>'); cmCustomCommandLines cmd = cmMakeSingleCommandLine( { cmSystemTools::GetCMakeCommand(), "-E", "cmake_symlink_library", str_file, str_so_file, str_link_file }); @@ -1754,6 +1754,27 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( postbuild.push_back(std::move(command)); } + if (gtgt->HasImportLibrary("") && !gtgt->IsFrameworkOnApple()) { + // create symbolic links for .tbd file + std::string file = cmStrCat("$<TARGET_IMPORT_FILE:", gtgt->GetName(), '>'); + std::string soFile = + cmStrCat("$<TARGET_SONAME_IMPORT_FILE:", gtgt->GetName(), '>'); + std::string linkFile = + cmStrCat("$<TARGET_LINKER_IMPORT_FILE:", gtgt->GetName(), '>'); + cmCustomCommandLines symlink_command = cmMakeSingleCommandLine( + { cmSystemTools::GetCMakeCommand(), "-E", "cmake_symlink_library", file, + soFile, linkFile }); + + cmCustomCommand command; + command.SetCommandLines(symlink_command); + command.SetComment("Creating import symlinks"); + command.SetWorkingDirectory(""); + command.SetBacktrace(this->CurrentMakefile->GetBacktrace()); + command.SetStdPipesUTF8(true); + + postbuild.push_back(std::move(command)); + } + cmXCodeObject* legacyCustomCommandsBuildPhase = nullptr; cmXCodeObject* preBuildPhase = nullptr; cmXCodeObject* preLinkPhase = nullptr; @@ -2682,6 +2703,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("DYNAMIC")); + + if (gtgt->HasImportLibrary(configName)) { + // Request .tbd file generation + buildSettings->AddAttribute("GENERATE_TEXT_BASED_STUBS", + this->CreateString("YES")); + } break; } case cmStateEnums::EXECUTABLE: { diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 3564cf7..56883fb 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -22,6 +22,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args, if (DeprecatedModules.empty()) { DeprecatedModules["Dart"] = cmPolicies::CMP0145; DeprecatedModules["Documentation"] = cmPolicies::CMP0106; + DeprecatedModules["FindCUDA"] = cmPolicies::CMP0146; DeprecatedModules["FindDart"] = cmPolicies::CMP0145; DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120; } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 56c8b26..40230d9 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -553,34 +553,35 @@ bool HandleTargetsMode(std::vector<std::string> const& args, // Enforce argument rules too complex to specify for the // general-purpose parser. - if (archiveArgs.GetNamelinkOnly() || runtimeArgs.GetNamelinkOnly() || - objectArgs.GetNamelinkOnly() || frameworkArgs.GetNamelinkOnly() || - bundleArgs.GetNamelinkOnly() || privateHeaderArgs.GetNamelinkOnly() || + if (runtimeArgs.GetNamelinkOnly() || objectArgs.GetNamelinkOnly() || + frameworkArgs.GetNamelinkOnly() || bundleArgs.GetNamelinkOnly() || + privateHeaderArgs.GetNamelinkOnly() || publicHeaderArgs.GetNamelinkOnly() || resourceArgs.GetNamelinkOnly() || std::any_of(fileSetArgs.begin(), fileSetArgs.end(), [](const cmInstallCommandFileSetArguments& fileSetArg) -> bool { return fileSetArg.GetNamelinkOnly(); }) || cxxModuleBmiArgs.GetNamelinkOnly()) { status.SetError( - "TARGETS given NAMELINK_ONLY option not in LIBRARY group. " - "The NAMELINK_ONLY option may be specified only following LIBRARY."); + "TARGETS given NAMELINK_ONLY option not in LIBRARY or ARCHIVE group. " + "The NAMELINK_ONLY option may be specified only following LIBRARY or " + "ARCHIVE."); return false; } - if (archiveArgs.GetNamelinkSkip() || runtimeArgs.GetNamelinkSkip() || - objectArgs.GetNamelinkSkip() || frameworkArgs.GetNamelinkSkip() || - bundleArgs.GetNamelinkSkip() || privateHeaderArgs.GetNamelinkSkip() || + if (runtimeArgs.GetNamelinkSkip() || objectArgs.GetNamelinkSkip() || + frameworkArgs.GetNamelinkSkip() || bundleArgs.GetNamelinkSkip() || + privateHeaderArgs.GetNamelinkSkip() || publicHeaderArgs.GetNamelinkSkip() || resourceArgs.GetNamelinkSkip() || std::any_of(fileSetArgs.begin(), fileSetArgs.end(), [](const cmInstallCommandFileSetArguments& fileSetArg) -> bool { return fileSetArg.GetNamelinkSkip(); }) || cxxModuleBmiArgs.GetNamelinkSkip()) { status.SetError( - "TARGETS given NAMELINK_SKIP option not in LIBRARY group. " - "The NAMELINK_SKIP option may be specified only following LIBRARY."); + "TARGETS given NAMELINK_SKIP option not in LIBRARY or ARCHIVE group. " + "The NAMELINK_SKIP option may be specified only following LIBRARY or " + "ARCHIVE."); return false; } - if (archiveArgs.HasNamelinkComponent() || - runtimeArgs.HasNamelinkComponent() || + if (runtimeArgs.HasNamelinkComponent() || objectArgs.HasNamelinkComponent() || frameworkArgs.HasNamelinkComponent() || bundleArgs.HasNamelinkComponent() || @@ -592,9 +593,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args, -> bool { return fileSetArg.HasNamelinkComponent(); }) || cxxModuleBmiArgs.HasNamelinkComponent()) { status.SetError( - "TARGETS given NAMELINK_COMPONENT option not in LIBRARY group. " - "The NAMELINK_COMPONENT option may be specified only following " - "LIBRARY."); + "TARGETS given NAMELINK_COMPONENT option not in LIBRARY or ARCHIVE " + "group. The NAMELINK_COMPONENT option may be specified only following " + "LIBRARY or ARCHIVE."); return false; } if (libraryArgs.GetNamelinkOnly() && libraryArgs.GetNamelinkSkip()) { @@ -674,6 +675,14 @@ bool HandleTargetsMode(std::vector<std::string> const& args, } else if (libraryArgs.GetNamelinkSkip()) { namelinkMode = cmInstallTargetGenerator::NamelinkModeSkip; } + // Select the mode for installing symlinks to versioned imported libraries. + cmInstallTargetGenerator::NamelinkModeType importlinkMode = + cmInstallTargetGenerator::NamelinkModeNone; + if (archiveArgs.GetNamelinkOnly()) { + importlinkMode = cmInstallTargetGenerator::NamelinkModeOnly; + } else if (archiveArgs.GetNamelinkSkip()) { + importlinkMode = cmInstallTargetGenerator::NamelinkModeSkip; + } // Check if there is something to do. if (targetList.empty()) { @@ -725,6 +734,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, bool installsArchive = false; bool installsLibrary = false; bool installsNamelink = false; + bool installsImportlink = false; bool installsRuntime = false; bool installsObject = false; bool installsFramework = false; @@ -742,6 +752,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, std::unique_ptr<cmInstallTargetGenerator> archiveGenerator; std::unique_ptr<cmInstallTargetGenerator> libraryGenerator; std::unique_ptr<cmInstallTargetGenerator> namelinkGenerator; + std::unique_ptr<cmInstallTargetGenerator> importlinkGenerator; std::unique_ptr<cmInstallTargetGenerator> runtimeGenerator; std::unique_ptr<cmInstallTargetGenerator> objectGenerator; std::unique_ptr<cmInstallTargetGenerator> frameworkGenerator; @@ -885,6 +896,32 @@ bool HandleTargetsMode(std::vector<std::string> const& args, } namelinkOnly = (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly); + + if (target.GetMakefile()->PlatformSupportsAppleTextStubs() && + target.IsSharedLibraryWithExports()) { + // Apple .tbd files use the ARCHIVE properties + if (!archiveArgs.GetDestination().empty()) { + artifactsSpecified = true; + } + if (importlinkMode != + cmInstallTargetGenerator::NamelinkModeOnly) { + archiveGenerator = CreateInstallTargetGenerator( + target, archiveArgs, true, helper.Makefile->GetBacktrace(), + helper.GetLibraryDestination(&archiveArgs)); + archiveGenerator->SetImportlinkMode( + cmInstallTargetGenerator::NamelinkModeSkip); + } + if (importlinkMode != + cmInstallTargetGenerator::NamelinkModeSkip) { + importlinkGenerator = CreateInstallTargetGenerator( + target, archiveArgs, true, helper.Makefile->GetBacktrace(), + helper.GetLibraryDestination(&archiveArgs), false, true); + importlinkGenerator->SetImportlinkMode( + cmInstallTargetGenerator::NamelinkModeOnly); + } + namelinkOnly = + (importlinkMode == cmInstallTargetGenerator::NamelinkModeOnly); + } } if (runtimeDependencySet && libraryGenerator) { runtimeDependencySet->AddLibrary(libraryGenerator.get()); @@ -1157,6 +1194,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, installsArchive = installsArchive || archiveGenerator; installsLibrary = installsLibrary || libraryGenerator; installsNamelink = installsNamelink || namelinkGenerator; + installsImportlink = installsImportlink || importlinkGenerator; installsRuntime = installsRuntime || runtimeGenerator; installsObject = installsObject || objectGenerator; installsFramework = installsFramework || frameworkGenerator; @@ -1169,6 +1207,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, helper.Makefile->AddInstallGenerator(std::move(archiveGenerator)); helper.Makefile->AddInstallGenerator(std::move(libraryGenerator)); helper.Makefile->AddInstallGenerator(std::move(namelinkGenerator)); + helper.Makefile->AddInstallGenerator(std::move(importlinkGenerator)); helper.Makefile->AddInstallGenerator(std::move(runtimeGenerator)); helper.Makefile->AddInstallGenerator(std::move(objectGenerator)); helper.Makefile->AddInstallGenerator(std::move(frameworkGenerator)); @@ -1203,6 +1242,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args, helper.Makefile->GetGlobalGenerator()->AddInstallComponent( libraryArgs.GetNamelinkComponent()); } + if (installsImportlink) { + helper.Makefile->GetGlobalGenerator()->AddInstallComponent( + archiveArgs.GetNamelinkComponent()); + } if (installsRuntime) { helper.Makefile->GetGlobalGenerator()->AddInstallComponent( runtimeArgs.GetComponent()); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 16c5002..6c31da6 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -4,12 +4,15 @@ #include <algorithm> #include <cassert> +#include <functional> #include <map> #include <set> #include <sstream> #include <utility> #include <vector> +#include <cm/optional> + #include "cmComputeLinkInformation.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -40,6 +43,84 @@ std::string computeInstallObjectDir(cmGeneratorTarget* gt, objectDir += gt->GetName(); return objectDir; } + +void computeFilesToInstall( + cmInstallTargetGenerator::Files& files, + cmInstallTargetGenerator::NamelinkModeType namelinkMode, + std::string const& fromDirConfig, std::string const& output, + std::string const& library, std::string const& real, + cm::optional<std::function<void(std::string const&)>> GNUToMS = cm::nullopt) +{ + bool haveNamelink = false; + auto convert = [&GNUToMS](std::string const& file) { + if (GNUToMS) { + (*GNUToMS)(file); + } + }; + + // Library link name. + std::string fromName = cmStrCat(fromDirConfig, output); + std::string toName = output; + + // Library interface name. + std::string fromSOName; + std::string toSOName; + if (library != output) { + haveNamelink = true; + fromSOName = cmStrCat(fromDirConfig, library); + toSOName = library; + } + + // Library implementation name. + std::string fromRealName; + std::string toRealName; + if (real != output && real != library) { + haveNamelink = true; + fromRealName = cmStrCat(fromDirConfig, real); + toRealName = real; + } + + // Add the names based on the current namelink mode. + if (haveNamelink) { + files.NamelinkMode = namelinkMode; + // With a namelink we need to check the mode. + if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + // Install the namelink only. + files.From.emplace_back(fromName); + files.To.emplace_back(toName); + convert(output); + } else { + // Install the real file if it has its own name. + if (!fromRealName.empty()) { + files.From.emplace_back(fromRealName); + files.To.emplace_back(toRealName); + convert(real); + } + + // Install the soname link if it has its own name. + if (!fromSOName.empty()) { + files.From.emplace_back(fromSOName); + files.To.emplace_back(toSOName); + convert(library); + } + + // Install the namelink if it is not to be skipped. + if (namelinkMode != cmInstallTargetGenerator::NamelinkModeSkip) { + files.From.emplace_back(fromName); + files.To.emplace_back(toName); + convert(output); + } + } + } else { + // Without a namelink there will be only one file. Install it + // if this is not a namelink-only rule. + if (namelinkMode != cmInstallTargetGenerator::NamelinkModeOnly) { + files.From.emplace_back(fromName); + files.To.emplace_back(toName); + convert(output); + } + } +} } cmInstallTargetGenerator::cmInstallTargetGenerator( @@ -56,6 +137,7 @@ cmInstallTargetGenerator::cmInstallTargetGenerator( { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; + this->ImportlinkMode = NamelinkModeNone; } cmInstallTargetGenerator::~cmInstallTargetGenerator() = default; @@ -247,18 +329,21 @@ cmInstallTargetGenerator::Files cmInstallTargetGenerator::GetFiles( this->Target->GetLibraryNames(config); if (this->ImportLibrary) { // There is a bug in cmInstallCommand if this fails. - assert(this->NamelinkMode == NamelinkModeNone); + assert(this->Target->Makefile->PlatformSupportsAppleTextStubs() || + this->ImportlinkMode == NamelinkModeNone); + + auto GNUToMS = [this, &config, &files, + &fromDirConfig](const std::string& lib) { + std::string importLib; + if (this->Target->GetImplibGNUtoMS(config, lib, importLib)) { + files.From.emplace_back(fromDirConfig + importLib); + files.To.emplace_back(importLib); + } + }; - std::string from1 = fromDirConfig + targetNames.ImportLibrary; - std::string to1 = targetNames.ImportLibrary; - files.From.emplace_back(std::move(from1)); - files.To.emplace_back(std::move(to1)); - std::string targetNameImportLib; - if (this->Target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, - targetNameImportLib)) { - files.From.emplace_back(fromDirConfig + targetNameImportLib); - files.To.emplace_back(targetNameImportLib); - } + computeFilesToInstall( + files, this->ImportlinkMode, fromDirConfig, targetNames.ImportOutput, + targetNames.ImportLibrary, targetNames.ImportReal, GNUToMS); // An import library looks like a static library. files.Type = cmInstallType_STATIC_LIBRARY; @@ -318,66 +403,9 @@ cmInstallTargetGenerator::Files cmInstallTargetGenerator::GetFiles( files.From.emplace_back(std::move(from1)); files.To.emplace_back(std::move(to1)); } else { - bool haveNamelink = false; - - // Library link name. - std::string fromName = fromDirConfig + targetNames.Output; - std::string toName = targetNames.Output; - - // Library interface name. - std::string fromSOName; - std::string toSOName; - if (targetNames.SharedObject != targetNames.Output) { - haveNamelink = true; - fromSOName = fromDirConfig + targetNames.SharedObject; - toSOName = targetNames.SharedObject; - } - - // Library implementation name. - std::string fromRealName; - std::string toRealName; - if (targetNames.Real != targetNames.Output && - targetNames.Real != targetNames.SharedObject) { - haveNamelink = true; - fromRealName = fromDirConfig + targetNames.Real; - toRealName = targetNames.Real; - } - - // Add the names based on the current namelink mode. - if (haveNamelink) { - files.NamelinkMode = this->NamelinkMode; - // With a namelink we need to check the mode. - if (this->NamelinkMode == NamelinkModeOnly) { - // Install the namelink only. - files.From.emplace_back(fromName); - files.To.emplace_back(toName); - } else { - // Install the real file if it has its own name. - if (!fromRealName.empty()) { - files.From.emplace_back(fromRealName); - files.To.emplace_back(toRealName); - } - - // Install the soname link if it has its own name. - if (!fromSOName.empty()) { - files.From.emplace_back(fromSOName); - files.To.emplace_back(toSOName); - } - - // Install the namelink if it is not to be skipped. - if (this->NamelinkMode != NamelinkModeSkip) { - files.From.emplace_back(fromName); - files.To.emplace_back(toName); - } - } - } else { - // Without a namelink there will be only one file. Install it - // if this is not a namelink-only rule. - if (this->NamelinkMode != NamelinkModeOnly) { - files.From.emplace_back(fromName); - files.To.emplace_back(toName); - } - } + computeFilesToInstall(files, this->NamelinkMode, fromDirConfig, + targetNames.Output, targetNames.SharedObject, + targetNames.Real); } } @@ -425,6 +453,12 @@ std::string cmInstallTargetGenerator::GetInstallFilename( "${CMAKE_IMPORT_LIBRARY_SUFFIX}")) { fname = targetNames.ImportLibrary; } + } else if (nameType == NameImplibReal) { + // Use the import library name. + if (!target->GetImplibGNUtoMS(config, targetNames.ImportReal, fname, + "${CMAKE_IMPORT_LIBRARY_SUFFIX}")) { + fname = targetNames.ImportReal; + } } else if (nameType == NameReal) { // Use the canonical name. fname = targetNames.Real; @@ -434,11 +468,14 @@ std::string cmInstallTargetGenerator::GetInstallFilename( } } else { cmGeneratorTarget::Names targetNames = target->GetLibraryNames(config); - if (nameType == NameImplib) { + if (nameType == NameImplib || nameType == NameImplibReal) { + const auto& importName = nameType == NameImplib + ? targetNames.ImportLibrary + : targetNames.ImportReal; // Use the import library name. - if (!target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, fname, + if (!target->GetImplibGNUtoMS(config, importName, fname, "${CMAKE_IMPORT_LIBRARY_SUFFIX}")) { - fname = targetNames.ImportLibrary; + fname = importName; } } else if (nameType == NameSO) { // Use the soname. @@ -784,7 +821,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent, } // Don't handle OSX Bundles. - if (this->Target->Target->GetMakefile()->IsOn("APPLE") && + if (this->Target->IsApple() && this->Target->GetPropertyAsBool("MACOSX_BUNDLE")) { return; } @@ -796,7 +833,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent, std::string stripArgs; // macOS 'strip' is picky, executables need '-u -r' and dylibs need '-x'. - if (this->Target->Target->GetMakefile()->IsOn("APPLE")) { + if (this->Target->IsApple()) { if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY || this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) { stripArgs = "-x "; @@ -822,7 +859,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent, // Perform post-installation processing on the file depending // on its type. - if (!this->Target->Target->GetMakefile()->IsOn("APPLE")) { + if (!this->Target->IsApple()) { return; } diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 3fc4b59..2f41163 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -39,6 +39,10 @@ public: NamelinkModeSkip }; void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; } + void SetImportlinkMode(NamelinkModeType mode) + { + this->ImportlinkMode = mode; + } std::string GetInstallFilename(const std::string& config) const; @@ -50,7 +54,8 @@ public: NameNormal, NameImplib, NameSO, - NameReal + NameReal, + NameImplibReal }; static std::string GetInstallFilename(const cmGeneratorTarget* target, @@ -121,6 +126,7 @@ protected: cmGeneratorTarget* Target = nullptr; std::string const FilePermissions; NamelinkModeType NamelinkMode; + NamelinkModeType ImportlinkMode; bool const ImportLibrary; bool const Optional; }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c2138ee..bd7eb3f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -85,6 +85,7 @@ static auto ruleReplaceVars = { "CMAKE_${LANG}_COMPILER", "CMAKE_RANLIB", "CMAKE_LINKER", "CMAKE_MT", + "CMAKE_TAPI", "CMAKE_CUDA_HOST_COMPILER", "CMAKE_CUDA_HOST_LINK_LAUNCHER", "CMAKE_CL_SHOWINCLUDES_PREFIX" }; @@ -134,6 +135,13 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile) this->LinkerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); } + // OSX SYSROOT can be required by some tools, like tapi + { + cmValue osxSysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); + this->VariableMappings["CMAKE_OSX_SYSROOT"] = + osxSysroot.IsEmpty() ? "/" : this->EscapeForShell(*osxSysroot, true); + } + if (cmValue appleArchSysroots = this->Makefile->GetDefinition("CMAKE_APPLE_ARCH_SYSROOTS")) { std::string const& appleArchs = @@ -1644,7 +1652,7 @@ static std::string GetFrameworkFlags(const std::string& lang, cmLocalGenerator* lg = target->GetLocalGenerator(); cmMakefile* mf = lg->GetMakefile(); - if (!mf->IsOn("APPLE")) { + if (!target->IsApple()) { return std::string(); } @@ -1818,7 +1826,7 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( // OLD behavior is to always add the flags, except on AIX where // we compute symbol exports if ENABLE_EXPORTS is on. add_shlib_flags = - !(tgt.Target->IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS")); + !(tgt.IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS")); break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: @@ -1830,7 +1838,7 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( // NEW behavior is to only add the flags if ENABLE_EXPORTS is on, // except on AIX where we compute symbol exports. add_shlib_flags = - !tgt.Target->IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS"); + !tgt.IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS"); break; } @@ -1864,7 +1872,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, const std::string& filterArch) { // Only add Apple specific flags on Apple platforms - if (this->Makefile->IsOn("APPLE") && this->EmitUniversalBinaryFlags) { + if (target->IsApple() && this->EmitUniversalBinaryFlags) { std::vector<std::string> archs; target->GetAppleArchs(config, archs); if (!archs.empty() && diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2fc2974..3fcc7f7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1229,7 +1229,7 @@ void cmMakefile::AddCustomCommandOldStyle( // Each output must get its own copy of this rule. cmsys::RegularExpression sourceFiles( - "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|ixx|cppm|cu|m|mm|" + "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|ixx|cppm|ccm|cxxm|c\\+\\+m|cu|m|mm|" "rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|" "hm|hpp|hxx|in|txx|inl)$"); @@ -2493,6 +2493,11 @@ bool cmMakefile::PlatformIsAppleEmbedded() const return this->GetAppleSDKType() != AppleSDK::MacOS; } +bool cmMakefile::PlatformSupportsAppleTextStubs() const +{ + return this->IsOn("APPLE") && this->IsSet("CMAKE_TAPI"); +} + const char* cmMakefile::GetSONameFlag(const std::string& language) const { std::string name = "CMAKE_SHARED_LIBRARY_SONAME"; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 3cf6e61..6f04937 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -562,6 +562,10 @@ public: /** Return whether the target platform is Apple iOS. */ bool PlatformIsAppleEmbedded() const; + /** Return whether the target platform supports generation of text base stubs + (.tbd file) describing exports (Apple specific). */ + bool PlatformSupportsAppleTextStubs() const; + /** Retrieve soname flag for the specified language if supported */ const char* GetSONameFlag(const std::string& language) const; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 41daa5a..1960073 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -185,14 +185,15 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule( std::string linkLibs; this->CreateLinkLibs( linkLineComputer.get(), linkLibs, useResponseFileForLibs, depends, - cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink); + linkLanguage, cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink); // Construct object file lists that may be needed to expand the // rule. std::string buildObjs; this->CreateObjectLists( useLinkScript, false, useResponseFileForObjects, buildObjs, depends, - false, cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink); + false, linkLanguage, + cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink); cmRulePlaceholderExpander::RuleVariables vars; std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); @@ -503,13 +504,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Collect up flags to link in needed libraries. std::string linkLibs; this->CreateLinkLibs(linkLineComputer.get(), linkLibs, - useResponseFileForLibs, depends); + useResponseFileForLibs, depends, linkLanguage); // Construct object file lists that may be needed to expand the // rule. std::string buildObjs; this->CreateObjectLists(useLinkScript, false, useResponseFileForObjects, - buildObjs, depends, useWatcomQuote); + buildObjs, depends, useWatcomQuote, linkLanguage); if (!this->DeviceLinkObject.empty()) { buildObjs += " " + this->LocalGenerator->ConvertToOutputFormat( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index cb567ff..3e4a08e 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -327,14 +327,14 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules( this->CreateLinkLibs( linkLineComputer.get(), linkLibs, useResponseFileForLibs, depends, - cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink); + linkLanguage, cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink); // Construct object file lists that may be needed to expand the // rule. std::string buildObjs; this->CreateObjectLists( useLinkScript, false, // useArchiveRules - useResponseFileForObjects, buildObjs, depends, false, + useResponseFileForObjects, buildObjs, depends, false, linkLanguage, cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); @@ -465,9 +465,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string outpathImp; if (this->GeneratorTarget->IsFrameworkOnApple()) { outpath = this->GeneratorTarget->GetDirectory(this->GetConfigName()); + cmOSXBundleGenerator::SkipParts bundleSkipParts; + if (this->GeneratorTarget->HasImportLibrary(this->GetConfigName())) { + bundleSkipParts.TextStubs = false; + } this->OSXBundleGenerator->CreateFramework(this->TargetNames.Output, - outpath, this->GetConfigName()); + outpath, this->GetConfigName(), + bundleSkipParts); outpath += '/'; + if (!this->TargetNames.ImportLibrary.empty()) { + outpathImp = this->GeneratorTarget->GetDirectory( + this->GetConfigName(), cmStateEnums::ImportLibraryArtifact); + cmSystemTools::MakeDirectory(outpathImp); + outpathImp += '/'; + } } else if (this->GeneratorTarget->IsCFBundleOnApple()) { outpath = this->GeneratorTarget->GetDirectory(this->GetConfigName()); this->OSXBundleGenerator->CreateCFBundle(this->TargetNames.Output, outpath, @@ -679,11 +690,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } // Expand the rule variables. + std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( + this->LocalGenerator->CreateRulePlaceholderExpander()); + bool useWatcomQuote = + this->Makefile->IsOn(linkRuleVar + "_USE_WATCOM_QUOTE"); std::vector<std::string> real_link_commands; { - bool useWatcomQuote = - this->Makefile->IsOn(linkRuleVar + "_USE_WATCOM_QUOTE"); - // Set path conversion for link script shells. this->LocalGenerator->SetLinkScriptShell(useLinkScript); @@ -700,7 +712,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( linkLineComputer->SetRelink(relink); this->CreateLinkLibs(linkLineComputer.get(), linkLibs, - useResponseFileForLibs, depends); + useResponseFileForLibs, depends, linkLanguage); } // Construct object file lists that may be needed to expand the @@ -708,7 +720,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string buildObjs; this->CreateObjectLists(useLinkScript, useArchiveRules, useResponseFileForObjects, buildObjs, depends, - useWatcomQuote); + useWatcomQuote, linkLanguage); if (!this->DeviceLinkObject.empty()) { buildObjs += " " + this->LocalGenerator->ConvertToOutputFormat( @@ -816,8 +828,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( launcher = cmStrCat(val, ' '); } - std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( - this->LocalGenerator->CreateRulePlaceholderExpander()); // Construct the main link rule and expand placeholders. rulePlaceholderExpander->SetTargetImpLib(targetOutPathImport); if (useArchiveRules) { @@ -950,6 +960,86 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( this->WriteMakeRule(*this->BuildFileStream, nullptr, outputs, depends, commands, false); + // Add rule to generate text-based stubs, if required + if (this->GeneratorTarget->IsApple() && + this->GeneratorTarget->HasImportLibrary(this->GetConfigName())) { + auto genStubsRule = + this->Makefile->GetDefinition("CMAKE_CREATE_TEXT_STUBS"); + auto genStubs_commands = cmExpandedList(genStubsRule); + + std::string TBDFullPath = + cmStrCat(outpathImp, this->TargetNames.ImportOutput); + std::string TBDFullPathReal = + cmStrCat(outpathImp, this->TargetNames.ImportReal); + std::string TBDFullPathSO = + cmStrCat(outpathImp, this->TargetNames.ImportLibrary); + + // Expand placeholders. + cmRulePlaceholderExpander::RuleVariables vars; + std::string target = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->MaybeRelativeToCurBinDir(targetFullPathReal), + cmOutputConverter::SHELL, useWatcomQuote); + vars.Target = target.c_str(); + std::string TBDOutPathReal = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->MaybeRelativeToCurBinDir(TBDFullPathReal), + cmOutputConverter::SHELL, useWatcomQuote); + rulePlaceholderExpander->SetTargetImpLib(TBDOutPathReal); + for (std::string& command : genStubs_commands) { + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, + command, vars); + } + outputs.clear(); + outputs.push_back(TBDFullPathReal); + if (this->TargetNames.ImportLibrary != this->TargetNames.ImportReal) { + outputs.push_back(TBDFullPathSO); + } + if (this->TargetNames.ImportOutput != this->TargetNames.ImportLibrary && + this->TargetNames.ImportOutput != this->TargetNames.ImportReal) { + outputs.push_back(TBDFullPath); + } + this->ExtraFiles.insert(TBDFullPath); + + depends.clear(); + depends.push_back(targetFullPathReal); + + // Add a rule to create necessary symlinks for the library. + // Frameworks are handled by cmOSXBundleGenerator. + if (TBDFullPath != TBDFullPathReal && + !this->GeneratorTarget->IsFrameworkOnApple()) { + auto TBDOutPathSO = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->MaybeRelativeToCurBinDir(TBDFullPathSO), + cmOutputConverter::SHELL, useWatcomQuote); + auto TBDOutPath = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->MaybeRelativeToCurBinDir(TBDFullPath), + cmOutputConverter::SHELL, useWatcomQuote); + + std::string symlink = + cmStrCat("$(CMAKE_COMMAND) -E cmake_symlink_library ", TBDOutPathReal, + ' ', TBDOutPathSO, ' ', TBDOutPath); + commands1.push_back(std::move(symlink)); + this->LocalGenerator->CreateCDCommand( + commands1, this->Makefile->GetCurrentBinaryDirectory(), + this->LocalGenerator->GetBinaryDirectory()); + cm::append(genStubs_commands, commands1); + commands1.clear(); + } + + this->WriteMakeRule(*this->BuildFileStream, nullptr, outputs, depends, + genStubs_commands, false); + + // clean actions for apple specific outputs + // clean actions for ImportLibrary are already specified + if (this->TargetNames.ImportReal != this->TargetNames.ImportLibrary) { + libCleanFiles.insert( + this->LocalGenerator->MaybeRelativeToCurBinDir(TBDFullPathReal)); + } + if (this->TargetNames.ImportOutput != this->TargetNames.ImportReal && + this->TargetNames.ImportOutput != this->TargetNames.ImportLibrary) { + libCleanFiles.insert( + this->LocalGenerator->MaybeRelativeToCurBinDir(TBDFullPath)); + } + } + // Write the main driver rule to build everything in this target. this->WriteTargetDriverRule(targetFullPath, relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 915a412..2ead739 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -2189,16 +2189,16 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries( std::string cmMakefileTargetGenerator::CreateResponseFile( const std::string& name, std::string const& options, - std::vector<std::string>& makefile_depends) + std::vector<std::string>& makefile_depends, std::string const& language) { // FIXME: Find a better way to determine the response file encoding, // perhaps using tool-specific platform information variables. // For now, use the makefile encoding as a heuristic. codecvt::Encoding responseEncoding = this->GlobalGenerator->GetMakefileEncoding(); - // Non-MSVC tooling may not understand a BOM. + // Non-MSVC tooling doesn't understand BOM encoded files. if (responseEncoding == codecvt::UTF8_WITH_BOM && - !this->Makefile->IsOn("MSVC")) { + (language == "CUDA" || !this->Makefile->IsOn("MSVC"))) { responseEncoding = codecvt::UTF8; } @@ -2235,7 +2235,7 @@ cmMakefileTargetGenerator::CreateLinkLineComputer( void cmMakefileTargetGenerator::CreateLinkLibs( cmLinkLineComputer* linkLineComputer, std::string& linkLibs, bool useResponseFile, std::vector<std::string>& makefile_depends, - ResponseFlagFor responseMode) + std::string const& linkLanguage, ResponseFlagFor responseMode) { std::string frameworkPath; std::string linkPath; @@ -2253,8 +2253,9 @@ void cmMakefileTargetGenerator::CreateLinkLibs( // Create this response file. std::string responseFileName = (responseMode == Link) ? "linkLibs.rsp" : "deviceLinkLibs.rsp"; - std::string link_rsp = - this->CreateResponseFile(responseFileName, linkLibs, makefile_depends); + std::string responseLang = (responseMode == Link) ? linkLanguage : "CUDA"; + std::string link_rsp = this->CreateResponseFile( + responseFileName, linkLibs, makefile_depends, responseLang); // Reference the response file. linkLibs = cmStrCat(responseFlag, @@ -2266,7 +2267,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs( void cmMakefileTargetGenerator::CreateObjectLists( bool useLinkScript, bool useArchiveRules, bool useResponseFile, std::string& buildObjs, std::vector<std::string>& makefile_depends, - bool useWatcomQuote, ResponseFlagFor responseMode) + bool useWatcomQuote, std::string const& linkLanguage, + ResponseFlagFor responseMode) { std::string variableName; std::string variableNameExternal; @@ -2295,7 +2297,7 @@ void cmMakefileTargetGenerator::CreateObjectLists( // Create this response file. std::string objects_rsp = this->CreateResponseFile( - responseFileName, object_strings[i], makefile_depends); + responseFileName, object_strings[i], makefile_depends, linkLanguage); // Separate from previous response file references. buildObjs += sep; @@ -2347,8 +2349,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, } std::string name = cmStrCat("includes_", lang, ".rsp"); std::string arg = std::move(responseFlag) + - this->CreateResponseFile(name, includeFlags, - this->FlagFileDepends[lang]); + this->CreateResponseFile(name, includeFlags, this->FlagFileDepends[lang], + lang); this->LocalGenerator->AppendFlags(flags, arg); } else { this->LocalGenerator->AppendFlags(flags, includeFlags); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 5d614fe..98c3a0e 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -160,7 +160,8 @@ protected: response file name. */ std::string CreateResponseFile(const std::string& name, std::string const& options, - std::vector<std::string>& makefile_depends); + std::vector<std::string>& makefile_depends, + std::string const& language); bool CheckUseResponseFileForObjects(std::string const& l) const; bool CheckUseResponseFileForLibraries(std::string const& l) const; @@ -175,13 +176,14 @@ protected: void CreateLinkLibs(cmLinkLineComputer* linkLineComputer, std::string& linkLibs, bool useResponseFile, std::vector<std::string>& makefile_depends, + std::string const& linkLanguage, ResponseFlagFor responseMode = ResponseFlagFor::Link); /** Create lists of object files for linking and cleaning. */ void CreateObjectLists(bool useLinkScript, bool useArchiveRules, bool useResponseFile, std::string& buildObjs, std::vector<std::string>& makefile_depends, - bool useWatcomQuote, + bool useWatcomQuote, std::string const& linkLanguage, ResponseFlagFor responseMode = ResponseFlagFor::Link); /** Add commands for generate def files */ diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 45a4dda..4d68460 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -204,6 +204,15 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerCudaFatbinaryRule( '_', config); } +std::string cmNinjaNormalTargetGenerator::TextStubsGeneratorRule( + const std::string& config) const +{ + return cmStrCat( + "TEXT_STUBS_GENERATOR__", + cmGlobalNinjaGenerator::EncodeRuleName(this->GeneratorTarget->GetName()), + '_', config); +} + struct cmNinjaRemoveNoOpCommands { bool operator()(std::string const& cmd) @@ -527,6 +536,45 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile, this->GetGlobalGenerator()->AddRule(rule); } } + + if (this->GetGeneratorTarget()->IsApple() && + this->GetGeneratorTarget()->HasImportLibrary(config)) { + cmNinjaRule rule(this->TextStubsGeneratorRule(config)); + rule.Comment = cmStrCat("Rule for generating text-based stubs for ", + this->GetVisibleTypeName(), '.'); + rule.Description = "Creating text-based stubs $out"; + + std::string cmd = + this->GetMakefile()->GetDefinition("CMAKE_CREATE_TEXT_STUBS"); + std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( + this->GetLocalGenerator()->CreateRulePlaceholderExpander()); + cmRulePlaceholderExpander::RuleVariables vars; + vars.Target = "$in"; + rulePlaceholderExpander->SetTargetImpLib("$out"); + rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), + cmd, vars); + + rule.Command = + this->GetLocalGenerator()->BuildCommandLine({ cmd }, config, config); + this->GetGlobalGenerator()->AddRule(rule); + + if (tgtNames.ImportOutput != tgtNames.ImportReal && + !this->GetGeneratorTarget()->IsFrameworkOnApple()) { + cmNinjaRule slRule("CMAKE_SYMLINK_IMPORT_LIBRARY"); + { + std::string cmakeCommand = + this->GetLocalGenerator()->ConvertToOutputFormat( + cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); + std::string slCmd = + cmStrCat(cmakeCommand, " -E cmake_symlink_library $in $SONAME $out"); + slRule.Command = this->GetLocalGenerator()->BuildCommandLine( + { slCmd }, config, config); + } + slRule.Description = "Creating import library symlink $out"; + slRule.Comment = "Rule for creating import library symlink."; + this->GetGlobalGenerator()->AddRule(slRule); + } + } } std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd() @@ -1030,9 +1078,12 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( // the current configuration has a postfix. The non-postfix configuration // Info.plist can be used by all the other configurations. if (!postFix.empty()) { - bundleSkipParts.infoPlist = true; + bundleSkipParts.InfoPlist = true; } } + if (gt->HasImportLibrary(config)) { + bundleSkipParts.TextStubs = false; + } this->OSXBundleGenerator->CreateFramework( tgtNames.Output, gt->GetDirectory(config), config, bundleSkipParts); @@ -1214,7 +1265,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( cmGlobalNinjaGenerator::CCOutputs byproducts(this->GetGlobalGenerator()); - if (!tgtNames.ImportLibrary.empty()) { + if (!gt->IsApple() && !tgtNames.ImportLibrary.empty()) { const std::string impLibPath = localGen.ConvertToOutputFormat( targetOutputImplib, cmOutputConverter::SHELL); vars["TARGET_IMPLIB"] = impLibPath; @@ -1471,6 +1522,55 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( // Add aliases for the file name and the target name. globalGen->AddTargetAlias(tgtNames.Output, gt, config); globalGen->AddTargetAlias(this->GetTargetName(), gt, config); + + if (this->GetGeneratorTarget()->IsApple() && + this->GetGeneratorTarget()->HasImportLibrary(config)) { + auto dirTBD = + gt->GetDirectory(config, cmStateEnums::ImportLibraryArtifact); + auto targetTBD = + this->ConvertToNinjaPath(cmStrCat(dirTBD, '/', tgtNames.ImportReal)); + this->EnsureParentDirectoryExists(targetTBD); + cmNinjaBuild build(this->TextStubsGeneratorRule(config)); + build.Comment = cmStrCat("Generate the text-based stubs file ", targetTBD); + build.Outputs.push_back(targetTBD); + build.ExplicitDeps.push_back(targetOutputReal); + globalGen->WriteBuild(this->GetImplFileStream(fileConfig), build); + + if (tgtNames.ImportOutput != tgtNames.ImportReal && + !this->GetGeneratorTarget()->IsFrameworkOnApple()) { + auto outputTBD = + this->ConvertToNinjaPath(cmStrCat(dirTBD, '/', tgtNames.ImportOutput)); + std::string const soNameTBD = this->ConvertToNinjaPath( + cmStrCat(dirTBD, '/', tgtNames.ImportLibrary)); + + cmNinjaBuild slBuild("CMAKE_SYMLINK_IMPORT_LIBRARY"); + slBuild.Comment = cmStrCat("Create import library symlink ", outputTBD); + cmNinjaVars slVars; + + // If one link has to be created. + if (targetTBD == soNameTBD || outputTBD == soNameTBD) { + slVars["SONAME"] = this->GetLocalGenerator()->ConvertToOutputFormat( + soNameTBD, cmOutputConverter::SHELL); + } else { + slVars["SONAME"].clear(); + slBuild.Outputs.push_back(soNameTBD); + if (firstForConfig) { + globalGen->GetByproductsForCleanTarget(config).push_back(soNameTBD); + } + } + slBuild.Outputs.push_back(outputTBD); + if (firstForConfig) { + globalGen->GetByproductsForCleanTarget(config).push_back(outputTBD); + } + slBuild.ExplicitDeps.push_back(targetTBD); + slBuild.Variables = std::move(slVars); + + globalGen->WriteBuild(this->GetImplFileStream(fileConfig), slBuild); + } + + // Add alias for the import file name + globalGen->AddTargetAlias(tgtNames.ImportOutput, gt, config); + } } void cmNinjaNormalTargetGenerator::WriteObjectLibStatement( diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h index 30127fe..85f42a4 100644 --- a/Source/cmNinjaNormalTargetGenerator.h +++ b/Source/cmNinjaNormalTargetGenerator.h @@ -25,6 +25,7 @@ private: std::string LanguageLinkerCudaDeviceCompileRule( const std::string& config) const; std::string LanguageLinkerCudaFatbinaryRule(const std::string& config) const; + std::string TextStubsGeneratorRule(const std::string& config) const; const char* GetVisibleTypeName() const; void WriteLanguagesRules(const std::string& config); diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 674735b..4301f05 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -11,6 +11,7 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmValue.h" class cmSourceFile; @@ -77,7 +78,7 @@ void cmOSXBundleGenerator::CreateFramework( std::string frameworkVersion = this->GT->GetFrameworkVersion(); std::string name = cmSystemTools::GetFilenameName(targetName); - if (!skipParts.infoPlist) { + if (!skipParts.InfoPlist) { // Configure the Info.plist file std::string plist = newoutpath; if (!this->Makefile->PlatformIsAppleEmbedded()) { @@ -120,6 +121,17 @@ void cmOSXBundleGenerator::CreateFramework( cmSystemTools::CreateSymlink(oldName, newName); this->Makefile->AddCMakeOutputFile(newName); + if (!skipParts.TextStubs) { + // foo.tbd -> Versions/Current/foo.tbd + cmValue tbdSuffix = + this->Makefile->GetDefinition("CMAKE_APPLE_IMPORT_FILE_SUFFIX"); + oldName = cmStrCat("Versions/Current/", name, tbdSuffix); + newName = cmStrCat(contentdir, name, tbdSuffix); + cmSystemTools::RemoveFile(newName); + cmSystemTools::CreateSymlink(oldName, newName); + this->Makefile->AddCMakeOutputFile(newName); + } + // Resources -> Versions/Current/Resources if (this->MacContentFolders->find("Resources") != this->MacContentFolders->end()) { diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index c33b087..38453fd 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -20,11 +20,10 @@ public: struct SkipParts { - SkipParts() - : infoPlist(false) - { - } - bool infoPlist; // NOLINT(modernize-use-default-member-init) + SkipParts() {} // NOLINT(modernize-use-equals-default) + + bool InfoPlist = false; + bool TextStubs = true; }; // create an app bundle at a given root, and return @@ -35,7 +34,7 @@ public: // create a framework at a given root void CreateFramework(const std::string& targetName, const std::string& root, const std::string& config, - const SkipParts& skipParts = SkipParts()); + const SkipParts& skipParts = SkipParts{}); // create a cf bundle at a given root void CreateCFBundle(const std::string& targetName, const std::string& root, diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 830e14b..52993b8 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -439,6 +439,11 @@ class cmMakefile; "find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \ 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3, \ + 27, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0146, "The FindCUDA module is removed.", 3, 27, 0, \ + cmPolicies::WARN) \ + SELECT(POLICY, CMP0147, \ + "Visual Studio generators build custom commands in parallel.", 3, \ 27, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) @@ -479,7 +484,9 @@ class cmMakefile; F(CMP0131) \ F(CMP0142) -#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) F(CMP0116) +#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \ + F(CMP0116) \ + F(CMP0147) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index fa9d4cc..5ff7009 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -20,8 +20,8 @@ cmRST::cmRST(std::ostream& os, std::string docroot) : OS(os) , DocRoot(std::move(docroot)) , CMakeDirective("^.. (cmake:)?(" - "command|envvar|genex|variable" - ")::[ \t]+([^ \t\n]+)$") + "command|envvar|genex|signature|variable" + ")::") , CMakeModuleDirective("^.. cmake-module::[ \t]+([^ \t\n]+)$") , ParsedLiteralDirective("^.. parsed-literal::[ \t]*(.*)$") , CodeBlockDirective("^.. code-block::[ \t]*(.*)$") @@ -126,27 +126,27 @@ void cmRST::Reset() if (!this->MarkupLines.empty()) { cmRST::UnindentLines(this->MarkupLines); } - switch (this->Directive) { - case DirectiveNone: + switch (this->DirectiveType) { + case Directive::None: break; - case DirectiveParsedLiteral: + case Directive::ParsedLiteral: this->ProcessDirectiveParsedLiteral(); break; - case DirectiveLiteralBlock: + case Directive::LiteralBlock: this->ProcessDirectiveLiteralBlock(); break; - case DirectiveCodeBlock: + case Directive::CodeBlock: this->ProcessDirectiveCodeBlock(); break; - case DirectiveReplace: + case Directive::Replace: this->ProcessDirectiveReplace(); break; - case DirectiveTocTree: + case Directive::TocTree: this->ProcessDirectiveTocTree(); break; } - this->Markup = MarkupNone; - this->Directive = DirectiveNone; + this->MarkupType = Markup::None; + this->DirectiveType = Directive::None; this->MarkupLines.clear(); } @@ -160,9 +160,9 @@ void cmRST::ProcessLine(std::string const& line) (line.size() >= 3 && line[0] == '.' && line[1] == '.' && isspace(line[2]))) { this->Reset(); - this->Markup = - (line.find_first_not_of(" \t", 2) == std::string::npos ? MarkupEmpty - : MarkupNormal); + this->MarkupType = + (line.find_first_not_of(" \t", 2) == std::string::npos ? Markup::Empty + : Markup::Normal); // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165 // NOLINTNEXTLINE(bugprone-branch-clone) if (this->CMakeDirective.find(line)) { @@ -171,33 +171,33 @@ void cmRST::ProcessLine(std::string const& line) } else if (this->CMakeModuleDirective.find(line)) { // Process cmake-module directive: scan .cmake file comments. std::string file = this->CMakeModuleDirective.match(1); - if (file.empty() || !this->ProcessInclude(file, IncludeModule)) { + if (file.empty() || !this->ProcessInclude(file, Include::Module)) { this->NormalLine(line); } } else if (this->ParsedLiteralDirective.find(line)) { // Record the literal lines to output after whole block. - this->Directive = DirectiveParsedLiteral; + this->DirectiveType = Directive::ParsedLiteral; this->MarkupLines.push_back(this->ParsedLiteralDirective.match(1)); } else if (this->CodeBlockDirective.find(line)) { // Record the literal lines to output after whole block. // Ignore the language spec and record the opening line as blank. - this->Directive = DirectiveCodeBlock; + this->DirectiveType = Directive::CodeBlock; this->MarkupLines.emplace_back(); } else if (this->ReplaceDirective.find(line)) { // Record the replace directive content. - this->Directive = DirectiveReplace; + this->DirectiveType = Directive::Replace; this->ReplaceName = this->ReplaceDirective.match(1); this->MarkupLines.push_back(this->ReplaceDirective.match(2)); } else if (this->IncludeDirective.find(line)) { // Process the include directive or output the directive and its // content normally if it fails. std::string file = this->IncludeDirective.match(1); - if (file.empty() || !this->ProcessInclude(file, IncludeNormal)) { + if (file.empty() || !this->ProcessInclude(file, Include::Normal)) { this->NormalLine(line); } } else if (this->TocTreeDirective.find(line)) { // Record the toctree entries to process after whole block. - this->Directive = DirectiveTocTree; + this->DirectiveType = Directive::TocTree; this->MarkupLines.push_back(this->TocTreeDirective.match(1)); } else if (this->ProductionListDirective.find(line)) { // Output productionlist directives and their content normally. @@ -211,14 +211,15 @@ void cmRST::ProcessLine(std::string const& line) this->NormalLine(line); } } - // An explicit markup start followed nothing but whitespace and a + // An explicit markup start followed by nothing but whitespace and a // blank line does not consume any indented text following. - else if (this->Markup == MarkupEmpty && line.empty()) { + else if (this->MarkupType == Markup::Empty && line.empty()) { this->NormalLine(line); } // Indented lines following an explicit markup start are explicit markup. - else if (this->Markup && (line.empty() || isspace(line[0]))) { - this->Markup = MarkupNormal; + else if (this->MarkupType != Markup::None && + (line.empty() || isspace(line[0]))) { + this->MarkupType = Markup::Normal; // Record markup lines if the start line was recorded. if (!this->MarkupLines.empty()) { this->MarkupLines.push_back(line); @@ -227,8 +228,8 @@ void cmRST::ProcessLine(std::string const& line) // A blank line following a paragraph ending in "::" starts a literal block. else if (lastLineEndedInColonColon && line.empty()) { // Record the literal lines to output after whole block. - this->Markup = MarkupNormal; - this->Directive = DirectiveLiteralBlock; + this->MarkupType = Markup::Normal; + this->DirectiveType = Directive::LiteralBlock; this->MarkupLines.emplace_back(); this->OutputLine("", false); } @@ -354,14 +355,14 @@ void cmRST::OutputMarkupLines(bool inlineMarkup) this->OutputLinePending = true; } -bool cmRST::ProcessInclude(std::string file, IncludeType type) +bool cmRST::ProcessInclude(std::string file, Include type) { bool found = false; if (this->IncludeDepth < 10) { cmRST r(this->OS, this->DocRoot); r.IncludeDepth = this->IncludeDepth + 1; r.OutputLinePending = this->OutputLinePending; - if (type != IncludeTocTree) { + if (type != Include::TocTree) { r.Replace = this->Replace; } if (file[0] == '/') { @@ -369,8 +370,8 @@ bool cmRST::ProcessInclude(std::string file, IncludeType type) } else { file = this->DocDir + "/" + file; } - found = r.ProcessFile(file, type == IncludeModule); - if (type != IncludeTocTree) { + found = r.ProcessFile(file, type == Include::Module); + if (type != Include::TocTree) { this->Replace = r.Replace; } this->OutputLinePending = r.OutputLinePending; @@ -408,9 +409,9 @@ void cmRST::ProcessDirectiveTocTree() if (!line.empty() && line[0] != ':') { if (this->TocTreeLink.find(line)) { std::string const& link = this->TocTreeLink.match(1); - this->ProcessInclude(link + ".rst", IncludeTocTree); + this->ProcessInclude(link + ".rst", Include::TocTree); } else { - this->ProcessInclude(line + ".rst", IncludeTocTree); + this->ProcessInclude(line + ".rst", Include::TocTree); } } } diff --git a/Source/cmRST.h b/Source/cmRST.h index ea4ef22..65a8a71 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -29,26 +29,26 @@ public: bool ProcessFile(std::string const& fname, bool isModule = false); private: - enum IncludeType + enum class Include { - IncludeNormal, - IncludeModule, - IncludeTocTree + Normal, + Module, + TocTree }; - enum MarkupType + enum class Markup { - MarkupNone, - MarkupNormal, - MarkupEmpty + None, + Normal, + Empty }; - enum DirectiveType + enum class Directive { - DirectiveNone, - DirectiveParsedLiteral, - DirectiveLiteralBlock, - DirectiveCodeBlock, - DirectiveReplace, - DirectiveTocTree + None, + ParsedLiteral, + LiteralBlock, + CodeBlock, + Replace, + TocTree }; void ProcessRST(std::istream& is); @@ -59,7 +59,7 @@ private: void OutputLine(std::string const& line, bool inlineMarkup); std::string ReplaceSubstitutions(std::string const& line); void OutputMarkupLines(bool inlineMarkup); - bool ProcessInclude(std::string file, IncludeType type); + bool ProcessInclude(std::string file, Include type); void ProcessDirectiveParsedLiteral(); void ProcessDirectiveLiteralBlock(); void ProcessDirectiveCodeBlock(); @@ -72,8 +72,8 @@ private: int IncludeDepth = 0; bool OutputLinePending = false; bool LastLineEndedInColonColon = false; - MarkupType Markup = MarkupNone; - DirectiveType Directive = DirectiveNone; + Markup MarkupType = Markup::None; + Directive DirectiveType = Directive::None; cmsys::RegularExpression CMakeDirective; cmsys::RegularExpression CMakeModuleDirective; cmsys::RegularExpression ParsedLiteralDirective; diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index c1c5201..9308af4 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -183,8 +183,8 @@ private: #define CM_HEADER_REGEX "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$" #define CM_SOURCE_REGEX \ - "\\.(C|F|M|c|c\\+\\+|cc|cpp|mpp|cxx|ixx|cppm|cu|f|f90|for|fpp|ftn|m|mm|" \ - "rc|def|r|odl|idl|hpj|bat)$" + "\\.(C|F|M|c|c\\+\\+|cc|cpp|mpp|cxx|ixx|cppm|ccm|cxxm|c\\+\\+m|cu" \ + "|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$" #define CM_PCH_REGEX "cmake_pch(_[^.]+)?\\.(h|hxx)$" diff --git a/Source/cmState.h b/Source/cmState.h index 9a17b22..0a42df0 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -253,18 +253,6 @@ public: private: friend class cmake; - void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, cmStateEnums::CacheEntryType type) - { - this->AddCacheEntry(key, - value ? cmValue(std::string(value)) : cmValue(nullptr), - helpString, type); - } - void AddCacheEntry(const std::string& key, const std::string& value, - const char* helpString, cmStateEnums::CacheEntryType type) - { - this->AddCacheEntry(key, cmValue(value), helpString, type); - } void AddCacheEntry(const std::string& key, cmValue value, const char* helpString, cmStateEnums::CacheEntryType type); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fc13560..f06e26b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -447,7 +447,7 @@ TargetProperty const StaticTargetProperties[] = { { "AUTORCC_OPTIONS"_s, IC::CanCompileSources }, // Linking properties - { "ENABLE_EXPORTS"_s, IC::ExecutableTarget }, + { "ENABLE_EXPORTS"_s, IC::TargetWithSymbolExports }, { "LINK_LIBRARIES_ONLY_TARGETS"_s, IC::NormalNonImportedTarget }, { "LINK_SEARCH_START_STATIC"_s, IC::CanCompileSources }, { "LINK_SEARCH_END_STATIC"_s, IC::CanCompileSources }, @@ -614,7 +614,6 @@ TargetProperty const StaticTargetProperties[] = { #undef COMMON_LANGUAGE_PROPERTIES #undef IC #undef R - } class cmTargetInternals @@ -631,6 +630,7 @@ public: bool HaveInstallRule; bool IsDLLPlatform; bool IsAIX; + bool IsApple; bool IsAndroid; bool BuildInterfaceIncludesAppended; bool PerConfig; @@ -917,6 +917,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->impl->HaveInstallRule = false; this->impl->IsDLLPlatform = false; this->impl->IsAIX = false; + this->impl->IsApple = false; this->impl->IsAndroid = false; this->impl->TargetVisibility = vis; this->impl->BuildInterfaceIncludesAppended = false; @@ -934,6 +935,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->impl->IsAIX = (systemName == "AIX" || systemName == "OS400"); } + // Check whether we are targeting Apple. + this->impl->IsApple = this->impl->Makefile->IsOn("APPLE"); + // Check whether we are targeting an Android platform. this->impl->IsAndroid = (this->impl->Makefile->GetSafeDefinition( "CMAKE_SYSTEM_NAME") == "Android"); @@ -1033,6 +1037,31 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, defKey += "CMAKE_"; auto initProperty = [this, mf, &defKey](const std::string& property, const char* default_value) { + // special init for ENABLE_EXPORTS + // For SHARED_LIBRARY, only CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS variable + // is used + // For EXECUTABLE, CMAKE_EXECUTABLE_ENABLE_EXPORTS or else + // CMAKE_ENABLE_EXPORTS variables are used + if (property == "ENABLE_EXPORTS"_s) { + // Replace everything after "CMAKE_" + defKey.replace( + defKey.begin() + 6, defKey.end(), + cmStrCat(this->impl->TargetType == cmStateEnums::EXECUTABLE + ? "EXECUTABLE" + : "SHARED_LIBRARY", + '_', property)); + if (cmValue value = mf->GetDefinition(defKey)) { + this->SetProperty(property, value); + return; + } + if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY) { + if (default_value) { + this->SetProperty(property, default_value); + } + return; + } + } + // Replace everything after "CMAKE_" defKey.replace(defKey.begin() + 6, defKey.end(), property); if (cmValue value = mf->GetDefinition(defKey)) { @@ -1207,18 +1236,22 @@ bool cmTarget::IsExecutableWithExports() const this->GetPropertyAsBool("ENABLE_EXPORTS")); } +bool cmTarget::IsSharedLibraryWithExports() const +{ + return (this->GetType() == cmStateEnums::SHARED_LIBRARY && + this->GetPropertyAsBool("ENABLE_EXPORTS")); +} + bool cmTarget::IsFrameworkOnApple() const { return ((this->GetType() == cmStateEnums::SHARED_LIBRARY || this->GetType() == cmStateEnums::STATIC_LIBRARY) && - this->impl->Makefile->IsOn("APPLE") && - this->GetPropertyAsBool("FRAMEWORK")); + this->IsApple() && this->GetPropertyAsBool("FRAMEWORK")); } bool cmTarget::IsAppBundleOnApple() const { - return (this->GetType() == cmStateEnums::EXECUTABLE && - this->impl->Makefile->IsOn("APPLE") && + return (this->GetType() == cmStateEnums::EXECUTABLE && this->IsApple() && this->GetPropertyAsBool("MACOSX_BUNDLE")); } @@ -1783,7 +1816,6 @@ std::string ConvertToString<cmValue>(cmValue value) { return std::string(*value); } - } template <typename ValueType> @@ -2586,6 +2618,10 @@ bool cmTarget::IsAIX() const { return this->impl->IsAIX; } +bool cmTarget::IsApple() const +{ + return this->impl->IsApple; +} bool cmTarget::IsNormal() const { @@ -2685,7 +2721,8 @@ const char* cmTarget::GetSuffixVariableInternal( case cmStateEnums::RuntimeBinaryArtifact: return "CMAKE_SHARED_LIBRARY_SUFFIX"; case cmStateEnums::ImportLibraryArtifact: - return "CMAKE_IMPORT_LIBRARY_SUFFIX"; + return this->IsApple() ? "CMAKE_APPLE_IMPORT_FILE_SUFFIX" + : "CMAKE_IMPORT_LIBRARY_SUFFIX"; } break; case cmStateEnums::MODULE_LIBRARY: @@ -2726,7 +2763,8 @@ const char* cmTarget::GetPrefixVariableInternal( case cmStateEnums::RuntimeBinaryArtifact: return "CMAKE_SHARED_LIBRARY_PREFIX"; case cmStateEnums::ImportLibraryArtifact: - return "CMAKE_IMPORT_LIBRARY_PREFIX"; + return this->IsApple() ? "CMAKE_APPLE_IMPORT_FILE_PREFIX" + : "CMAKE_IMPORT_LIBRARY_PREFIX"; } break; case cmStateEnums::MODULE_LIBRARY: @@ -3001,7 +3039,9 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, cmValue& loc, bool allowImp = (this->IsDLLPlatform() && (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->IsExecutableWithExports())) || - (this->IsAIX() && this->IsExecutableWithExports()); + (this->IsAIX() && this->IsExecutableWithExports()) || + (this->GetMakefile()->PlatformSupportsAppleTextStubs() && + this->IsSharedLibraryWithExports()); // If a mapping was found, check its configurations. for (auto mci = mappedConfigs.begin(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 95539fa..24f6fcd 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -205,6 +205,8 @@ public: //! Return whether or not we are targeting AIX. bool IsAIX() const; + //! Return whether or not we are targeting Apple. + bool IsApple() const; bool IsNormal() const; bool IsSynthetic() const; @@ -219,6 +221,10 @@ public: //! Return whether this target is an executable with symbol exports enabled. bool IsExecutableWithExports() const; + //! Return whether this target is a shared library with symbol exports + //! enabled. + bool IsSharedLibraryWithExports() const; + //! Return whether this target is a shared library Framework on Apple. bool IsFrameworkOnApple() const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 652ca54..8926f9e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -693,12 +693,12 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( switch (this->ProjectType) { case VsProjectType::vcxproj: { + Elem(e0, "Import").Attribute("Project", VS10_CXX_DEFAULT_PROPS); std::string const& props = this->GlobalGenerator->GetPlatformToolsetVersionProps(); if (!props.empty()) { Elem(e0, "Import").Attribute("Project", props); } - Elem(e0, "Import").Attribute("Project", VS10_CXX_DEFAULT_PROPS); } break; case VsProjectType::csproj: Elem(e0, "Import") @@ -1810,13 +1810,15 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( this->WriteCustomRuleCSharp(e0, c, name, script, additional_inputs.str(), outputs.str(), comment, ccg); } else { - this->WriteCustomRuleCpp( - *spe2, c, script, additional_inputs.str(), outputs.str(), comment, ccg, - symbolic, - (command.GetUsesTerminal() || - (command.HasMainDependency() && source->GetIsGenerated())) - ? BuildInParallel::No - : BuildInParallel::Yes); + BuildInParallel buildInParallel = BuildInParallel::No; + if (command.GetCMP0147Status() == cmPolicies::NEW && + !command.GetUsesTerminal() && + !(command.HasMainDependency() && source->GetIsGenerated())) { + buildInParallel = BuildInParallel::Yes; + } + this->WriteCustomRuleCpp(*spe2, c, script, additional_inputs.str(), + outputs.str(), comment, ccg, symbolic, + buildInParallel); } } } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index dbf961d..d4bbc14 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -335,7 +335,7 @@ cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind) // The "c" extension MUST precede the "C" extension. setupExts(this->CLikeSourceFileExtensions, { "c", "C", "c++", "cc", "cpp", "cxx", "cu", "mpp", "m", "M", - "mm", "ixx", "cppm" }); + "mm", "ixx", "cppm", "ccm", "cxxm", "c++m" }); setupExts(this->HeaderFileExtensions, { "h", "hh", "h++", "hm", "hpp", "hxx", "in", "txx" }); setupExts(this->CudaFileExtensions, { "cu" }); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 6cdd5a3..3bb7869 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2528,6 +2528,12 @@ SystemTools::CopyStatus SystemTools::CloneFileContent( return status; #elif defined(__APPLE__) && \ defined(KWSYS_SYSTEMTOOLS_HAVE_MACOS_COPYFILE_CLONE) + // When running as root, copyfile() copies more metadata than we + // want, such as ownership. Pretend it is not available. + if (getuid() == 0) { + return CopyStatus{ Status::POSIX(ENOSYS), CopyStatus::NoPath }; + } + // NOTE: we cannot use `clonefile` as the {a,c,m}time for the file needs to // be updated by `copy_file_if_different` and `copy_file`. if (copyfile(source.c_str(), destination.c_str(), nullptr, diff --git a/Source/kwsys/kwsysPlatformTests.cmake b/Source/kwsys/kwsysPlatformTests.cmake index 89be4b8..6c006bc 100644 --- a/Source/kwsys/kwsysPlatformTests.cmake +++ b/Source/kwsys/kwsysPlatformTests.cmake @@ -8,9 +8,6 @@ macro(KWSYS_PLATFORM_TEST lang var description invert) if(NOT DEFINED ${var}_COMPILED) message(STATUS "${description}") set(maybe_cxx_standard "") - if(CMAKE_VERSION VERSION_LESS 3.8 AND CMAKE_CXX_STANDARD) - set(maybe_cxx_standard "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}") - endif() try_compile(${var}_COMPILED ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}} @@ -18,14 +15,16 @@ macro(KWSYS_PLATFORM_TEST lang var description invert) CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${KWSYS_PLATFORM_TEST_LINK_LIBRARIES}" ${maybe_cxx_standard} OUTPUT_VARIABLE OUTPUT) - if(${var}_COMPILED) - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "${description} compiled with the following output:\n${OUTPUT}\n\n") - else() - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "${description} failed to compile with the following output:\n${OUTPUT}\n\n") + if(CMAKE_VERSION VERSION_LESS 3.26) + if(${var}_COMPILED) + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${description} compiled with the following output:\n${OUTPUT}\n\n") + else() + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${description} failed to compile with the following output:\n${OUTPUT}\n\n") + endif() endif() if(${invert} MATCHES INVERT) if(${var}_COMPILED) @@ -67,19 +66,23 @@ macro(KWSYS_PLATFORM_TEST_RUN lang var description invert) # Note that ${var} will be a 0 return value on success. if(${var}_COMPILED) - if(${var}) + if(CMAKE_VERSION VERSION_LESS 3.26) + if(${var}) + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${description} compiled but failed to run with the following output:\n${OUTPUT}\n\n") + else() + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${description} compiled and ran with the following output:\n${OUTPUT}\n\n") + endif() + endif() + else() + if(CMAKE_VERSION VERSION_LESS 3.26) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "${description} compiled but failed to run with the following output:\n${OUTPUT}\n\n") - else() - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "${description} compiled and ran with the following output:\n${OUTPUT}\n\n") + "${description} failed to compile with the following output:\n${OUTPUT}\n\n") endif() - else() - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "${description} failed to compile with the following output:\n${OUTPUT}\n\n") set(${var} -1 CACHE INTERNAL "${description} failed to compile.") endif() @@ -188,14 +191,16 @@ macro(KWSYS_PLATFORM_INFO_TEST lang var description) OUTPUT_VARIABLE OUTPUT COPY_FILE ${KWSYS_PLATFORM_INFO_FILE} ) - if(${var}_COMPILED) - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "${description} compiled with the following output:\n${OUTPUT}\n\n") - else() - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "${description} failed to compile with the following output:\n${OUTPUT}\n\n") + if(CMAKE_VERSION VERSION_LESS 3.26) + if(${var}_COMPILED) + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${description} compiled with the following output:\n${OUTPUT}\n\n") + else() + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${description} failed to compile with the following output:\n${OUTPUT}\n\n") + endif() endif() if(${var}_COMPILED) message(STATUS "${description} - compiled") diff --git a/Tests/Architecture/CMakeLists.txt b/Tests/Architecture/CMakeLists.txt index 96def00..3d10ee0 100644 --- a/Tests/Architecture/CMakeLists.txt +++ b/Tests/Architecture/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(Architecture C) function(test_for_xcode4 result_var) diff --git a/Tests/ArgumentExpansion/CMakeLists.txt b/Tests/ArgumentExpansion/CMakeLists.txt index da3bb4c..9ab87b2 100644 --- a/Tests/ArgumentExpansion/CMakeLists.txt +++ b/Tests/ArgumentExpansion/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ArgumentExpansion) diff --git a/Tests/BundleGeneratorTest/CMakeLists.txt b/Tests/BundleGeneratorTest/CMakeLists.txt index cf7e2ce..069fb77 100644 --- a/Tests/BundleGeneratorTest/CMakeLists.txt +++ b/Tests/BundleGeneratorTest/CMakeLists.txt @@ -1,6 +1,6 @@ project(BundleGeneratorTest) -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) # Build a shared library and install it in lib/ add_library(Library SHARED Library.cxx) diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt index 4a95e2f..b53d499 100644 --- a/Tests/BundleUtilities/CMakeLists.txt +++ b/Tests/BundleUtilities/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(BundleUtilities) if(CMAKE_GENERATOR STREQUAL "Xcode" AND diff --git a/Tests/CFBundleTest/CMakeLists.txt b/Tests/CFBundleTest/CMakeLists.txt index 5f2e8ec..40dd887 100644 --- a/Tests/CFBundleTest/CMakeLists.txt +++ b/Tests/CFBundleTest/CMakeLists.txt @@ -1,6 +1,6 @@ #this is adapted from FireBreath (http://www.firebreath.org) -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CFBundleTest) diff --git a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt index a6b3ffe..96f553a 100644 --- a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) if(POLICY CMP0129) cmake_policy(SET CMP0129 NEW) diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 72b3502..0c1af9e 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(target_compile_definitions) diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 2e3760a..dd4fe02 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) if(POLICY CMP0129) cmake_policy(SET CMP0129 NEW) diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 3de9ef7..d5d4970 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(target_include_directories) diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 52080bd..b2365ca 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -1,6 +1,6 @@ # Using 2.8 will trigger a deprecation warning. In this case it's explicitly # intentional since the tests checks various policy implementations prior to -# 2.8.12 +# 3.5 cmake_minimum_required(VERSION 2.8) if(POLICY CMP0129) diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index 5e3cdb1..483e220 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -46,7 +46,8 @@ Bracket Comment Content Bracket Comment Content ] -.. cmake:command:: some_cmd +.. cmake:command:: + some_cmd Command some_cmd description. @@ -54,7 +55,8 @@ Bracket Comment Content Command other_cmd description. -.. cmake:envvar:: some_var +.. cmake:envvar:: + some_var Environment variable some_var description. @@ -62,7 +64,8 @@ Bracket Comment Content Environment variable other_var description. -.. cmake:genex:: SOME_GENEX +.. cmake:genex:: + SOME_GENEX Generator expression SOME_GENEX description. @@ -70,7 +73,17 @@ Bracket Comment Content Generator expression $<OTHER_GENEX> description. -.. cmake:variable:: some_var +.. cmake:signature:: + some_command(SOME_SIGNATURE) + + Command some_command SOME_SIGNATURE description. + +.. signature:: other_command(OTHER_SIGNATURE) + + Command other_command OTHER_SIGNATURE description. + +.. cmake:variable:: + some_var Variable some_var description. diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index 4139801..c23b69a 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -49,7 +49,8 @@ Inline literal ``__`` followed by inline link `Link Text <InternalDest_>`_. .. cmake-module:: testRSTmod.cmake -.. cmake:command:: some_cmd +.. cmake:command:: + some_cmd Command some_cmd description. @@ -57,7 +58,8 @@ Inline literal ``__`` followed by inline link `Link Text <InternalDest_>`_. Command other_cmd description. -.. cmake:envvar:: some_var +.. cmake:envvar:: + some_var Environment variable some_var description. @@ -65,7 +67,8 @@ Inline literal ``__`` followed by inline link `Link Text <InternalDest_>`_. Environment variable other_var description. -.. cmake:genex:: SOME_GENEX +.. cmake:genex:: + SOME_GENEX Generator expression SOME_GENEX description. @@ -73,7 +76,17 @@ Inline literal ``__`` followed by inline link `Link Text <InternalDest_>`_. Generator expression $<OTHER_GENEX> description. -.. cmake:variable:: some_var +.. cmake:signature:: + some_command(SOME_SIGNATURE) + + Command some_command SOME_SIGNATURE description. + +.. signature:: other_command(OTHER_SIGNATURE) + + Command other_command OTHER_SIGNATURE description. + +.. cmake:variable:: + some_var Variable some_var description. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index d913e93..446e400 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1484,6 +1484,7 @@ if(BUILD_TESTING) SQLite3 TIFF Vulkan + wxWidgets X11 XalanC XercesC diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt index c7e3105..e6ed559 100644 --- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) if(POLICY CMP0129) cmake_policy(SET CMP0129 NEW) endif() diff --git a/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt index 2784e3b..24a0a86 100644 --- a/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt @@ -9,7 +9,7 @@ project(CheckCXXSymbolExists CXX) -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../CheckSymbolExists") diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt index 2e5d8d3..0c76158 100644 --- a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CheckLanguage NONE) include(CheckLanguage) diff --git a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt index 4cbccd3..6ecd194 100644 --- a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CheckStructHasMember) diff --git a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt index 3d65b7a..b6ed9e9 100644 --- a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt @@ -9,7 +9,7 @@ project(CheckSymbolExists C) -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/Tests/CMakeOnly/CompilerIdOBJC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdOBJC/CMakeLists.txt index 8f13787..18a1ff6 100644 --- a/Tests/CMakeOnly/CompilerIdOBJC/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdOBJC/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CompilerIdOBJC OBJC) foreach(v diff --git a/Tests/CMakeOnly/CompilerIdOBJCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdOBJCXX/CMakeLists.txt index 8f41db0..76c1e4b 100644 --- a/Tests/CMakeOnly/CompilerIdOBJCXX/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdOBJCXX/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CompilerIdOBJCXX OBJCXX) foreach(v diff --git a/Tests/CMakeOnly/LinkInterfaceLoop/CMakeLists.txt b/Tests/CMakeOnly/LinkInterfaceLoop/CMakeLists.txt index d66eb06..77dadcf 100644 --- a/Tests/CMakeOnly/LinkInterfaceLoop/CMakeLists.txt +++ b/Tests/CMakeOnly/LinkInterfaceLoop/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(LinkInterfaceLoop C) # Add a shared library that incorrectly names itself as a diff --git a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt index 9f30c7d..6646825 100644 --- a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt +++ b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) if (NOT MAJOR_TEST_MODULE OR NOT MAJOR_TEST_VERSION) message(FATAL_ERROR "test selection variables not set up") diff --git a/Tests/CMakeOnly/TargetScope/CMakeLists.txt b/Tests/CMakeOnly/TargetScope/CMakeLists.txt index faf2250..3bcbb00 100644 --- a/Tests/CMakeOnly/TargetScope/CMakeLists.txt +++ b/Tests/CMakeOnly/TargetScope/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(TargetScope NONE) add_subdirectory(Sub) diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt index b23d5e2..2d487e3 100644 --- a/Tests/CMakeOnly/find_library/CMakeLists.txt +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(FindLibraryTest NONE) set(CMAKE_FIND_DEBUG_MODE 1) diff --git a/Tests/CMakeOnly/find_path/CMakeLists.txt b/Tests/CMakeOnly/find_path/CMakeLists.txt index bf4e350..7cc08ad 100644 --- a/Tests/CMakeOnly/find_path/CMakeLists.txt +++ b/Tests/CMakeOnly/find_path/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(FindPathTest NONE) set(CMAKE_FIND_DEBUG_MODE 1) diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index fcfce48..728ec5b 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -1,5 +1,5 @@ # a simple C only test case -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project (COnly C) set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") diff --git a/Tests/CPackComponents/CMakeLists.txt b/Tests/CPackComponents/CMakeLists.txt index c1b348e..a886b3d 100644 --- a/Tests/CPackComponents/CMakeLists.txt +++ b/Tests/CPackComponents/CMakeLists.txt @@ -4,7 +4,7 @@ # application (mylibapp). We create a binary installer that allows # users to select which pieces will be installed: the example # application, the library binaries, and/or the header file. -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CPackComponents) # Create the mylib library diff --git a/Tests/CPackTestAllGenerators/CMakeLists.txt b/Tests/CPackTestAllGenerators/CMakeLists.txt index 95daabf..e7fed3b 100644 --- a/Tests/CPackTestAllGenerators/CMakeLists.txt +++ b/Tests/CPackTestAllGenerators/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CPackTestAllGenerators) add_subdirectory(../CTestTest/SmallAndFast SmallAndFast) install(FILES RunCPack.cmake DESTINATION .) diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index 2249d70..33fdc5e 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CPackWiXGenerator) diff --git a/Tests/CTestLimitDashJ/CMakeLists.txt b/Tests/CTestLimitDashJ/CMakeLists.txt index d04b3ad..5bb7369 100644 --- a/Tests/CTestLimitDashJ/CMakeLists.txt +++ b/Tests/CTestLimitDashJ/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CTestLimitDashJ NONE) # This file demonstrates https://gitlab.kitware.com/cmake/cmake/-/issues/12904 diff --git a/Tests/CTestTest/SmallAndFast/CMakeLists.txt b/Tests/CTestTest/SmallAndFast/CMakeLists.txt index 06cbafd..d5b3b61 100644 --- a/Tests/CTestTest/SmallAndFast/CMakeLists.txt +++ b/Tests/CTestTest/SmallAndFast/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(SmallAndFast) include(CTest) diff --git a/Tests/CTestTestCrash/CMakeLists.txt b/Tests/CTestTestCrash/CMakeLists.txt index 663d2e4..c7e5b91 100644 --- a/Tests/CTestTestCrash/CMakeLists.txt +++ b/Tests/CTestTestCrash/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestCrash) include(CTest) diff --git a/Tests/CTestTestCycle/CMakeLists.txt b/Tests/CTestTestCycle/CMakeLists.txt index 19f4dd7..4093111 100644 --- a/Tests/CTestTestCycle/CMakeLists.txt +++ b/Tests/CTestTestCycle/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestCycle) include(CTest) diff --git a/Tests/CTestTestDepends/CMakeLists.txt b/Tests/CTestTestDepends/CMakeLists.txt index 462ad8c..5a011d0 100644 --- a/Tests/CTestTestDepends/CMakeLists.txt +++ b/Tests/CTestTestDepends/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestDepends) include(CTest) diff --git a/Tests/CTestTestFailure/CMakeLists.txt b/Tests/CTestTestFailure/CMakeLists.txt index db14b3d..b6c1e7a 100644 --- a/Tests/CTestTestFailure/CMakeLists.txt +++ b/Tests/CTestTestFailure/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestFailure) include(CTest) diff --git a/Tests/CTestTestFailure/testNoBuild.cmake.in b/Tests/CTestTestFailure/testNoBuild.cmake.in index 47d254f..505916e 100644 --- a/Tests/CTestTestFailure/testNoBuild.cmake.in +++ b/Tests/CTestTestFailure/testNoBuild.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestFailure/testNoExe.cmake.in b/Tests/CTestTestFailure/testNoExe.cmake.in index 8496c80..e3d7742 100644 --- a/Tests/CTestTestFailure/testNoExe.cmake.in +++ b/Tests/CTestTestFailure/testNoExe.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestLaunchers/launcher_compiler_test_project/CMakeLists.txt b/Tests/CTestTestLaunchers/launcher_compiler_test_project/CMakeLists.txt index 7376a40..24da9ca 100644 --- a/Tests/CTestTestLaunchers/launcher_compiler_test_project/CMakeLists.txt +++ b/Tests/CTestTestLaunchers/launcher_compiler_test_project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(launcher_compiler_test_project) diff --git a/Tests/CTestTestLaunchers/launcher_custom_command_test_project/CMakeLists.txt b/Tests/CTestTestLaunchers/launcher_custom_command_test_project/CMakeLists.txt index b31f587..72764ca 100644 --- a/Tests/CTestTestLaunchers/launcher_custom_command_test_project/CMakeLists.txt +++ b/Tests/CTestTestLaunchers/launcher_custom_command_test_project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(launcher_custom_command_test_project) diff --git a/Tests/CTestTestLaunchers/launcher_linker_test_project/CMakeLists.txt b/Tests/CTestTestLaunchers/launcher_linker_test_project/CMakeLists.txt index 38980aa..7bf0362 100644 --- a/Tests/CTestTestLaunchers/launcher_linker_test_project/CMakeLists.txt +++ b/Tests/CTestTestLaunchers/launcher_linker_test_project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(launcher_linker_test_project) diff --git a/Tests/CTestTestMissingDependsExe/CMakeLists.txt b/Tests/CTestTestMissingDependsExe/CMakeLists.txt index 9826da6..07df194 100644 --- a/Tests/CTestTestMissingDependsExe/CMakeLists.txt +++ b/Tests/CTestTestMissingDependsExe/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CTestTestMissingDependsExe) diff --git a/Tests/CTestTestParallel/CMakeLists.txt b/Tests/CTestTestParallel/CMakeLists.txt index 819fee4..7527202 100644 --- a/Tests/CTestTestParallel/CMakeLists.txt +++ b/Tests/CTestTestParallel/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestParallel) include(CTest) diff --git a/Tests/CTestTestResourceLock/CMakeLists.txt b/Tests/CTestTestResourceLock/CMakeLists.txt index 4bc4366..683aba5 100644 --- a/Tests/CTestTestResourceLock/CMakeLists.txt +++ b/Tests/CTestTestResourceLock/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestResourceLock) include(CTest) diff --git a/Tests/CTestTestScheduler/CMakeLists.txt b/Tests/CTestTestScheduler/CMakeLists.txt index a3f0f27..91d565d 100644 --- a/Tests/CTestTestScheduler/CMakeLists.txt +++ b/Tests/CTestTestScheduler/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project (CTestTestScheduler) include (CTest) diff --git a/Tests/CTestTestSerialInDepends/CMakeLists.txt b/Tests/CTestTestSerialInDepends/CMakeLists.txt index 90e50f9..03ad4b3 100644 --- a/Tests/CTestTestSerialInDepends/CMakeLists.txt +++ b/Tests/CTestTestSerialInDepends/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CTestTestSerialInDepends) diff --git a/Tests/CTestTestSerialOrder/CMakeLists.txt b/Tests/CTestTestSerialOrder/CMakeLists.txt index 69c11fc..d46d80e 100644 --- a/Tests/CTestTestSerialOrder/CMakeLists.txt +++ b/Tests/CTestTestSerialOrder/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CTestTestSerialOrder) diff --git a/Tests/CTestTestSkipReturnCode/CMakeLists.txt b/Tests/CTestTestSkipReturnCode/CMakeLists.txt index 26c4178..1eeeec6 100644 --- a/Tests/CTestTestSkipReturnCode/CMakeLists.txt +++ b/Tests/CTestTestSkipReturnCode/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CTestTestSkipReturnCode) include(CTest) diff --git a/Tests/CTestTestStopTime/CMakeLists.txt b/Tests/CTestTestStopTime/CMakeLists.txt index 08116e2..4f6e795 100644 --- a/Tests/CTestTestStopTime/CMakeLists.txt +++ b/Tests/CTestTestStopTime/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestStopTime) include(CTest) diff --git a/Tests/CTestTestSubdir/CMakeLists.txt b/Tests/CTestTestSubdir/CMakeLists.txt index 87c4604..e6f3209 100644 --- a/Tests/CTestTestSubdir/CMakeLists.txt +++ b/Tests/CTestTestSubdir/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestSubdir) include(CTest) diff --git a/Tests/CTestTestUpload/CMakeLists.txt b/Tests/CTestTestUpload/CMakeLists.txt index 5e02b2f..5bf428d 100644 --- a/Tests/CTestTestUpload/CMakeLists.txt +++ b/Tests/CTestTestUpload/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestUpload) add_executable (Sleep sleep.c) diff --git a/Tests/CTestTestVerboseOutput/CMakeLists.txt b/Tests/CTestTestVerboseOutput/CMakeLists.txt index 3792385..d44e9fc 100644 --- a/Tests/CTestTestVerboseOutput/CMakeLists.txt +++ b/Tests/CTestTestVerboseOutput/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CTestTestVerboseOutput) include(CTest) diff --git a/Tests/CTestTestZeroTimeout/CMakeLists.txt b/Tests/CTestTestZeroTimeout/CMakeLists.txt index 2d404c8..51ef807 100644 --- a/Tests/CTestTestZeroTimeout/CMakeLists.txt +++ b/Tests/CTestTestZeroTimeout/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project (CTestTestZeroTimeout) include (CTest) diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 69fa4b6..9259309 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CheckCompilerRelatedVariables) diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt index 8347d5a..cd0a0b0 100644 --- a/Tests/CompileDefinitions/CMakeLists.txt +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(CompileDefinitions) # Use compile flags to tell executables which config is built diff --git a/Tests/Contracts/Trilinos/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt index 6cc2d09..e23a643 100644 --- a/Tests/Contracts/Trilinos/CMakeLists.txt +++ b/Tests/Contracts/Trilinos/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(Trilinos) include(ExternalProject) diff --git a/Tests/Contracts/VTK/CMakeLists.txt b/Tests/Contracts/VTK/CMakeLists.txt index 0d36323..aee4dc6 100644 --- a/Tests/Contracts/VTK/CMakeLists.txt +++ b/Tests/Contracts/VTK/CMakeLists.txt @@ -1,6 +1,6 @@ # The VTK external project for CMake # --------------------------------------------------------------------------- -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(VTK) include(ExternalProject) diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index fa06a94..25df300 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -1,7 +1,7 @@ # # Wrapping # -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project (CustomCommand) add_subdirectory(GeneratedHeader) diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt index 7697a9b..531690a 100644 --- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt +++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(TestWorkingDir) add_custom_command( diff --git a/Tests/CxxDialect/CMakeLists.txt b/Tests/CxxDialect/CMakeLists.txt index 8c90339..c88641b 100644 --- a/Tests/CxxDialect/CMakeLists.txt +++ b/Tests/CxxDialect/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) -cmake_policy(SET CMP0025 NEW) +cmake_minimum_required(VERSION 3.5) project(CxxDialect) add_executable(use_typeof use_typeof.cxx) diff --git a/Tests/CxxOnly/CMakeLists.txt b/Tests/CxxOnly/CMakeLists.txt index 09689cb..6cd3a8e 100644 --- a/Tests/CxxOnly/CMakeLists.txt +++ b/Tests/CxxOnly/CMakeLists.txt @@ -1,5 +1,5 @@ # a simple CXX only test case -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project (CxxOnly CXX) set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") diff --git a/Tests/Dependency/CMakeLists.txt b/Tests/Dependency/CMakeLists.txt index 58d3fb7..cae108e 100644 --- a/Tests/Dependency/CMakeLists.txt +++ b/Tests/Dependency/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project( Dependency ) # to test directories with only one character One was changed to 1 diff --git a/Tests/EmptyDepends/CMakeLists.txt b/Tests/EmptyDepends/CMakeLists.txt index 272eff7..5ba0b49 100644 --- a/Tests/EmptyDepends/CMakeLists.txt +++ b/Tests/EmptyDepends/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(EmptyDepends) include(CTest) diff --git a/Tests/ExportImport/Import/try_compile/CMakeLists.txt b/Tests/ExportImport/Import/try_compile/CMakeLists.txt index 813cf06..bb390f9 100644 --- a/Tests/ExportImport/Import/try_compile/CMakeLists.txt +++ b/Tests/ExportImport/Import/try_compile/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) find_package(testLibRequired 2.5 REQUIRED) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 81d31e7..d1ab7ac 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ExternalProjectTest NONE) if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) cmake_policy(SET CMP0114 NEW) diff --git a/Tests/ExternalProject/Example/CMakeLists.txt b/Tests/ExternalProject/Example/CMakeLists.txt index c3f2614..b6785a6 100644 --- a/Tests/ExternalProject/Example/CMakeLists.txt +++ b/Tests/ExternalProject/Example/CMakeLists.txt @@ -1,5 +1,5 @@ # This is the canonical simplest ExternalProject example CMakeLists.txt file: -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ExternalProjectExample NONE) include(ExternalProject) diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index 57e8105..2dfc425 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ExternalProjectLocalTest NONE) if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) cmake_policy(SET CMP0114 NEW) diff --git a/Tests/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt index 6f8a7b1..1b84ff3 100644 --- a/Tests/ExternalProjectUpdate/CMakeLists.txt +++ b/Tests/ExternalProjectUpdate/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ExternalProjectUpdateTest NONE) if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) cmake_policy(SET CMP0114 NEW) diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt index 14bf19f..9909d2e 100644 --- a/Tests/FindBLAS/Test/CMakeLists.txt +++ b/Tests/FindBLAS/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindBLAS C) include(CTest) diff --git a/Tests/FindBZip2/Test/CMakeLists.txt b/Tests/FindBZip2/Test/CMakeLists.txt index e9cb618..136b3fd 100644 --- a/Tests/FindBZip2/Test/CMakeLists.txt +++ b/Tests/FindBZip2/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindBZip2 C) include(CTest) diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt index f60ccfa..39fa532 100644 --- a/Tests/FindBoost/Test/CMakeLists.txt +++ b/Tests/FindBoost/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindBoost CXX) include(CTest) diff --git a/Tests/FindBoost/TestFail/CMakeLists.txt b/Tests/FindBoost/TestFail/CMakeLists.txt index 7c14a59..3db1a4f 100644 --- a/Tests/FindBoost/TestFail/CMakeLists.txt +++ b/Tests/FindBoost/TestFail/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindBoost CXX) include(CTest) diff --git a/Tests/FindBoost/TestHeaders/CMakeLists.txt b/Tests/FindBoost/TestHeaders/CMakeLists.txt index d7be327..7dd12e9 100644 --- a/Tests/FindBoost/TestHeaders/CMakeLists.txt +++ b/Tests/FindBoost/TestHeaders/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindBoostHeaders CXX) include(CTest) diff --git a/Tests/FindDevIL/Test/CMakeLists.txt b/Tests/FindDevIL/Test/CMakeLists.txt index c2c1322..db80ccb 100644 --- a/Tests/FindDevIL/Test/CMakeLists.txt +++ b/Tests/FindDevIL/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindDevIL C) include(CTest) diff --git a/Tests/FindGIF/Test/CMakeLists.txt b/Tests/FindGIF/Test/CMakeLists.txt index 961e636..eb0291e 100644 --- a/Tests/FindGIF/Test/CMakeLists.txt +++ b/Tests/FindGIF/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindGIF C) include(CTest) diff --git a/Tests/FindGLEW/Test/CMakeLists.txt b/Tests/FindGLEW/Test/CMakeLists.txt index 954ee10..de8d97d 100644 --- a/Tests/FindGLEW/Test/CMakeLists.txt +++ b/Tests/FindGLEW/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindGLEW LANGUAGES CXX) include(CTest) diff --git a/Tests/FindGSL/rng/CMakeLists.txt b/Tests/FindGSL/rng/CMakeLists.txt index b15d6ac..497b6c3 100644 --- a/Tests/FindGSL/rng/CMakeLists.txt +++ b/Tests/FindGSL/rng/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) project(FindGSL_rng CXX) include(CTest) diff --git a/Tests/FindGTK2/atk/CMakeLists.txt b/Tests/FindGTK2/atk/CMakeLists.txt index 0392d88..b80c6fc 100644 --- a/Tests/FindGTK2/atk/CMakeLists.txt +++ b/Tests/FindGTK2/atk/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(atk C) diff --git a/Tests/FindGTK2/atkmm/CMakeLists.txt b/Tests/FindGTK2/atkmm/CMakeLists.txt index ec838de..cea87cd 100644 --- a/Tests/FindGTK2/atkmm/CMakeLists.txt +++ b/Tests/FindGTK2/atkmm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(atkmm CXX) diff --git a/Tests/FindGTK2/cairo/CMakeLists.txt b/Tests/FindGTK2/cairo/CMakeLists.txt index 3652ad6..42d371a 100644 --- a/Tests/FindGTK2/cairo/CMakeLists.txt +++ b/Tests/FindGTK2/cairo/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(cairo C) diff --git a/Tests/FindGTK2/cairomm/CMakeLists.txt b/Tests/FindGTK2/cairomm/CMakeLists.txt index cde0f42..5d957ee 100644 --- a/Tests/FindGTK2/cairomm/CMakeLists.txt +++ b/Tests/FindGTK2/cairomm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(cairomm CXX) diff --git a/Tests/FindGTK2/gdk/CMakeLists.txt b/Tests/FindGTK2/gdk/CMakeLists.txt index 35ef337..2b8f533 100644 --- a/Tests/FindGTK2/gdk/CMakeLists.txt +++ b/Tests/FindGTK2/gdk/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gdk C) diff --git a/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt b/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt index ea1b05d..3524f06 100644 --- a/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt +++ b/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gdk_pixbuf C) diff --git a/Tests/FindGTK2/gdkmm/CMakeLists.txt b/Tests/FindGTK2/gdkmm/CMakeLists.txt index 72fc6f4..be1cceb 100644 --- a/Tests/FindGTK2/gdkmm/CMakeLists.txt +++ b/Tests/FindGTK2/gdkmm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gdkmm CXX) diff --git a/Tests/FindGTK2/gio/CMakeLists.txt b/Tests/FindGTK2/gio/CMakeLists.txt index 4835afa..b420f48 100644 --- a/Tests/FindGTK2/gio/CMakeLists.txt +++ b/Tests/FindGTK2/gio/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gio C) diff --git a/Tests/FindGTK2/giomm/CMakeLists.txt b/Tests/FindGTK2/giomm/CMakeLists.txt index b639979..bae34ff 100644 --- a/Tests/FindGTK2/giomm/CMakeLists.txt +++ b/Tests/FindGTK2/giomm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(giomm CXX) diff --git a/Tests/FindGTK2/glib/CMakeLists.txt b/Tests/FindGTK2/glib/CMakeLists.txt index 536fc67..8efde3d 100644 --- a/Tests/FindGTK2/glib/CMakeLists.txt +++ b/Tests/FindGTK2/glib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(glib C) diff --git a/Tests/FindGTK2/glibmm/CMakeLists.txt b/Tests/FindGTK2/glibmm/CMakeLists.txt index 25d5518..f0785dc 100644 --- a/Tests/FindGTK2/glibmm/CMakeLists.txt +++ b/Tests/FindGTK2/glibmm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(glibmm CXX) diff --git a/Tests/FindGTK2/gmodule/CMakeLists.txt b/Tests/FindGTK2/gmodule/CMakeLists.txt index 2bfb81e..9c686a6 100644 --- a/Tests/FindGTK2/gmodule/CMakeLists.txt +++ b/Tests/FindGTK2/gmodule/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gmodule C) diff --git a/Tests/FindGTK2/gobject/CMakeLists.txt b/Tests/FindGTK2/gobject/CMakeLists.txt index 11520f8..83d9546 100644 --- a/Tests/FindGTK2/gobject/CMakeLists.txt +++ b/Tests/FindGTK2/gobject/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gobject C) diff --git a/Tests/FindGTK2/gthread/CMakeLists.txt b/Tests/FindGTK2/gthread/CMakeLists.txt index 5ecfd9b..d97585c 100644 --- a/Tests/FindGTK2/gthread/CMakeLists.txt +++ b/Tests/FindGTK2/gthread/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gthread C) diff --git a/Tests/FindGTK2/gtk/CMakeLists.txt b/Tests/FindGTK2/gtk/CMakeLists.txt index 2c67619..2b5a56d 100644 --- a/Tests/FindGTK2/gtk/CMakeLists.txt +++ b/Tests/FindGTK2/gtk/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gtk C) diff --git a/Tests/FindGTK2/gtkmm/CMakeLists.txt b/Tests/FindGTK2/gtkmm/CMakeLists.txt index 3375a55..179f5db 100644 --- a/Tests/FindGTK2/gtkmm/CMakeLists.txt +++ b/Tests/FindGTK2/gtkmm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(gtkmm CXX) diff --git a/Tests/FindGTK2/pango/CMakeLists.txt b/Tests/FindGTK2/pango/CMakeLists.txt index bd6b13a..e9d6b9d 100644 --- a/Tests/FindGTK2/pango/CMakeLists.txt +++ b/Tests/FindGTK2/pango/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(pango C) diff --git a/Tests/FindGTK2/pangocairo/CMakeLists.txt b/Tests/FindGTK2/pangocairo/CMakeLists.txt index 157b9c2..bbb1f27 100644 --- a/Tests/FindGTK2/pangocairo/CMakeLists.txt +++ b/Tests/FindGTK2/pangocairo/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(pangocairo C) diff --git a/Tests/FindGTK2/pangoft2/CMakeLists.txt b/Tests/FindGTK2/pangoft2/CMakeLists.txt index 76966e7..801629c 100644 --- a/Tests/FindGTK2/pangoft2/CMakeLists.txt +++ b/Tests/FindGTK2/pangoft2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(pangoft2 C) diff --git a/Tests/FindGTK2/pangomm/CMakeLists.txt b/Tests/FindGTK2/pangomm/CMakeLists.txt index 0bb49e2..853a1dd 100644 --- a/Tests/FindGTK2/pangomm/CMakeLists.txt +++ b/Tests/FindGTK2/pangomm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(pangomm CXX) diff --git a/Tests/FindGTK2/pangoxft/CMakeLists.txt b/Tests/FindGTK2/pangoxft/CMakeLists.txt index 7051d35..f267d6c 100644 --- a/Tests/FindGTK2/pangoxft/CMakeLists.txt +++ b/Tests/FindGTK2/pangoxft/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(pangoxft C) diff --git a/Tests/FindGTK2/sigc++/CMakeLists.txt b/Tests/FindGTK2/sigc++/CMakeLists.txt index 9c1fff7..f09ea66 100644 --- a/Tests/FindGTK2/sigc++/CMakeLists.txt +++ b/Tests/FindGTK2/sigc++/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(sigc++ CXX) diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt index 9c1eb5e..582cbaa 100644 --- a/Tests/FindGTest/Test/CMakeLists.txt +++ b/Tests/FindGTest/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindGTest CXX) include(CTest) diff --git a/Tests/FindGnuTLS/Test/CMakeLists.txt b/Tests/FindGnuTLS/Test/CMakeLists.txt index c5a9819..e17987d 100644 --- a/Tests/FindGnuTLS/Test/CMakeLists.txt +++ b/Tests/FindGnuTLS/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindGnuTLS C) include(CTest) diff --git a/Tests/FindICU/Test/CMakeLists.txt b/Tests/FindICU/Test/CMakeLists.txt index 1247ac7..066d173 100644 --- a/Tests/FindICU/Test/CMakeLists.txt +++ b/Tests/FindICU/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindICU LANGUAGES CXX) include(CTest) diff --git a/Tests/FindImageMagick/Test/CMakeLists.txt b/Tests/FindImageMagick/Test/CMakeLists.txt index 6182260..4e4f14d 100644 --- a/Tests/FindImageMagick/Test/CMakeLists.txt +++ b/Tests/FindImageMagick/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(FindImageMagick C CXX) include(CTest) diff --git a/Tests/FindJPEG/Test/CMakeLists.txt b/Tests/FindJPEG/Test/CMakeLists.txt index 912c7a1..390b3a7 100644 --- a/Tests/FindJPEG/Test/CMakeLists.txt +++ b/Tests/FindJPEG/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindJPEG C) include(CTest) diff --git a/Tests/FindJsonCpp/Test/CMakeLists.txt b/Tests/FindJsonCpp/Test/CMakeLists.txt index d1dc647..5f100ea 100644 --- a/Tests/FindJsonCpp/Test/CMakeLists.txt +++ b/Tests/FindJsonCpp/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindJsonCpp CXX) include(CTest) diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt index f5d5a73..ce9af98 100644 --- a/Tests/FindLAPACK/Test/CMakeLists.txt +++ b/Tests/FindLAPACK/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindLAPACK C) include(CTest) diff --git a/Tests/FindLibLZMA/Test/CMakeLists.txt b/Tests/FindLibLZMA/Test/CMakeLists.txt index c59dcdb..438938e 100644 --- a/Tests/FindLibLZMA/Test/CMakeLists.txt +++ b/Tests/FindLibLZMA/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindLZMA C) include(CTest) diff --git a/Tests/FindLibXml2/Test/CMakeLists.txt b/Tests/FindLibXml2/Test/CMakeLists.txt index 041cc13..9b866ab 100644 --- a/Tests/FindLibXml2/Test/CMakeLists.txt +++ b/Tests/FindLibXml2/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindLibXml2 C) include(CTest) diff --git a/Tests/FindLibXslt/Test/CMakeLists.txt b/Tests/FindLibXslt/Test/CMakeLists.txt index e932661..32a157f 100644 --- a/Tests/FindLibXslt/Test/CMakeLists.txt +++ b/Tests/FindLibXslt/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindLibXslt C) include(CTest) diff --git a/Tests/FindMatlab/basic_checks/CMakeLists.txt b/Tests/FindMatlab/basic_checks/CMakeLists.txt index c0c752a..e9b696c 100644 --- a/Tests/FindMatlab/basic_checks/CMakeLists.txt +++ b/Tests/FindMatlab/basic_checks/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) enable_testing() project(basic_checks) diff --git a/Tests/FindMatlab/components_checks/CMakeLists.txt b/Tests/FindMatlab/components_checks/CMakeLists.txt index f5d4880..efb99ae 100644 --- a/Tests/FindMatlab/components_checks/CMakeLists.txt +++ b/Tests/FindMatlab/components_checks/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) enable_testing() project(component_checks) diff --git a/Tests/FindMatlab/failure_reports/CMakeLists.txt b/Tests/FindMatlab/failure_reports/CMakeLists.txt index 4b092cd..45e48d7 100644 --- a/Tests/FindMatlab/failure_reports/CMakeLists.txt +++ b/Tests/FindMatlab/failure_reports/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) enable_testing() project(failure_reports) diff --git a/Tests/FindMatlab/no_implicit_link_checks/CMakeLists.txt b/Tests/FindMatlab/no_implicit_link_checks/CMakeLists.txt index bceeba1..58db0ec 100644 --- a/Tests/FindMatlab/no_implicit_link_checks/CMakeLists.txt +++ b/Tests/FindMatlab/no_implicit_link_checks/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) enable_testing() project(no_implicit_links_checks) diff --git a/Tests/FindMatlab/r2018a_check/CMakeLists.txt b/Tests/FindMatlab/r2018a_check/CMakeLists.txt index c732be1..8b21888 100644 --- a/Tests/FindMatlab/r2018a_check/CMakeLists.txt +++ b/Tests/FindMatlab/r2018a_check/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) enable_testing() project(r2018a_checks) diff --git a/Tests/FindMatlab/targets_checks/CMakeLists.txt b/Tests/FindMatlab/targets_checks/CMakeLists.txt index 4af7cc3..c709bbd 100644 --- a/Tests/FindMatlab/targets_checks/CMakeLists.txt +++ b/Tests/FindMatlab/targets_checks/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) enable_testing() project(targets_checks) diff --git a/Tests/FindMatlab/versions_checks/CMakeLists.txt b/Tests/FindMatlab/versions_checks/CMakeLists.txt index d015730..f203f4b 100644 --- a/Tests/FindMatlab/versions_checks/CMakeLists.txt +++ b/Tests/FindMatlab/versions_checks/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) enable_testing() project(versions_checks) diff --git a/Tests/FindODBC/Test/CMakeLists.txt b/Tests/FindODBC/Test/CMakeLists.txt index a20c0f7..1e3a239 100644 --- a/Tests/FindODBC/Test/CMakeLists.txt +++ b/Tests/FindODBC/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindODBC C) include(CTest) diff --git a/Tests/FindOpenCL/Test/CMakeLists.txt b/Tests/FindOpenCL/Test/CMakeLists.txt index f8a6587..4a1f6bd 100644 --- a/Tests/FindOpenCL/Test/CMakeLists.txt +++ b/Tests/FindOpenCL/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindOpenCL C) include(CTest) diff --git a/Tests/FindOpenGL/Test/CMakeLists.txt b/Tests/FindOpenGL/Test/CMakeLists.txt index 9004a98..7c805c0 100644 --- a/Tests/FindOpenGL/Test/CMakeLists.txt +++ b/Tests/FindOpenGL/Test/CMakeLists.txt @@ -44,28 +44,115 @@ else() add_test(NAME test_comp_glx_novnd COMMAND test_comp_glx_novnd) endif() -# EGL is only available on Linux+GLVND at present. -if(OpenGL_TEST_VND) - find_package(OpenGL COMPONENTS OpenGL EGL) - if(OpenGL_EGL_FOUND) - add_executable(test_comp_egl main.c) - target_link_libraries(test_comp_egl PRIVATE OpenGL::OpenGL OpenGL::EGL) - add_test(NAME test_comp_egl COMMAND test_comp_egl) - # EGL-only code should not link to GLX. - execute_process(COMMAND ldd test_comp_egl - OUTPUT_VARIABLE LDD_OUT - ERROR_VARIABLE LDD_ERR) - if("${LDD_OUT}" MATCHES "GLX") - message(FATAL_ERROR "EGL-only code links to GLX!") - endif() +find_package(OpenGL COMPONENTS OpenGL EGL) +if(OpenGL_EGL_FOUND) + add_executable(test_comp_egl main.c) + target_link_libraries(test_comp_egl PRIVATE OpenGL::OpenGL OpenGL::EGL) + add_test(NAME test_comp_egl COMMAND test_comp_egl) + # EGL-only code should not link to GLX. + get_target_property(iface_libs OpenGL::EGL INTERFACE_LINK_LIBRARIES) + if(iface_libs MATCHES "GLX") + message(FATAL_ERROR "EGL-only code links to GLX!") + endif() +endif() + +# all three COMPONENTS together. +find_package(OpenGL COMPONENTS OpenGL EGL GLX) +if(OpenGL_EGL_FOUND AND OpenGL_GLX_FOUND) + add_executable(test_comp_both main.c) + target_link_libraries(test_comp_both PRIVATE OpenGL::OpenGL OpenGL::EGL + OpenGL::GLX) + add_test(NAME test_comp_both COMMAND test_comp_both) +endif() + +find_package(OpenGL COMPONENTS GLES2) +if(OpenGL_GLES2_FOUND) + add_executable(test_comp_gles2 main_gles2.c) + target_link_libraries(test_comp_gles2 PRIVATE OpenGL::GLES2) + add_test(NAME test_comp_gles2 COMMAND test_comp_gles2) + # GLES2-only code should not link to OpenGL + get_target_property(iface_libs test_comp_gles2 LINK_LIBRARIES) + if(iface_libs MATCHES "OpenGL::OpenGL") + message(FATAL_ERROR "GLES2-only code links to OpenGL!") endif() +endif() + +# GLES2 and EGL together. +find_package(OpenGL COMPONENTS GLES2 EGL) +if(OpenGL_GLES2_FOUND AND OpenGL_EGL_FOUND) + add_executable(test_comp_gles2_egl main_gles2.c) + target_link_libraries(test_comp_gles2_egl PRIVATE OpenGL::GLES2 + OpenGL::EGL) + add_test(NAME test_comp_gles2_egl COMMAND test_comp_gles2_egl) + # GLES2-EGL-only code should not link to OpenGL or GLX + get_target_property(iface_libs test_comp_gles2_egl LINK_LIBRARIES) + if(iface_libs MATCHES "OpenGL::OpenGL") + message(FATAL_ERROR "GLES2-only code links to OpenGL!") + endif() + if(iface_libs MATCHES "GLX") + message(FATAL_ERROR "GLES2-EGL-only code links to GLX!") + endif() +endif() - # all three COMPONENTS together. - find_package(OpenGL COMPONENTS OpenGL EGL GLX) - if(OpenGL_EGL_FOUND AND OpenGL_GLX_FOUND) - add_executable(test_comp_both main.c) - target_link_libraries(test_comp_both PRIVATE OpenGL::OpenGL OpenGL::EGL - OpenGL::GLX) - add_test(NAME test_comp_both COMMAND test_comp_both) +# GLES2 and GLX together. +find_package(OpenGL COMPONENTS GLES2 GLX) +if(OpenGL_GLES2_FOUND AND OpenGL_GLX_FOUND) + add_executable(test_comp_gles2_glx main_gles2.c) + target_link_libraries(test_comp_gles2_glx PRIVATE OpenGL::GLES2 + OpenGL::GLX) + add_test(NAME test_comp_gles2_glx COMMAND test_comp_gles2_glx) + # GLES2-GLX-only code should not link to OpenGL or EGL + get_target_property(iface_libs test_comp_gles2_glx LINK_LIBRARIES) + if(iface_libs MATCHES "OpenGL::OpenGL") + message(FATAL_ERROR "GLES2-only code links to OpenGL!") + endif() + if(iface_libs MATCHES "EGL") + message(FATAL_ERROR "GLES2-GLX-only code links to EGL!") + endif() +endif() + +find_package(OpenGL COMPONENTS GLES3) +if(OpenGL_GLES3_FOUND) + add_executable(test_comp_gles3 main_gles3.c) + target_link_libraries(test_comp_gles3 PRIVATE OpenGL::GLES3) + add_test(NAME test_comp_gles3 COMMAND test_comp_gles3) + # GLES3-only code should not link to OpenGL. + get_target_property(iface_libs test_comp_gles3 LINK_LIBRARIES) + if(iface_libs MATCHES "OpenGL::OpenGL") + message(FATAL_ERROR "GLES3-only code links to OpenGL!") + endif() +endif() + +# GLES3 and EGL together. +find_package(OpenGL COMPONENTS GLES3 EGL) +if(OpenGL_GLES3_FOUND AND OpenGL_EGL_FOUND) + add_executable(test_comp_gles3_egl main_gles3.c) + target_link_libraries(test_comp_gles3_egl PRIVATE OpenGL::GLES3 + OpenGL::EGL) + add_test(NAME test_comp_gles3_egl COMMAND test_comp_gles3_egl) + # GLES3-EGL-only code should not link to OpenGL or GLX + get_target_property(iface_libs test_comp_gles3_egl LINK_LIBRARIES) + if(iface_libs MATCHES "OpenGL::OpenGL") + message(FATAL_ERROR "GLES3-only code links to OpenGL!") + endif() + if(iface_libs MATCHES "GLX") + message(FATAL_ERROR "GLES3-EGL-only code links to GLX!") + endif() +endif() + +# GLES3 and GLX together. +find_package(OpenGL COMPONENTS GLES3 GLX) +if(OpenGL_GLES3_FOUND AND OpenGL_GLX_FOUND) + add_executable(test_comp_gles3_glx main_gles3.c) + target_link_libraries(test_comp_gles3_glx PRIVATE OpenGL::GLES3 + OpenGL::GLX) + add_test(NAME test_comp_gles3_glx COMMAND test_comp_gles3_glx) + # GLESr-GLX-only code should not link to OpenGL or EGL + get_target_property(iface_libs test_comp_gles3_glx LINK_LIBRARIES) + if(iface_libs MATCHES "OpenGL::OpenGL") + message(FATAL_ERROR "GLES3-only code links to OpenGL!") + endif() + if(iface_libs MATCHES "EGL") + message(FATAL_ERROR "GLES3-GLX-only code links to EGL!") endif() endif() diff --git a/Tests/FindOpenGL/Test/main_gles2.c b/Tests/FindOpenGL/Test/main_gles2.c new file mode 100644 index 0000000..52f5936 --- /dev/null +++ b/Tests/FindOpenGL/Test/main_gles2.c @@ -0,0 +1,17 @@ +#ifdef _WIN32 +# error "GLES2 cannot be tested on WIN32 platforms." +#endif +#ifdef __APPLE__ +# error "GLES2 cannot be tested on macOS platform." +#else +# include <GLES2/gl2.h> +#endif + +#include <stdio.h> + +int main() +{ + /* Reference a GL symbol without requiring a context at runtime. */ + printf("&glGetString = %p\n", &glGetString); + return 0; +} diff --git a/Tests/FindOpenGL/Test/main_gles3.c b/Tests/FindOpenGL/Test/main_gles3.c new file mode 100644 index 0000000..875f73c --- /dev/null +++ b/Tests/FindOpenGL/Test/main_gles3.c @@ -0,0 +1,17 @@ +#ifdef _WIN32 +# error "GLES3 cannot be tested on WIN32 platforms." +#endif +#ifdef __APPLE__ +# error "GLES3 cannot be tested on macOS platform." +#else +# include <GLES3/gl3.h> +#endif + +#include <stdio.h> + +int main() +{ + /* Reference a GL symbol without requiring a context at runtime. */ + printf("&glGetString = %p\n", &glGetString); + return 0; +} diff --git a/Tests/FindOpenSP/Test/CMakeLists.txt b/Tests/FindOpenSP/Test/CMakeLists.txt index d8992d9..266a459 100644 --- a/Tests/FindOpenSP/Test/CMakeLists.txt +++ b/Tests/FindOpenSP/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindOpenSP CXX) include(CTest) diff --git a/Tests/FindOpenSSL/rand/CMakeLists.txt b/Tests/FindOpenSSL/rand/CMakeLists.txt index 520d5d2..c443221 100644 --- a/Tests/FindOpenSSL/rand/CMakeLists.txt +++ b/Tests/FindOpenSSL/rand/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) project(FindOpenSSL_rand CXX) include(CTest) diff --git a/Tests/FindPNG/Test/CMakeLists.txt b/Tests/FindPNG/Test/CMakeLists.txt index ad50011..66cdda1 100644 --- a/Tests/FindPNG/Test/CMakeLists.txt +++ b/Tests/FindPNG/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindPNG C) include(CTest) diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt index 524be92..99823a6 100644 --- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt +++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestArtifactsInteractive LANGUAGES C) diff --git a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt index a0d8eb2..283aeec 100644 --- a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt +++ b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestCustomFailureMessage LANGUAGES NONE) diff --git a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt index 2164ac1..0fb3036 100644 --- a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt +++ b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestCustomFailureMessage.Check LANGUAGES NONE) diff --git a/Tests/FindPython/DifferentComponents/CMakeLists.txt b/Tests/FindPython/DifferentComponents/CMakeLists.txt index 7476632..e3e7b36 100644 --- a/Tests/FindPython/DifferentComponents/CMakeLists.txt +++ b/Tests/FindPython/DifferentComponents/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestDifferentComponents LANGUAGES C) diff --git a/Tests/FindPython/ExactVersion/CMakeLists.txt b/Tests/FindPython/ExactVersion/CMakeLists.txt index 60abb26..1bd94c4 100644 --- a/Tests/FindPython/ExactVersion/CMakeLists.txt +++ b/Tests/FindPython/ExactVersion/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestExactVersion LANGUAGES C) diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt index 592329b..8086c16 100644 --- a/Tests/FindPython/Implementation/CMakeLists.txt +++ b/Tests/FindPython/Implementation/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} LANGUAGES NONE) diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt index 47ca022..fd3182e 100644 --- a/Tests/FindPython/IronPython/CMakeLists.txt +++ b/Tests/FindPython/IronPython/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestIronPython LANGUAGES NONE) diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt index fd9d947..b623972 100644 --- a/Tests/FindPython/IronPython2/CMakeLists.txt +++ b/Tests/FindPython/IronPython2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestIronPython2 LANGUAGES NONE) diff --git a/Tests/FindPython/MultiplePackages/CMakeLists.txt b/Tests/FindPython/MultiplePackages/CMakeLists.txt index 5c85155..4845035 100644 --- a/Tests/FindPython/MultiplePackages/CMakeLists.txt +++ b/Tests/FindPython/MultiplePackages/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestMultiplePackages C) diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt index 3e17f68..9920336 100644 --- a/Tests/FindPython/NumPy/CMakeLists.txt +++ b/Tests/FindPython/NumPy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestNumPy LANGUAGES C) diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt index bedc627..9aa1bcf 100644 --- a/Tests/FindPython/NumPyOnly/CMakeLists.txt +++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestNumPyOnly LANGUAGES C) diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt index 4cf7c0a..dfc22d8 100644 --- a/Tests/FindPython/PyPy/CMakeLists.txt +++ b/Tests/FindPython/PyPy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPyPy LANGUAGES C) diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt index ebfc9ab..5b7ce30 100644 --- a/Tests/FindPython/PyPy2/CMakeLists.txt +++ b/Tests/FindPython/PyPy2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPyPy2 LANGUAGES C) diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt index bf7cd61..b702c99 100644 --- a/Tests/FindPython/PyPy3/CMakeLists.txt +++ b/Tests/FindPython/PyPy3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPyPy3 LANGUAGES C) diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt index 9bec22f..85b1711 100644 --- a/Tests/FindPython/Python/CMakeLists.txt +++ b/Tests/FindPython/Python/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython LANGUAGES C) diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt index 39577b2..95ed495 100644 --- a/Tests/FindPython/Python2/CMakeLists.txt +++ b/Tests/FindPython/Python2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython2 LANGUAGES C) diff --git a/Tests/FindPython/Python2Embedded/CMakeLists.txt b/Tests/FindPython/Python2Embedded/CMakeLists.txt index a1036ce..d9b2d22 100644 --- a/Tests/FindPython/Python2Embedded/CMakeLists.txt +++ b/Tests/FindPython/Python2Embedded/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython2Embedded LANGUAGES C) diff --git a/Tests/FindPython/Python2Fail/CMakeLists.txt b/Tests/FindPython/Python2Fail/CMakeLists.txt index 989688f..7a6520d 100644 --- a/Tests/FindPython/Python2Fail/CMakeLists.txt +++ b/Tests/FindPython/Python2Fail/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython2Fail C) diff --git a/Tests/FindPython/Python2Module/CMakeLists.txt b/Tests/FindPython/Python2Module/CMakeLists.txt index c9d46ac..7334d7a 100644 --- a/Tests/FindPython/Python2Module/CMakeLists.txt +++ b/Tests/FindPython/Python2Module/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython2Module LANGUAGES C) diff --git a/Tests/FindPython/Python2SABIModule/CMakeLists.txt b/Tests/FindPython/Python2SABIModule/CMakeLists.txt index 4f01197..ffbaa33 100644 --- a/Tests/FindPython/Python2SABIModule/CMakeLists.txt +++ b/Tests/FindPython/Python2SABIModule/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython2SABIModule LANGUAGES C) diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt index e40557d..42d31f2 100644 --- a/Tests/FindPython/Python3/CMakeLists.txt +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython3 LANGUAGES C) diff --git a/Tests/FindPython/Python3Embedded/CMakeLists.txt b/Tests/FindPython/Python3Embedded/CMakeLists.txt index c45bd8c..1d362be 100644 --- a/Tests/FindPython/Python3Embedded/CMakeLists.txt +++ b/Tests/FindPython/Python3Embedded/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython3Embedded LANGUAGES C) diff --git a/Tests/FindPython/Python3Fail/CMakeLists.txt b/Tests/FindPython/Python3Fail/CMakeLists.txt index cd46c88..5eca0cb 100644 --- a/Tests/FindPython/Python3Fail/CMakeLists.txt +++ b/Tests/FindPython/Python3Fail/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython3Fail C) diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt index ccc1fdb..57c0ddf 100644 --- a/Tests/FindPython/Python3Module/CMakeLists.txt +++ b/Tests/FindPython/Python3Module/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython3Module LANGUAGES C) diff --git a/Tests/FindPython/Python3SABIModule/CMakeLists.txt b/Tests/FindPython/Python3SABIModule/CMakeLists.txt index 2a067d0..1a909ec 100644 --- a/Tests/FindPython/Python3SABIModule/CMakeLists.txt +++ b/Tests/FindPython/Python3SABIModule/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestPython3SABIModule LANGUAGES C) diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt index 42d282d..cb9d4d3 100644 --- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestRequiredArtifacts LANGUAGES C) diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt index bb4f67c..4d9c7c8 100644 --- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestRequiredArtifacts.Check LANGUAGES C) diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt index 84f7362..60399d3 100644 --- a/Tests/FindPython/SOABI/CMakeLists.txt +++ b/Tests/FindPython/SOABI/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestSOABI LANGUAGES C) diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt index dae3282..e2e5bd2 100644 --- a/Tests/FindPython/VirtualEnv/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestVirtualEnv LANGUAGES NONE) diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt index 23d208d..2f7c0db 100644 --- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestVirtualEnvConda LANGUAGES NONE) diff --git a/Tests/FindSDL/Test/CMakeLists.txt b/Tests/FindSDL/Test/CMakeLists.txt index 61d4f4b..0dd1047 100644 --- a/Tests/FindSDL/Test/CMakeLists.txt +++ b/Tests/FindSDL/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindSDL C) include(CTest) diff --git a/Tests/FindSQLite3/Test/CMakeLists.txt b/Tests/FindSQLite3/Test/CMakeLists.txt index bcc6ebd..43cdd37 100644 --- a/Tests/FindSQLite3/Test/CMakeLists.txt +++ b/Tests/FindSQLite3/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) project(TestFindSQLite3 C) include(CTest) diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt index e235db3..54404d0 100644 --- a/Tests/FindTIFF/Test/CMakeLists.txt +++ b/Tests/FindTIFF/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindTIFF) include(CTest) diff --git a/Tests/FindThreads/C-only/CMakeLists.txt b/Tests/FindThreads/C-only/CMakeLists.txt index ee2a5f9..9bc50a4 100644 --- a/Tests/FindThreads/C-only/CMakeLists.txt +++ b/Tests/FindThreads/C-only/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(FindThreads_C-only C) find_package(Threads REQUIRED) diff --git a/Tests/FindThreads/CXX-only/CMakeLists.txt b/Tests/FindThreads/CXX-only/CMakeLists.txt index 3c6cc1e..11ae60c 100644 --- a/Tests/FindThreads/CXX-only/CMakeLists.txt +++ b/Tests/FindThreads/CXX-only/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(FindThreads_CXX-only CXX) find_package(Threads REQUIRED) diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt index dfcfc15..7198d22 100644 --- a/Tests/FindVulkan/Test/CMakeLists.txt +++ b/Tests/FindVulkan/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.5) cmake_policy(SET CMP0091 NEW) project(TestFindVulkan C CXX) include(CTest) diff --git a/Tests/FindXalanC/Test/CMakeLists.txt b/Tests/FindXalanC/Test/CMakeLists.txt index a8c2a0a..eb45802 100644 --- a/Tests/FindXalanC/Test/CMakeLists.txt +++ b/Tests/FindXalanC/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindXalanC CXX) include(CTest) diff --git a/Tests/FindXercesC/Test/CMakeLists.txt b/Tests/FindXercesC/Test/CMakeLists.txt index 267c6a9..38ae6e4 100644 --- a/Tests/FindXercesC/Test/CMakeLists.txt +++ b/Tests/FindXercesC/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(TestFindXercesC CXX) include(CTest) diff --git a/Tests/FindwxWidgets/CMakeLists.txt b/Tests/FindwxWidgets/CMakeLists.txt new file mode 100644 index 0000000..b66f838 --- /dev/null +++ b/Tests/FindwxWidgets/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindwxWidgets.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindwxWidgets/Test" + "${CMake_BINARY_DIR}/Tests/FindwxWidgets/Test" + ${build_generator_args} + --build-project TestFindwxWidgets + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindwxWidgets/Test/CMakeLists.txt b/Tests/FindwxWidgets/Test/CMakeLists.txt new file mode 100644 index 0000000..ecc9c36 --- /dev/null +++ b/Tests/FindwxWidgets/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.26) +project(TestFindwxWidgets CXX) +include(CTest) + +find_package(wxWidgets REQUIRED) + +add_executable(test_tgt main.cpp) +target_link_libraries(test_tgt wxWidgets::wxWidgets) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.cpp) +target_link_libraries(test_var PRIVATE ${wxWidgets_LIBRARIES}) +target_link_directories(test_var PRIVATE ${wxWidgets_LIBRARY_DIRS}) +target_include_directories(test_var PRIVATE ${wxWidgets_INCLUDE_DIRS}) +target_compile_options(test_var PRIVATE ${wxWidgets_CONFIG_OPTIONS}) +target_compile_definitions(test_var PRIVATE ${wxWidgets_DEFINITIONS}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindwxWidgets/Test/main.cpp b/Tests/FindwxWidgets/Test/main.cpp new file mode 100644 index 0000000..0e576cf --- /dev/null +++ b/Tests/FindwxWidgets/Test/main.cpp @@ -0,0 +1,7 @@ +#include <wx/filefn.h> + +int main() +{ + wxGetCwd(); + return 0; +} diff --git a/Tests/FortranC/CMakeLists.txt b/Tests/FortranC/CMakeLists.txt index 1403aa0..f5e056b 100644 --- a/Tests/FortranC/CMakeLists.txt +++ b/Tests/FortranC/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(FortranC C Fortran) # Skip this test for compilers not known to be compatible. diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index d749fe1..ed2a440 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(FortranOnly Fortran) message("CTEST_FULL_OUTPUT ") diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index 287be94..629deeb 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(Framework) add_library(foo SHARED diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt index 0660d0f..a5a8b11 100644 --- a/Tests/FunctionTest/CMakeLists.txt +++ b/Tests/FunctionTest/CMakeLists.txt @@ -1,5 +1,5 @@ # a simple C only test case -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project (FunctionTest) function(FAILED testname) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 3fb53d1..ef115e6 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -200,6 +200,21 @@ set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION fallback_loc) set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG) set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_RELEASE "") +add_library(importedFallback2 SHARED IMPORTED) +set_property(TARGET importedFallback2 PROPERTY ENABLE_EXPORTS TRUE) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION_NOCONFIG noconfig_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_NOCONFIG noconfig_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_DEBUG debug_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_RELEASE release_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION fallback_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB fallback_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_SPECIAL special_imp) +set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_NOCONFIG SPECIAL "") +set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_DEBUG SPECIAL "") +set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_RELEASE SPECIAL "") + add_library(importedFallback_genex STATIC IMPORTED) set_property(TARGET importedFallback_genex PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET importedFallback_genex PROPERTY IMPORTED_LOCATION_RELEASE release_loc) @@ -217,6 +232,7 @@ add_custom_target(check-part3 ALL -Dconfig=$<CONFIGURATION> -Dtest_imported_includes=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -Dtest_imported_fallback=$<STREQUAL:$<TARGET_FILE_NAME:importedFallback>,fallback_loc> + -Dtest_imported_fallback2=$<IF:$<OR:$<PLATFORM_ID:Windows,CYGWIN,MSYS>,$<AND:$<PLATFORM_ID:Darwin>,$<BOOL:${CMAKE_TAPI}>>>,$<STREQUAL:$<TARGET_LINKER_FILE_NAME:importedFallback2>,special_imp>,$<STREQUAL:$<TARGET_LINKER_FILE_NAME:importedFallback2>,fallback_loc>> -Dtest_imported_fallback_genex=$<STREQUAL:$<TARGET_PROPERTY:importedFallback_genex,INTERFACE_COMPILE_DEFINITIONS>,FOOBAR=1> -Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>> -Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>> diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index e1b1f93..7bb0d85 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -19,6 +19,7 @@ else() endif() check(test_imported_fallback "1") +check(test_imported_fallback2 "1") check(test_imported_fallback_genex "1") check(test_alias_file_exe "1") diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt index e4973b0..d4720be 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(SystemIncludeDirectories) diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt index 3b994a2..6812267 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(TargetIncludeDirectories) diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index a302c7c..d57eccc 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(InterfaceLibrary) diff --git a/Tests/JCTest/CMakeLists.txt b/Tests/JCTest/CMakeLists.txt index b120640..adbdf9a 100644 --- a/Tests/JCTest/CMakeLists.txt +++ b/Tests/JCTest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(TestTime) enable_testing() add_executable(TestTime TestTime.cxx) diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt index 1d8d7ac..c1c6817 100644 --- a/Tests/Java/CMakeLists.txt +++ b/Tests/Java/CMakeLists.txt @@ -1,6 +1,6 @@ project(hello Java) -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) set(CMAKE_VERBOSE_MAKEFILE 1) include(CTest) diff --git a/Tests/JavaJavah/CMakeLists.txt b/Tests/JavaJavah/CMakeLists.txt index b56cc21..06fc06a 100644 --- a/Tests/JavaJavah/CMakeLists.txt +++ b/Tests/JavaJavah/CMakeLists.txt @@ -1,6 +1,6 @@ project(helloJavah Java CXX) -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) set(CMAKE_VERBOSE_MAKEFILE 1) include(CTest) diff --git a/Tests/JavaNativeHeaders/CMakeLists.txt b/Tests/JavaNativeHeaders/CMakeLists.txt index 2471e01..8a2e460 100644 --- a/Tests/JavaNativeHeaders/CMakeLists.txt +++ b/Tests/JavaNativeHeaders/CMakeLists.txt @@ -1,6 +1,6 @@ project(helloJavaNativeHeaders Java CXX) -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) set(CMAKE_VERBOSE_MAKEFILE 1) include (CTest) diff --git a/Tests/LinkDirectory/CMakeLists.txt b/Tests/LinkDirectory/CMakeLists.txt index d9a8ac8..2c2e488 100644 --- a/Tests/LinkDirectory/CMakeLists.txt +++ b/Tests/LinkDirectory/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(LinkDirectory C) # Put the subproject source tree in our build tree so it can refer to diff --git a/Tests/LinkDirectory/External/CMakeLists.txt b/Tests/LinkDirectory/External/CMakeLists.txt index e222929..431fd89 100644 --- a/Tests/LinkDirectory/External/CMakeLists.txt +++ b/Tests/LinkDirectory/External/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(LinkDirectoryExternal C) diff --git a/Tests/LinkFlags/CMakeLists.txt b/Tests/LinkFlags/CMakeLists.txt index de853cf..c25c4b2 100644 --- a/Tests/LinkFlags/CMakeLists.txt +++ b/Tests/LinkFlags/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(LinkFlags C) string(TOUPPER "${TEST_CONFIG}" TEST_CONFIG_UPPER) diff --git a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt index cafa99b..3313c57 100644 --- a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CMAKE_LOADED_COMMANDS) if (MUDSLIDE_TYPE MATCHES MUCHO) diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index e1c4998..c0dc247 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) +cmake_policy(SET CMP0031 OLD) # testing the old behavior project(LoadCommand) # set a definition diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt index dc029a4..74a1f55 100644 --- a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(CMAKE_LOADED_COMMANDS) if (MUDSLIDE_TYPE MATCHES MUCHO) diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt index fef4bb7..35dc0fe 100644 --- a/Tests/LoadCommandOneConfig/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) +cmake_policy(SET CMP0031 OLD) # testing the old behavior project(LoadCommand) # set a definition diff --git a/Tests/MFC/CMakeLists.txt b/Tests/MFC/CMakeLists.txt index d17b955..3f78a81 100644 --- a/Tests/MFC/CMakeLists.txt +++ b/Tests/MFC/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(mfc_driver) include(CTest) diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in index a600c63..bae3d2f 100644 --- a/Tests/MFC/CMakeLists.txt.in +++ b/Tests/MFC/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(mfc1) macro(replace_flags var these those) diff --git a/Tests/MFC/try_compile/CMakeLists.txt b/Tests/MFC/try_compile/CMakeLists.txt index 768d2a6..d22b8b6 100644 --- a/Tests/MFC/try_compile/CMakeLists.txt +++ b/Tests/MFC/try_compile/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(try_compile_mfc) set(files diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt index c9d3f2c..7af746c 100644 --- a/Tests/MacRuntimePath/A/CMakeLists.txt +++ b/Tests/MacRuntimePath/A/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(MacRuntimePath_A) # a shared library diff --git a/Tests/MacRuntimePath/B/CMakeLists.txt b/Tests/MacRuntimePath/B/CMakeLists.txt index 85598c4..e88433c 100644 --- a/Tests/MacRuntimePath/B/CMakeLists.txt +++ b/Tests/MacRuntimePath/B/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(MacRuntimePath_B) include(${MacRuntimePath_B_BINARY_DIR}/../Root/lib/exp.cmake) diff --git a/Tests/MakeClean/CMakeLists.txt b/Tests/MakeClean/CMakeLists.txt index 809d65b..b7b9602 100644 --- a/Tests/MakeClean/CMakeLists.txt +++ b/Tests/MakeClean/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(MakeClean) # Build the to-clean project. diff --git a/Tests/MissingSourceFile/CMakeLists.txt b/Tests/MissingSourceFile/CMakeLists.txt index b4f0033..f4fd8b0 100644 --- a/Tests/MissingSourceFile/CMakeLists.txt +++ b/Tests/MissingSourceFile/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(MissingSourceFile C) add_executable(MissingSourceFile DoesNotExist/MissingSourceFile.c) diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt index 483bd8b..49577a7 100644 --- a/Tests/ModuleDefinition/CMakeLists.txt +++ b/Tests/ModuleDefinition/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ModuleDefinition C) # Test .def file source recognition for DLLs. diff --git a/Tests/NewlineArgs/CMakeLists.txt b/Tests/NewlineArgs/CMakeLists.txt index 3e4b436..c822113 100644 --- a/Tests/NewlineArgs/CMakeLists.txt +++ b/Tests/NewlineArgs/CMakeLists.txt @@ -1,5 +1,5 @@ # a simple CXX only test case -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project (NewlineArgs CXX) add_definitions("-DTEST_FLAG_1 diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 06167a8..05a35bb 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ObjectLibrary C) add_subdirectory(A) diff --git a/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt b/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt index fb0ebc0..f19d5a4 100644 --- a/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt +++ b/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ExportLanguages CXX) add_library(ExportLanguagesA OBJECT a.cxx) add_library(ExportLanguagesB STATIC a.c $<TARGET_OBJECTS:ExportLanguagesA>) diff --git a/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt b/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt index 8544798..093aca6 100644 --- a/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt +++ b/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(ExportLanguagesTest) diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index 5aa2459..81207bc 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) -cmake_policy(SET CMP0054 NEW) +cmake_minimum_required(VERSION 3.5) project(PDBDirectoryAndName C) # Make sure the proper compiler is in use. diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index c2f43cd..a62e53f 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) -cmake_policy(SET CMP0054 NEW) +cmake_minimum_required (VERSION 3.5) project(Plugin) # Test per-target output directory properties. diff --git a/Tests/Plugin/PluginTest/CMakeLists.txt b/Tests/Plugin/PluginTest/CMakeLists.txt index f00122d..4100683 100644 --- a/Tests/Plugin/PluginTest/CMakeLists.txt +++ b/Tests/Plugin/PluginTest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(PluginTest) diff --git a/Tests/PositionIndependentTargets/CMakeLists.txt b/Tests/PositionIndependentTargets/CMakeLists.txt index ff779d3..4f7e285 100644 --- a/Tests/PositionIndependentTargets/CMakeLists.txt +++ b/Tests/PositionIndependentTargets/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(PositionIndependentTargets) diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index 84ca5e8..63a7b5e 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) +cmake_policy(SET CMP0043 OLD) # testing the old behavior + project(Preprocess) # This test is meant both as a test and as a reference for supported diff --git a/Tests/Qt4And5Automoc/CMakeLists.txt b/Tests/Qt4And5Automoc/CMakeLists.txt index ad74961..12dc99b 100644 --- a/Tests/Qt4And5Automoc/CMakeLists.txt +++ b/Tests/Qt4And5Automoc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(Qt4And5Automoc) diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt index 3ddc345..83cd44f 100644 --- a/Tests/Qt4Targets/CMakeLists.txt +++ b/Tests/Qt4Targets/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(Qt4Targets) diff --git a/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt index 65e2b64..d0e9617 100644 --- a/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt +++ b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(IncrementalMoc) find_package(Qt4 REQUIRED) diff --git a/Tests/QtAutomocNoQt/CMakeLists.txt b/Tests/QtAutomocNoQt/CMakeLists.txt index 655f12b..4e2ceeb 100644 --- a/Tests/QtAutomocNoQt/CMakeLists.txt +++ b/Tests/QtAutomocNoQt/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(QtAutomocNoQt) diff --git a/Tests/ReturnTest/CMakeLists.txt b/Tests/ReturnTest/CMakeLists.txt index 78e3fc1..03a0f7a 100644 --- a/Tests/ReturnTest/CMakeLists.txt +++ b/Tests/ReturnTest/CMakeLists.txt @@ -1,5 +1,5 @@ # a simple C only test case -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project (ReturnTest) function (FAILED testname) diff --git a/Tests/RunCMake/AddRunCMakeTest.cmake b/Tests/RunCMake/AddRunCMakeTest.cmake new file mode 100644 index 0000000..c0c3bba --- /dev/null +++ b/Tests/RunCMake/AddRunCMakeTest.cmake @@ -0,0 +1,10 @@ +if(NOT DEFINED RunCMake_TEST_SUITE) + message("Usage: ${CMAKE_COMMAND} -DRunCMake_TEST_SUITE=<test name> -P Tests/RunCMake/AddRunCMakeTestSuite.cmake") +else() + include("Source/CMakeVersion.cmake") + set(RunCMake_TEST_DIR "Tests/RunCMake/${RunCMake_TEST_SUITE}") + file(MAKE_DIRECTORY "${RunCMake_TEST_DIR}") + file(WRITE "${RunCMake_TEST_DIR}/CMakeLists.txt" "cmake_minimum_required(VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR})\nproject(\${RunCMake_TEST} NONE)\ninclude(\${RunCMake_TEST}.cmake)\n") + file(WRITE "${RunCMake_TEST_DIR}/RunCMakeTest.cmake" "include(RunCMake)\n\n# Write your test cases below, like so:\n#\n# run_cmake(TestCaseName)\n") + file(APPEND "Tests/RunCMake/CMakeLists.txt" "add_RunCMake_test(${RunCMake_TEST_SUITE})\n") +endif() diff --git a/Tests/RunCMake/AppleTextStubs/CMakeLists.txt b/Tests/RunCMake/AppleTextStubs/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/AppleTextStubs/Framework-export.cmake b/Tests/RunCMake/AppleTextStubs/Framework-export.cmake new file mode 100644 index 0000000..f75c6d1 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Framework-export.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +set_property(TARGET foo PROPERTY FRAMEWORK TRUE) +set_property(TARGET foo PROPERTY ENABLE_EXPORTS TRUE) +set_property(TARGET foo PROPERTY LIBRARY_OUTPUT_DIRECTORY $<CONFIG>) + +install(TARGETS foo EXPORT foo FRAMEWORK DESTINATION DESTINATION "${CMAKE_BINARY_DIR}/$<CONFIG>") +install(EXPORT foo DESTINATION lib/foo NAMESPACE foo-install::) +install(FILES foo-config.cmake.in RENAME foo-config.cmake DESTINATION lib/foo) + +export(TARGETS foo NAMESPACE foo-build:: FILE Release/foo.cmake) diff --git a/Tests/RunCMake/AppleTextStubs/Framework-import.cmake b/Tests/RunCMake/AppleTextStubs/Framework-import.cmake new file mode 100644 index 0000000..e0001d0 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Framework-import.cmake @@ -0,0 +1,62 @@ +enable_language(C) + +find_package(foo REQUIRED CONFIG NO_DEFAULT_PATH) + +add_executable(main main.c) +target_link_libraries(main PRIVATE foo-install::foo) + +get_property(is_framework TARGET foo-install::foo PROPERTY FRAMEWORK) +if (NOT is_framework) + message(SEND_ERROR "foo-build::foo: FRAMEWORK not set.") +endif() +get_property(enable_exports TARGET foo-install::foo PROPERTY ENABLE_EXPORTS) +if (CAMKE_TAPI AND NOT enable_exports) + message(SEND_ERROR "foo-install::foo: ENABLE_EXPORTS not set.") +endif() + +get_property(implib TARGET foo-install::foo PROPERTY IMPORTED_IMPLIB_RELEASE) +if (CAMKE_TAPI AND NOT implib) + message(SEND_ERROR "foo-install::foo: IMPORTED_IMPLIB_RELEASE not set.") +endif() +if (CAMKE_TAPI AND NOT implib MATCHES "foo.framework/Versions/A/foo.tbd$") + message(SEND_ERROR "foo-install::foo: ${implib}: wrong value for IMPORTED_IMPLIB_RELEASE.") +endif() + +get_property(location TARGET foo-install::foo PROPERTY IMPORTED_LOCATION_RELEASE) +if (NOT location) + message(SEND_ERROR "foo-install::foo: IMPORTED_LOCATION_RELEASE not set.") +endif() +if (NOT location MATCHES "foo.framework/Versions/A/foo$") + message(SEND_ERROR "foo-install::foo: ${location}: wrong value for IMPORTED_LOCATION_RELEASE.") +endif() + + +include(${foo_BUILD}/foo.cmake) + +add_executable(main2 main.c) +target_link_libraries(main2 PRIVATE foo-build::foo) + +get_property(is_framework TARGET foo-build::foo PROPERTY FRAMEWORK) +if (NOT is_framework) + message(SEND_ERROR "foo-build::foo: FRAMEWORK not set.") +endif() +get_property(enable_exports TARGET foo-build::foo PROPERTY ENABLE_EXPORTS) +if (CAMKE_TAPI AND NOT enable_exports) + message(SEND_ERROR "foo-build::foo: ENABLE_EXPORTS not set.") +endif() + +get_property(implib TARGET foo-build::foo PROPERTY IMPORTED_IMPLIB_RELEASE) +if (CAMKE_TAPI AND NOT implib) + message(SEND_ERROR "foo-build::foo: IMPORTED_IMPLIB_RELEASE not set.") +endif() +if (CAMKE_TAPI AND NOT implib STREQUAL "${foo_BUILD}/foo.framework/Versions/A/foo.tbd") + message(SEND_ERROR "foo-build::foo: ${implib}: wrong value for IMPORTED_IMPLIB_RELEASE.") +endif() + +get_property(location TARGET foo-build::foo PROPERTY IMPORTED_LOCATION_RELEASE) +if (NOT location) + message(SEND_ERROR "foo-build::foo: IMPORTED_LOCATION_RELEASE not set.") +endif() +if (NOT location STREQUAL "${foo_BUILD}/foo.framework/Versions/A/foo") + message(SEND_ERROR "foo-build::foo: ${location}: wrong value for IMPORTED_LOCATION_RELEASE.") +endif() diff --git a/Tests/RunCMake/AppleTextStubs/Framework-install-check.cmake b/Tests/RunCMake/AppleTextStubs/Framework-install-check.cmake new file mode 100644 index 0000000..e8a5557 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Framework-install-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/Framework-Release-generated.cmake") diff --git a/Tests/RunCMake/AppleTextStubs/Framework.cmake b/Tests/RunCMake/AppleTextStubs/Framework.cmake new file mode 100644 index 0000000..f99eb5e --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Framework.cmake @@ -0,0 +1,59 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +set_property(TARGET foo PROPERTY ENABLE_EXPORTS TRUE) +set_property(TARGET foo PROPERTY FRAMEWORK TRUE) + +add_executable(main main.c) +target_link_libraries(main PRIVATE foo) + + +install(TARGETS foo FRAMEWORK DESTINATION "${CMAKE_BINARY_DIR}/INSTALL") + +# LIBRARY and ARCHIVE should be ignored +install(TARGETS foo FRAMEWORK DESTINATION "${CMAKE_BINARY_DIR}/INSTALL2" + LIBRARY DESTINATION "${CMAKE_BINARY_DIR}/INSTALL2/lib" + ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}/INSTALL2/dev") + + +set (GENERATE_CONTENT "if (\"${CMAKE_TAPI}\") + set (APPLE_TEXT_STUBS_SUPPORTED TRUE) +endif()\n\n") + +string (APPEND GENERATE_CONTENT [[ +macro (CHECK_FILE test_msg path) + if (NOT EXISTS "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" not found\n") + endif() +endmacro() + +macro (CHECK_SYMLINK test_msg path) + if(NOT IS_SYMLINK "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" is not a symbolic link\n") + elseif (NOT EXISTS "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" is not a valid symlink\n") + endif() +endmacro() + +check_file("DYLIB file" "$<TARGET_FILE:foo>") +check_symlink("Public DYLIB file" "$<TARGET_LINKER_LIBRARY_FILE:foo>") +check_file("executable file" "$<TARGET_FILE:main>") + +check_file("Installed DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/foo.framework/Versions/A/$<TARGET_FILE_NAME:foo>") +check_symlink("Installed Public DULIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/foo.framework/$<TARGET_FILE_NAME:foo>") +check_file("Installed DULIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/foo.framework/Versions/A/$<TARGET_FILE_NAME:foo>") +check_symlink("Installed Public DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/foo.framework/$<TARGET_FILE_NAME:foo>") + +if (APPLE_TEXT_STUBS_SUPPORTED) + check_file("TBD file" "$<TARGET_IMPORT_FILE:foo>") + check_symlink("Public TBD file" "$<TARGET_LINKER_IMPORT_FILE:foo>") + + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/foo.framework/Versions/A/$<TARGET_IMPORT_FILE_NAME:foo>") + check_symlink("Installed Public TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/foo.framework/$<TARGET_IMPORT_FILE_NAME:foo>") + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/foo.framework/Versions/A/$<TARGET_IMPORT_FILE_NAME:foo>") + check_symlink("Installed Public TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/foo.framework/$<TARGET_IMPORT_FILE_NAME:foo>") +endif() +]]) + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Framework-$<CONFIG>-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/AppleTextStubs/Library-export.cmake b/Tests/RunCMake/AppleTextStubs/Library-export.cmake new file mode 100644 index 0000000..d2e09ea --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Library-export.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +set_property(TARGET foo PROPERTY ENABLE_EXPORTS TRUE) +set_property(TARGET foo PROPERTY LIBRARY_OUTPUT_DIRECTORY $<CONFIG>) +set_property(TARGET foo PROPERTY ARCHIVE_OUTPUT_DIRECTORY $<CONFIG>) + +install(TARGETS foo EXPORT foo DESTINATION "${CMAKE_BINARY_DIR}/$<CONFIG>") +install(EXPORT foo DESTINATION lib/foo NAMESPACE foo-install::) +install(FILES foo-config.cmake.in RENAME foo-config.cmake DESTINATION lib/foo) + +export(TARGETS foo NAMESPACE foo-build:: FILE Release/foo.cmake) diff --git a/Tests/RunCMake/AppleTextStubs/Library-import.cmake b/Tests/RunCMake/AppleTextStubs/Library-import.cmake new file mode 100644 index 0000000..9406aac --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Library-import.cmake @@ -0,0 +1,54 @@ +enable_language(C) + +find_package(foo REQUIRED CONFIG NO_DEFAULT_PATH) + +add_executable(main main.c) +target_link_libraries(main PRIVATE foo-install::foo) + +get_property(enable_exports TARGET foo-install::foo PROPERTY ENABLE_EXPORTS) +if (CMAKE_TAPI AND NOT enable_exports) + message(SEND_ERROR "foo-install::foo: ENABLE_EXPORTS not set.") +endif() + +get_property(implib TARGET foo-install::foo PROPERTY IMPORTED_IMPLIB_RELEASE) +if (CMAKE_TAPI AND NOT implib) + message(SEND_ERROR "foo-install::foo: IMPORTED_IMPLIB_RELEASE not set.") +endif() +if (CMAKE_TAPI AND NOT implib MATCHES "Release/libfoo.tbd$") + message(SEND_ERROR "foo-install::foo: ${implib}: wrong value for IMPORTED_IMPLIB_RELEASE.") +endif() + +get_property(location TARGET foo-install::foo PROPERTY IMPORTED_LOCATION_RELEASE) +if (NOT location) + message(SEND_ERROR "foo-install::foo: IMPORTED_LOCATION_RELEASE not set.") +endif() +if (NOT location MATCHES "Release/libfoo.dylib$") + message(SEND_ERROR "foo-install::foo: ${location}: wrong value for IMPORTED_LOCATION_RELEASE.") +endif() + + +include(${foo_BUILD}/foo.cmake) + +add_executable(main2 main.c) +target_link_libraries(main2 PRIVATE foo-build::foo) + +get_property(enable_exports TARGET foo-build::foo PROPERTY ENABLE_EXPORTS) +if (CMAKE_TAPI AND NOT enable_exports) + message(SEND_ERROR "foo-build::foo: ENABLE_EXPORTS not set.") +endif() + +get_property(implib TARGET foo-build::foo PROPERTY IMPORTED_IMPLIB_RELEASE) +if (CMAKE_TAPI AND NOT implib) + message(SEND_ERROR "foo-build::foo: IMPORTED_IMPLIB_RELEASE not set.") +endif() +if (CMAKE_TAPI AND NOT implib STREQUAL "${foo_BUILD}/libfoo.tbd") + message(SEND_ERROR "foo-build::foo: ${implib}: wrong value for IMPORTED_IMPLIB_RELEASE.") +endif() + +get_property(location TARGET foo-build::foo PROPERTY IMPORTED_LOCATION_RELEASE) +if (NOT location) + message(SEND_ERROR "foo-build::foo: IMPORTED_LOCATION_RELEASE not set.") +endif() +if (NOT location STREQUAL "${foo_BUILD}/libfoo.dylib") + message(SEND_ERROR "foo-build::foo: ${location}: wrong value for IMPORTED_LOCATION_RELEASE.") +endif() diff --git a/Tests/RunCMake/AppleTextStubs/LibraryWithOutputs-install-check.cmake b/Tests/RunCMake/AppleTextStubs/LibraryWithOutputs-install-check.cmake new file mode 100644 index 0000000..40ec0a6 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/LibraryWithOutputs-install-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/LibraryWithOutputs-Release-generated.cmake") diff --git a/Tests/RunCMake/AppleTextStubs/LibraryWithOutputs.cmake b/Tests/RunCMake/AppleTextStubs/LibraryWithOutputs.cmake new file mode 100644 index 0000000..f61c8f2 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/LibraryWithOutputs.cmake @@ -0,0 +1,52 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +set_property(TARGET foo PROPERTY ENABLE_EXPORTS TRUE) +set_property(TARGET foo PROPERTY ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/TBD/$<CONFIG>") +set_property(TARGET foo PROPERTY ARCHIVE_OUTPUT_NAME "tbd") + +add_executable(main main.c) +target_link_libraries(main PRIVATE foo) + + +set (GENERATE_CONTENT "if (\"${CMAKE_TAPI}\") + set (APPLE_TEXT_STUBS_SUPPORTED TRUE) +endif()\n\n") + +string (APPEND GENERATE_CONTENT [[ +macro (CHECK_FILE test_msg path) + if (NOT EXISTS "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" not found\n") + endif() +endmacro() + +check_file("DYLIB file" "$<TARGET_FILE:foo>") +check_file("executable file" "$<TARGET_FILE:main>") + +if (APPLE_TEXT_STUBS_SUPPORTED) + check_file("TBD file" "$<TARGET_IMPORT_FILE:foo>") +]]) + +if (CMAKE_GENERATOR STREQUAL "Xcode") + # ARCHIVE outputs are ignored by this generator + string (APPEND GENERATE_CONTENT + "\n if (NOT \"$<TARGET_IMPORT_FILE_DIR:foo>\" STREQUAL \"${CMAKE_BINARY_DIR}/$<CONFIG>\") + string (APPEND RunCMake_TEST_FAILED \"Wrong directory for TBD file: \\\"$<TARGET_IMPORT_FILE_DIR:foo>\\\"\n\") + endif() + if (NOT \"$<TARGET_IMPORT_FILE_BASE_NAME:foo>\" STREQUAL \"foo\") + string (APPEND RunCMake_TEST_FAILED \"Wrong base name for TBD file: \\\"$<TARGET_IMPORT_FILE_BASE_NAME:foo>\\\"\n\") + endif()\n") +else() + string (APPEND GENERATE_CONTENT + "\n if (NOT \"$<TARGET_IMPORT_FILE_DIR:foo>\" STREQUAL \"${CMAKE_BINARY_DIR}/TBD/$<CONFIG>\") + string (APPEND RunCMake_TEST_FAILED \"Wrong directory for TBD file: \\\"$<TARGET_IMPORT_FILE_DIR:foo>\\\"\n\") + endif() + if (NOT \"$<TARGET_IMPORT_FILE_BASE_NAME:foo>\" STREQUAL \"tbd\") + string (APPEND RunCMake_TEST_FAILED \"Wrong base name for TBD file: \\\"$<TARGET_IMPORT_FILE_BASE_NAME:foo>\\\"\n\") + endif()\n") +endif() +string (APPEND GENERATE_CONTENT "endif()\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/LibraryWithOutputs-$<CONFIG>-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/AppleTextStubs/LibraryWithVersions-install-check.cmake b/Tests/RunCMake/AppleTextStubs/LibraryWithVersions-install-check.cmake new file mode 100644 index 0000000..af73286 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/LibraryWithVersions-install-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/LibraryWithVersions-Release-generated.cmake") diff --git a/Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake b/Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake new file mode 100644 index 0000000..28c175d --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake @@ -0,0 +1,96 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +set_property(TARGET foo PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET foo PROPERTY VERSION 2.5.0) +set_property (TARGET foo PROPERTY SOVERSION 2.0.0) + +add_executable(main main.c) +target_link_libraries(main PRIVATE foo) + + +install(TARGETS foo DESTINATION "${CMAKE_BINARY_DIR}/INSTALL" COMPONENT default) + +install(TARGETS foo ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}/INSTALL2/dev1" NAMELINK_SKIP COMPONENT default) +install(TARGETS foo ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}/INSTALL2/dev2" NAMELINK_ONLY COMPONENT default) + +install(TARGETS foo ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}/INSTALL3" + COMPONENT lib3 NAMELINK_COMPONENT dev3) +install(TARGETS foo ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}/INSTALL4" + COMPONENT lib4 NAMELINK_COMPONENT dev4) + + +set (GENERATE_CONTENT "if (\"${CMAKE_TAPI}\") + set (APPLE_TEXT_STUBS_SUPPORTED TRUE) +endif()\n\n") + +string (APPEND GENERATE_CONTENT [[ +cmake_policy (SET CMP0011 NEW) +cmake_policy (SET CMP0057 NEW) + +macro (CHECK_FILE test_msg path) + if (NOT EXISTS "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" not found\n") + endif() +endmacro() + +macro (CHECK_SYMLINK test_msg path) + if (NOT IS_SYMLINK "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" is not a symbolic link\n") + elseif (NOT EXISTS "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" not a valid symlink\n") + endif() +endmacro() + +macro (CHECK_NOFILE test_msg path) + if (EXISTS "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" was found\n") + endif() +endmacro() + +macro (CHECK_INSTALLED test_msg dir file) + file(GLOB installed_files LIST_DIRECTORIES FALSE RELATIVE "${dir}" "${dir}/*") + if (NOT "${file}" IN_LIST installed_files) + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${dir}/${file}\" not found\n") + endif() +endmacro() + + +check_file("DYLIB file" "$<TARGET_FILE:foo>") +check_symlink("Linkable DYLIB file" "$<TARGET_LINKER_LIBRARY_FILE:foo>") +check_symlink("SONAME DYLIB file" "$<TARGET_SONAME_FILE:foo>") +check_file("executable file" "$<TARGET_FILE:main>") + +check_file("Installed DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_FILE_NAME:foo>") +check_symlink("Installed Linkable DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_LINKER_LIBRARY_FILE_NAME:foo>") +check_symlink("Installed SONAME DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_SONAME_FILE_NAME:foo>") + +if (APPLE_TEXT_STUBS_SUPPORTED) + check_file("TBD file" "$<TARGET_IMPORT_FILE:foo>") + check_symlink("Linkable TBD file" "$<TARGET_LINKER_IMPORT_FILE:foo>") + check_symlink("SONAME TBD file" "$<TARGET_SONAME_IMPORT_FILE:foo>") + + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_IMPORT_FILE_NAME:foo>") + check_symlink("Installed Linkable TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_LINKER_IMPORT_FILE_NAME:foo>") + check_symlink("Installed SONAME TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_SONAME_IMPORT_FILE_NAME:foo>") + + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev1/$<TARGET_IMPORT_FILE_NAME:foo>") + check_symlink("Installed SONAME TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev1/$<TARGET_SONAME_IMPORT_FILE_NAME:foo>") + check_nofile("Installed Linkable TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev1/$<TARGET_LINKER_IMPORT_FILE_NAME:foo>") + + check_installed("Installed Linkable TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev2" "$<TARGET_LINKER_IMPORT_FILE_NAME:foo>") + check_nofile("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev2/$<TARGET_IMPORT_FILE_NAME:foo>") + check_nofile("Installed SONAME TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev2/$<TARGET_SONAME_IMPORT_FILE_NAME:foo>") + + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL3/$<TARGET_IMPORT_FILE_NAME:foo>") + check_symlink("Installed SONAME TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL3/$<TARGET_SONAME_IMPORT_FILE_NAME:foo>") + check_nofile("Installed Linkable TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL3/$<TARGET_LINKER_IMPORT_FILE_NAME:foo>") + + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL4/$<TARGET_IMPORT_FILE_NAME:foo>") + check_symlink("Installed SONAME TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL4/$<TARGET_SONAME_IMPORT_FILE_NAME:foo>") + check_symlink("Installed Linkable TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL4/$<TARGET_LINKER_IMPORT_FILE_NAME:foo>") +endif() +]]) + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/LibraryWithVersions-$<CONFIG>-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/AppleTextStubs/RunCMakeTest.cmake b/Tests/RunCMake/AppleTextStubs/RunCMakeTest.cmake new file mode 100644 index 0000000..9ccd685 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/RunCMakeTest.cmake @@ -0,0 +1,58 @@ +include(RunCMake) + +function(build_project test) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + run_cmake(${test}) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Release) + if ("${ARGC}" GREATER "1") + # custom install step + cmake_language(CALL ${ARGV1}) + else() + run_cmake_command(${test}-install ${CMAKE_COMMAND} --install . --config Release) + endif() +endfunction() + +build_project(Simple) +build_project(Framework) +build_project(LibraryWithOutputs) + + +function(LibraryWithVersions-install) + run_cmake_command(LibraryWithVersions-install-component-lib3 ${CMAKE_COMMAND} --install . --config Release --component lib3) + run_cmake_command(LibraryWithVersions-install-component-lib4 ${CMAKE_COMMAND} --install . --config Release --component lib4) + run_cmake_command(LibraryWithVersions-install-components-dev4 ${CMAKE_COMMAND} --install . --config Release --component dev4) + run_cmake_command(LibraryWithVersions-install ${CMAKE_COMMAND} --install . --config Release --component default) +endfunction() + +build_project(LibraryWithVersions LibraryWithVersions-install) + + +function(build_ExportImport_project test) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-export-build) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + run_cmake(${test}-export) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-export-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(${test}-export-install ${CMAKE_COMMAND} --install . --prefix ${CMAKE_INSTALL_PREFIX} --config Release) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-import-build) + set (foo_BUILD "${RunCMake_BINARY_DIR}/${test}-export-build") + if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + string (APPEND foo_BUILD "/Release") + endif() + run_cmake_with_options(${test}-import -Dfoo_DIR=${CMAKE_INSTALL_PREFIX}/lib/foo + -Dfoo_BUILD=${RunCMake_BINARY_DIR}/${test}-export-build/Release) + run_cmake_command(${test}-import-build ${CMAKE_COMMAND} --build . --config Release) +endfunction() + +build_ExportImport_project(Library) +build_ExportImport_project(Framework) diff --git a/Tests/RunCMake/AppleTextStubs/Simple-install-check.cmake b/Tests/RunCMake/AppleTextStubs/Simple-install-check.cmake new file mode 100644 index 0000000..94054fa --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Simple-install-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/Simple-Release-generated.cmake") diff --git a/Tests/RunCMake/AppleTextStubs/Simple.cmake b/Tests/RunCMake/AppleTextStubs/Simple.cmake new file mode 100644 index 0000000..9f6318c --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/Simple.cmake @@ -0,0 +1,41 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +set_property(TARGET foo PROPERTY ENABLE_EXPORTS TRUE) + +add_executable(main main.c) +target_link_libraries(main PRIVATE foo) + + +install(TARGETS foo DESTINATION "${CMAKE_BINARY_DIR}/INSTALL") + +install(TARGETS foo LIBRARY DESTINATION "${CMAKE_BINARY_DIR}/INSTALL2/lib" + ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}/INSTALL2/dev") + + +set (GENERATE_CONTENT "if (\"${CMAKE_TAPI}\") + set (APPLE_TEXT_STUBS_SUPPORTED TRUE) +endif()\n\n") + +string (APPEND GENERATE_CONTENT [[ +macro (CHECK_FILE test_msg path) + if (NOT EXISTS "${path}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" not found\n") + endif() +endmacro() + +check_file("DYLIB file" "$<TARGET_FILE:foo>") +check_file("executable file" "$<TARGET_FILE:main>") + +check_file("Installed DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/lib/$<TARGET_FILE_NAME:foo>") + +if (APPLE_TEXT_STUBS_SUPPORTED) + check_file("TBD file" "$<TARGET_IMPORT_FILE:foo>") + + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_IMPORT_FILE_NAME:foo>") + check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev/$<TARGET_IMPORT_FILE_NAME:foo>") +endif() +]]) + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Simple-$<CONFIG>-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/AppleTextStubs/foo-config.cmake.in b/Tests/RunCMake/AppleTextStubs/foo-config.cmake.in new file mode 100644 index 0000000..b038138 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/foo-config.cmake.in @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/foo.cmake) diff --git a/Tests/RunCMake/AppleTextStubs/foo.c b/Tests/RunCMake/AppleTextStubs/foo.c new file mode 100644 index 0000000..7f39d71 --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/foo.c @@ -0,0 +1,5 @@ + +int foo() +{ + return 0; +} diff --git a/Tests/RunCMake/AppleTextStubs/main.c b/Tests/RunCMake/AppleTextStubs/main.c new file mode 100644 index 0000000..dc5ce3d --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/main.c @@ -0,0 +1,7 @@ + +extern int foo(void); + +int main() +{ + return foo(); +} diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt index 8b90311..67d00f7 100644 --- a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt @@ -3,11 +3,9 @@ noexist - Tried extensions [^ -]* - [^ -]* -Call Stack \(most recent call first\): + Tried extensions ([^ +]+ +)+Call Stack \(most recent call first\): CMP0115-OLD\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt index 7b100b6..e79ca97 100644 --- a/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt @@ -17,11 +17,9 @@ CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): noexist - Tried extensions [^ -]* - [^ -]* -Call Stack \(most recent call first\): + Tried extensions ([^ +]+ +)+Call Stack \(most recent call first\): CMP0115-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-stderr.txt index ec777f7..acd145e 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-stderr.txt @@ -1,5 +1,5 @@ ^prop: `0` -CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-build/GeneratedMain\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt index f7d9f6b..929dafd 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt index a876390..6a096b8 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-stderr.txt index b750ae7..e721876 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-stderr.txt @@ -124,7 +124,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) @@ -132,7 +132,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) @@ -140,7 +140,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) @@ -148,7 +148,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) @@ -156,7 +156,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-stderr.txt index 580f04f..f358297 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-stderr.txt @@ -124,7 +124,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) @@ -132,7 +132,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) @@ -140,7 +140,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) @@ -148,7 +148,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) @@ -156,7 +156,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt index e268a7a..0e27c1d 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt @@ -115,7 +115,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -123,7 +123,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -131,7 +131,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -139,7 +139,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -147,7 +147,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -155,7 +155,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -163,7 +163,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-stderr.txt index 08eb682..4de6e76 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-stderr.txt @@ -47,7 +47,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-build/Generated_source[4-6]\.txt @@ -55,7 +55,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-build/Generated_source[4-6]\.txt @@ -63,7 +63,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-stderr.txt index b7c496c..b7a170b 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-stderr.txt @@ -47,7 +47,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-build/Generated_source[4-6]\.txt @@ -55,7 +55,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test9\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-build/Generated_source[4-6]\.txt @@ -63,7 +63,7 @@ Call Stack \(most recent call first\): CMP0118-NEW-Test9\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt index 58144c8..2af72a4 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt @@ -1,5 +1,5 @@ ^prop: `0` -CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-build/GeneratedMain\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt index 1f1bc90..6109f65 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt @@ -40,7 +40,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt index 5c15f12..e5e97de 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt @@ -40,7 +40,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-build/Generated_source[4-6]\.txt @@ -48,7 +48,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test11\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-build/Generated_source[4-6]\.txt @@ -56,7 +56,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test11\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt index 12a913a..f5b3d1a 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt @@ -40,7 +40,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt index 62db7ee..a30bc84 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt @@ -40,7 +40,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-build/Generated_source[4-6]\.txt @@ -48,7 +48,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test15\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-build/Generated_source[4-6]\.txt @@ -56,7 +56,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test15\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt index 7f86d38..4f4fea3 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt index 4104fc0..3c80531 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt index 7a16d0b..9600fee 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) @@ -84,7 +84,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt index 5a5c4ec..e638660 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) @@ -84,7 +84,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt index 12fa617..18e6a8c 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -84,7 +84,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -92,7 +92,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -100,7 +100,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt index 7199f04..a60545f 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt @@ -34,7 +34,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt index 233fd8b..fd496cb 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt @@ -34,7 +34,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt @@ -42,7 +42,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt @@ -50,7 +50,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt @@ -58,7 +58,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt @@ -66,7 +66,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt index 4aed2ed..3505242 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt @@ -34,7 +34,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt index cea8c22..63a9341 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt @@ -34,7 +34,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-build/Generated_source[4-6]\.txt @@ -42,7 +42,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test9\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-build/Generated_source[4-6]\.txt @@ -50,7 +50,7 @@ Call Stack \(most recent call first\): CMP0118-OLD-Test9\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-stderr.txt index e2a2cf5..1d7cbde 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-stderr.txt @@ -1,5 +1,5 @@ ^prop: `0` -CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-build/GeneratedMain\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-stderr.txt index bce7681..f4c7d00 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-stderr.txt @@ -40,7 +40,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt index 00c47e9..93d8b83 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt @@ -63,7 +63,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-build/Generated_source[4-6]\.txt @@ -71,7 +71,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test11\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-build/Generated_source[4-6]\.txt @@ -79,7 +79,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test11\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-stderr.txt index 5b7994c..fdde792 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-stderr.txt @@ -40,7 +40,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt index c975c23..9e6a4a5 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt @@ -63,7 +63,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-build/Generated_source[4-6]\.txt @@ -71,7 +71,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test15\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-build/Generated_source[4-6]\.txt @@ -79,7 +79,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test15\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt index 142d8a0..58ba793 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt index d4ef667..cdb7cb4 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt @@ -52,7 +52,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) @@ -60,7 +60,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) @@ -76,7 +76,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt index ceeb570..4cd401c 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt @@ -169,7 +169,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) @@ -177,7 +177,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) @@ -185,7 +185,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) @@ -193,7 +193,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) @@ -201,7 +201,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt index f8484d0..6acd3df 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt @@ -169,7 +169,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) @@ -177,7 +177,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) @@ -185,7 +185,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) @@ -193,7 +193,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) @@ -201,7 +201,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt index 0556391..2805cbf 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt @@ -154,7 +154,7 @@ Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -162,7 +162,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -170,7 +170,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -178,7 +178,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -186,7 +186,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -194,7 +194,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) @@ -202,7 +202,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-stderr.txt index 7d588a2..6f29170 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-stderr.txt @@ -34,7 +34,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt index 8421061..cde1164 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt @@ -57,7 +57,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt @@ -65,7 +65,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt @@ -73,7 +73,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt @@ -81,7 +81,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt @@ -89,7 +89,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-stderr.txt index e0f17e6..91c4c4c 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-stderr.txt @@ -34,7 +34,7 @@ Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-build/Generated_source4\.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt index 80f3edf..547e820 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt @@ -57,7 +57,7 @@ Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-build/Generated_source[4-6]\.txt @@ -65,7 +65,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test9\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-build/Generated_source[4-6]\.txt @@ -73,7 +73,7 @@ Call Stack \(most recent call first\): CMP0118-WARN-Test9\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-build/Generated_source[4-6]\.txt diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt index d3aa546..5e9cf6c 100644 --- a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt @@ -1,8 +1,5 @@ -^CMake Error at GenInSubdir-Common.cmake:[0-9]+ \(add_custom_target\): +^CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): Cannot find source file: [^ ]*/Tests/RunCMake/CMP0118/GenInSubdir-OLD-build/GenInSubdir/sub.txt -Call Stack \(most recent call first\): - GenInSubdir-OLD.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-WARN-stderr.txt b/Tests/RunCMake/CMP0118/GenInSubdir-WARN-stderr.txt index 5eb8a34..2820ba3 100644 --- a/Tests/RunCMake/CMP0118/GenInSubdir-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0118/GenInSubdir-WARN-stderr.txt @@ -1,8 +1,5 @@ -^CMake Error at GenInSubdir-Common.cmake:[0-9]+ \(add_custom_target\): +^CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): Cannot find source file: [^ ]*/Tests/RunCMake/CMP0118/GenInSubdir-WARN-build/GenInSubdir/sub.txt -Call Stack \(most recent call first\): - GenInSubdir-WARN.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 72de742..0ebb720 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -355,6 +355,7 @@ add_RunCMake_test(GenEx-DEVICE_LINK) add_RunCMake_test(GenEx-LINK_LIBRARY) add_RunCMake_test(GenEx-LINK_GROUP) add_RunCMake_test(GenEx-TARGET_FILE -DLINKER_SUPPORTS_PDB=${LINKER_SUPPORTS_PDB}) +add_RunCMake_test(GenEx-TARGET_IMPORT_FILE) add_RunCMake_test(GenEx-GENEX_EVAL) add_RunCMake_test(GenEx-TARGET_PROPERTY) add_RunCMake_test(GenEx-TARGET_RUNTIME_DLLS) @@ -514,6 +515,7 @@ add_RunCMake_test(BundleUtilities) if(APPLE) add_RunCMake_test(INSTALL_NAME_DIR) add_RunCMake_test(MacOSVersions) + add_RunCMake_test(AppleTextStubs) endif() function(add_RunCMake_test_try_compile) diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake index 276158c..64a961e 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake @@ -18,6 +18,15 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed") endif() + + block() + # Test tolerating a flag that is not used when driving the linker. + string(APPEND CMAKE_C_FLAGS " -nostdinc") + check_compiler_flag(C "-x c" SHOULD_WORK_NOSTDINC) + if(NOT SHOULD_WORK_NOSTDINC) + message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c -nostdinc' check failed") + endif() + endblock() endif() if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here. diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake index dec31ec..0026a2a 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake @@ -18,6 +18,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") endif() + + block() + # Test tolerating a flag that is not used when driving the linker. + string(APPEND CMAKE_CXX_FLAGS " -nostdinc++") + check_compiler_flag(CXX "-x c++" SHOULD_WORK_NOSTDINCXX) + if(NOT SHOULD_WORK_NOSTDINCXX) + message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++ -nostdinc++' check failed") + endif() + endblock() endif() if(NOT "$ENV{LC_ALL}" STREQUAL "BAD") diff --git a/Tests/RunCMake/ExternalProject/InstallBuilds-build-stdout.txt b/Tests/RunCMake/ExternalProject/InstallBuilds-build-stdout.txt new file mode 100644 index 0000000..9618ee3 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/InstallBuilds-build-stdout.txt @@ -0,0 +1,2 @@ +.*build command suppressed +.*always builds diff --git a/Tests/RunCMake/ExternalProject/InstallBuilds.cmake b/Tests/RunCMake/ExternalProject/InstallBuilds.cmake new file mode 100644 index 0000000..405a61a --- /dev/null +++ b/Tests/RunCMake/ExternalProject/InstallBuilds.cmake @@ -0,0 +1,7 @@ +include(ExternalProject) + +ExternalProject_Add(InstallBuilds + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/InstallBuilds + DOWNLOAD_COMMAND "" + BUILD_COMMAND "${CMAKE_COMMAND}" -E echo "build command suppressed" + ) diff --git a/Tests/RunCMake/ExternalProject/InstallBuilds/CMakeLists.txt b/Tests/RunCMake/ExternalProject/InstallBuilds/CMakeLists.txt new file mode 100644 index 0000000..2158cdd --- /dev/null +++ b/Tests/RunCMake/ExternalProject/InstallBuilds/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.24) +project(InstallBuilds NONE) +add_custom_target(always ALL COMMAND ${CMAKE_COMMAND} -E echo "always builds") +install(CODE "") diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index f152f5b..4afdef8 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -147,6 +147,7 @@ endfunction() __ep_test_with_build(MultiCommand) set(RunCMake_TEST_OUTPUT_MERGE 1) +__ep_test_with_build(InstallBuilds) __ep_test_with_build(PreserveEmptyArgs) set(RunCMake_TEST_OUTPUT_MERGE 0) diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt index 2c385c4..b47a137 100644 --- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt @@ -1,11 +1,11 @@ -^CMake Error at SourceProperty-CMP0070-NEW.cmake:[0-9]+ \(add_library\): +^CMake Error at SourceProperty-CMP0070-NEW.cmake:[0-9]+ \(target_sources\): Cannot find source file: .*\/relative-output-NEW\.c - Tried extensions \.c \.C.* -Call Stack \(most recent call first\): + Tried extensions ([^ +]+ +)+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/File_Generate/SourceProperty-CMP0070-NEW.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake index d2b3e0c..16d5563 100644 --- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake @@ -1,5 +1,5 @@ enable_language(C) -add_library(foo) +add_library(foo empty.c) cmake_policy(SET CMP0070 NEW) file(GENERATE OUTPUT relative-output-NEW.c CONTENT "") diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt index fcb53a7..39735d7 100644 --- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt @@ -8,16 +8,15 @@ behavior and not rely on setting a policy to OLD. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) - - -CMake Error at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(add_library\): ++ +CMake Error at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(target_sources\): Cannot find source file: .*\/relative-output-OLD\.c - Tried extensions \.c \.C.* -Call Stack \(most recent call first\): + Tried extensions ([^ +]+ +)+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/File_Generate/SourceProperty-CMP0070-OLD.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake index 48eae1e..4f566b0 100644 --- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake @@ -1,5 +1,5 @@ enable_language(C) -add_library(foo) +add_library(foo empty.c) cmake_policy(SET CMP0070 OLD) file(GENERATE OUTPUT relative-output-OLD.c CONTENT "") diff --git a/Tests/RunCMake/Framework/FrameworkConsumption.cmake b/Tests/RunCMake/Framework/FrameworkConsumption.cmake index a1ce006..2180cf9 100644 --- a/Tests/RunCMake/Framework/FrameworkConsumption.cmake +++ b/Tests/RunCMake/Framework/FrameworkConsumption.cmake @@ -22,10 +22,14 @@ set_target_properties(Gui2 PROPERTIES ) add_executable(app2 main2.c) -set_target_properties(Gui2 PROPERTIES - PUBLIC_HEADER "${input_header}" - FRAMEWORK TRUE +set_target_properties(app2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY bin ) target_link_libraries(app2 PRIVATE Gui2) + + +# Same test with STATIC consumer +add_library(Consumer STATIC consumer.c) + +target_link_libraries(Consumer PRIVATE Gui2) diff --git a/Tests/RunCMake/Framework/consumer.c b/Tests/RunCMake/Framework/consumer.c new file mode 100644 index 0000000..a578976 --- /dev/null +++ b/Tests/RunCMake/Framework/consumer.c @@ -0,0 +1,9 @@ + +#include <Gui2/Gui.h> + +int consumer() +{ + foo(); + + return 0; +} diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake new file mode 100644 index 0000000..04ff640 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake @@ -0,0 +1,21 @@ +include(RunCMake) + +cmake_policy(SET CMP0057 NEW) + +function(run_cmake_with_config test) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + run_cmake(${test}) +endfunction() + +run_cmake(TARGET_LINKER_IMPORT_FILE-non-valid-target) +run_cmake(TARGET_LINKER_LIBRARY_FILE-non-valid-target) +run_cmake_with_config(TARGET_IMPORT_FILE) +run_cmake_with_config(TARGET_IMPORT_FILE_SUFFIX) + +set (Windows_platforms Windows CYGWIN MSYS) +if (NOT CMAKE_HOST_SYSTEM_NAME IN_LIST Windows_platforms) + run_cmake(TARGET_SONAME_IMPORT_FILE-non-valid-target) + run_cmake_with_config(TARGET_SONAME_IMPORT_FILE) +endif() diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE-check.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE-check.cmake new file mode 100644 index 0000000..9a101fc --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_IMPORT_FILE-Release-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE.cmake new file mode 100644 index 0000000..08765a6 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE.cmake @@ -0,0 +1,47 @@ +enable_language(C) + +set (platforms_with_import Windows CYGWIN MSYS) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) +add_executable (exec1 empty.c) + + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_IMPORT_FILE shared library\" \"$<TARGET_IMPORT_FILE:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${platforms_with_import}>,$<TARGET_LINKER_IMPORT_FILE:shared1>,>\") +check_value (\"TARGET_LINKER_FILE shared library\" \"$<TARGET_LINKER_FILE:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${platforms_with_import}>,$<TARGET_LINKER_IMPORT_FILE:shared1>,$<TARGET_LINKER_LIBRARY_FILE:shared1>>\") +check_value (\"TARGET_IMPORT_FILE static library\" \"$<TARGET_IMPORT_FILE:static1>\" \"\") +check_value (\"TARGET_IMPORT_FILE executable\" \"$<TARGET_IMPORT_FILE:exec1>\" \"\")\n") + + +set(lib_with_import ${platforms_with_import}) +set(exec_with_import ${platforms_with_import}) +if (APPLE AND CMAKE_TAPI) + list(APPEND lib_with_import Darwin) +endif() +if (CMAKE_SYSTEM_NAME STREQUAL "AIX") + list(APPEND exec_with_import "AIX") +endif() +set(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS TRUE) +set(CMAKE_EXECUTABLE_ENABLE_EXPORTS TRUE) + +add_library (shared2 SHARED empty.c) +add_executable (exec2 empty.c) + + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_IMPORT_FILE shared library\" \"$<TARGET_IMPORT_FILE:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${lib_with_import}>,$<TARGET_LINKER_IMPORT_FILE:shared2>,>\") +check_value (\"TARGET_LINKER_FILE shared library\" \"$<TARGET_LINKER_FILE:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${lib_with_import}>,$<TARGET_LINKER_IMPORT_FILE:shared2>,$<TARGET_LINKER_LIBRARY_FILE:shared2>>\") +check_value (\"TARGET_IMPORT_FILE executable\" \"$<TARGET_IMPORT_FILE:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${exec_with_import}>,$<TARGET_LINKER_IMPORT_FILE:exec2>,>\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_IMPORT_FILE-$<CONFIG>-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE_SUFFIX-check.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE_SUFFIX-check.cmake new file mode 100644 index 0000000..2a1357a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE_SUFFIX-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_IMPORT_FILE_SUFFIX-Release-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE_SUFFIX.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE_SUFFIX.cmake new file mode 100644 index 0000000..933471b --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_IMPORT_FILE_SUFFIX.cmake @@ -0,0 +1,44 @@ +enable_language (C) + +set (platforms_with_import Windows CYGWIN MSYS) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) +add_executable (exec1 empty.c) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_IMPORT_FILE_SUFFIX executable default\" \"$<TARGET_IMPORT_FILE_SUFFIX:exec1>\" \"\") +check_value (\"TARGET_IMPORT_FILE_SUFFIX shared default\" \"$<TARGET_IMPORT_FILE_SUFFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${platforms_with_import}>,$<TARGET_LINKER_IMPORT_FILE_SUFFIX:shared1>,>\") +check_value (\"TARGET_FILE_SUFFIX static default\" \"$<TARGET_IMPORT_FILE_SUFFIX:static1>\" \"\") +check_value (\"TARGET_IMPORT_FILE_SUFFIX executable default\" \"$<TARGET_IMPORT_FILE_SUFFIX:exec1>\" \"\")\n") + + + +if (APPLE AND CMAKE_TAPI) + list(APPEND platforms_with_import Darwin) +endif() +if (CMAKE_SYSTEM_NAME STREQUAL "AIX") + list(APPEND platforms_with_import AIX) +endif() +set(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS TRUE) +set(CMAKE_EXECUTABLE_ENABLE_EXPORTS TRUE) + +add_library (shared2 SHARED empty.c) +add_executable (exec2 empty.c) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_IMPORT_FILE_SUFFIX executable default\" \"$<TARGET_IMPORT_FILE_SUFFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${platforms_with_import}>,$<TARGET_LINKER_IMPORT_FILE_SUFFIX:exec2>,>\") +check_value (\"TARGET_IMPORT_FILE_SUFFIX shared default\" \"$<TARGET_IMPORT_FILE_SUFFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${platforms_with_import}>,$<TARGET_LINKER_IMPORT_FILE_SUFFIX:shared2>,>\")\n") + + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_IMPORT_FILE_SUFFIX-$<CONFIG>-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target-stderr.txt new file mode 100644 index 0000000..8ba2223 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TARGET_LINKER_IMPORT_FILE-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_LINKER_IMPORT_FILE:exe1> + + TARGET_LINKER_IMPORT_FILE is allowed only for libraries and executables + with ENABLE_EXPORTS. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target.cmake new file mode 100644 index 0000000..3f060cd --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_IMPORT_FILE-non-valid-target.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_executable(exe1 empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_LINKER_IMPORT_FILE:exe1>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target-stderr.txt new file mode 100644 index 0000000..06e7b3a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TARGET_LINKER_LIBRARY_FILE-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_LINKER_LIBRARY_FILE:exe1> + + TARGET_LINKER_LIBRARY_FILE is allowed only for libraries with + ENABLE_EXPORTS. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target.cmake new file mode 100644 index 0000000..bb95546 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_LINKER_LIBRARY_FILE-non-valid-target.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_executable(exe1 empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_LINKER_LIBRARY_FILE:exe1>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-check.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-check.cmake new file mode 100644 index 0000000..ab4443e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_SONAME_IMPORT_FILE-Release-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target-stderr.txt new file mode 100644 index 0000000..0640088 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_SONAME_IMPORT_FILE-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_SONAME_IMPORT_FILE:static1> + + TARGET_SONAME_IMPORT_FILE is allowed only for SHARED libraries. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target.cmake new file mode 100644 index 0000000..cc79580 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE-non-valid-target.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +add_library (static1 STATIC empty.c) +set_property (TARGET static1 PROPERTY VERSION 2.5.0) +set_property (TARGET static1 PROPERTY SOVERSION 2.0.0) + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_SONAME_IMPORT_FILE:static1>]") diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake new file mode 100644 index 0000000..02ba513 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake @@ -0,0 +1,32 @@ +enable_language(C) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_library (shared1 SHARED empty.c) +set_property (TARGET shared1 PROPERTY VERSION 2.5.0) +set_property (TARGET shared1 PROPERTY SOVERSION 2.0.0) + + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_SONAME_IMPORT_FILE shared library\" \"$<TARGET_SONAME_IMPORT_FILE:shared1>\" \"\")\n") + + + +add_library (shared2 SHARED empty.c) +set_property(TARGET shared2 PROPERTY ENABLE_EXPORTS ON) +set_property (TARGET shared2 PROPERTY VERSION 2.5.0) +set_property (TARGET shared2 PROPERTY SOVERSION 2.0.0) + + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_SONAME_IMPORT_FILE shared library\" \"$<TARGET_SONAME_IMPORT_FILE:shared2>\" \"$<$<BOOL:${CMAKE_TAPI}>:$<PATH:REPLACE_EXTENSION,LAST_ONLY,$<TARGET_SONAME_FILE:shared2>,.tbd>>\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_SONAME_IMPORT_FILE-$<CONFIG>-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/empty.c b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/empty.c diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/check.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/check.cmake deleted file mode 100644 index e19598e..0000000 --- a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/check.cmake +++ /dev/null @@ -1,15 +0,0 @@ -function(check_genex expected actual) - if(NOT expected STREQUAL actual) - string(APPEND RunCMake_TEST_FAILED "Expected DLLs:\n") - foreach(dll IN LISTS expected) - string(APPEND RunCMake_TEST_FAILED " ${dll}\n") - endforeach() - string(APPEND RunCMake_TEST_FAILED "Actual DLLs:\n") - foreach(dll IN LISTS actual) - string(APPEND RunCMake_TEST_FAILED " ${dll}\n") - endforeach() - endif() - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) -endfunction() - -include("${RunCMake_TEST_BINARY_DIR}/dlls.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared-check.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared-check.cmake new file mode 100644 index 0000000..6b05b4e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared-check.cmake @@ -0,0 +1,15 @@ +function(check_genex expected actual) + if(NOT expected STREQUAL actual) + string(APPEND RunCMake_TEST_FAILED "Expected items:\n") + foreach(item IN LISTS expected) + string(APPEND RunCMake_TEST_FAILED " ${item}\n") + endforeach() + string(APPEND RunCMake_TEST_FAILED "Actual items:\n") + foreach(item IN LISTS actual) + string(APPEND RunCMake_TEST_FAILED " ${item}\n") + endforeach() + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +include("${RunCMake_TEST_BINARY_DIR}/dlls.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake index 806f0b6..c38fa39 100644 --- a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake @@ -4,6 +4,10 @@ add_executable(exe main.c) add_library(lib1 SHARED lib1.c) add_library(lib2 SHARED lib2.c) add_library(lib3 SHARED lib3.c) +if(WIN32 OR CYGWIN) + set_property(TARGET lib3 PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/SomeSubDir/") +endif() + add_library(static STATIC static.c) add_library(imported SHARED IMPORTED) set_property(TARGET imported PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/imported.dll") @@ -26,9 +30,16 @@ if(WIN32 OR CYGWIN) "$<TARGET_FILE:lib3>" "$<TARGET_FILE:lib2>" ) + set(expected_dll_dirs + "$<PATH:GET_PARENT_PATH,$<TARGET_FILE:lib2>>" + "$<PATH:GET_PARENT_PATH,$<TARGET_FILE:imported>>" + "$<PATH:GET_PARENT_PATH,$<TARGET_FILE:lib3>>" + ) endif() -set(content "check_genex(\"${expected_dlls}\" \"$<TARGET_RUNTIME_DLLS:exe>\")\n") +set(content "check_genex(\"${expected_dlls}\" \"$<TARGET_RUNTIME_DLLS:exe>\") +check_genex(\"${expected_dll_dirs}\" \"$<TARGET_RUNTIME_DLL_DIRS:exe>\")\n") + set(condition) get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(multi_config) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt index c4545ca..d4b4fcf 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt @@ -5,5 +5,8 @@ Test project .*/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change Test #[0-9]+: ns\.typed\.case<short> Test #[0-9]+: ns\.typed\.case<float> Test #[0-9]+: ns\.typed\.case<char> + Test #[0-9]+: prefix/typed\.case<short> + Test #[0-9]+: prefix/typed\.case<float> + Test #[0-9]+: prefix/typed\.case<char> Total Tests: [0-9]+ diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index c462042..4fa2b5c 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -31,6 +31,12 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<float>!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:ns\.typed\.case<char>!1 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<char>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<short>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<short>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<float>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<float>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<char>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<char>!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/1!1 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/"foo"!1 @@ -39,6 +45,10 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:ns\.value/test\.case/"foo"!1 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/value/test\.case/1!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/value/test\.case/"foo"!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:param/special\.case/"semicolon;"!1 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:param/special\.case/"backslash\\"!1 @@ -71,6 +81,22 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.param/special\.case/"__csb___text"!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:ns\.param/special\.case/"S o m e "!1 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.param/special\.case/"S o m e "!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"semicolon;"!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"backslash\\"!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"\${var}"!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"\${var}"!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/'\['!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/'\['!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"\]\]=\]"!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"\]\]=\]"!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"__osbtext"!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"__osbtext"!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"__csb___text"!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"__csb___text"!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"S o m e "!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"S o m e "!1 \.+ +Passed +[0-9.]+ sec 100% tests passed, 0 tests failed out of [0-9]+ diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt index 8cdd1a0..99b641b 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -31,6 +31,12 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<float>!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:ns\.typed\.case<char>!2 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<char>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<short>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<short>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<float>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<float>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<char>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<char>!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/1!2 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/"foo"!2 @@ -39,6 +45,10 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:ns\.value/test\.case/"foo"!2 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/value/test\.case/1!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/value/test\.case/"foo"!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:param/special\.case/"semicolon;"!2 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:param/special\.case/"backslash\\"!2 @@ -71,6 +81,22 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.param/special\.case/"__csb___text"!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:ns\.param/special\.case/"S o m e "!2 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.param/special\.case/"S o m e "!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"semicolon;"!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"backslash\\"!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"\${var}"!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"\${var}"!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/'\['!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/'\['!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"\]\]=\]"!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"\]\]=\]"!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"__osbtext"!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"__osbtext"!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"__csb___text"!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"__csb___text"!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/param/special\.case/"S o m e "!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/param/special\.case/"S o m e "!2 \.+ +Passed +[0-9.]+ sec 100% tests passed, 0 tests failed out of [0-9]+ diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt index b0f70e7..d9203bc 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt @@ -11,6 +11,12 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<float>!4 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:ns\.typed\.case<char>!4 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<char>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<short>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<short>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<float>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<float>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:prefix/typed\.case<char>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:prefix/typed\.case<char>!4 \.+ +Passed +[0-9.]+ sec 100% tests passed, 0 tests failed out of [0-9]+ diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index e6f74aa..9236bd1 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -34,7 +34,8 @@ int main(int argc, char** argv) std::cout << " case" << std::endl; } if (!is_basic_only) { - const char* typed_suite_names[] = { "typed", "ns.typed" }; + const char* typed_suite_names[] = { "typed", "ns.typed", + "prefix/typed" }; for (size_t i = 0; i < ARRAY_SIZE(typed_suite_names); i++) { std::cout << typed_suite_names[i] << "/0. # TypeParam = short\n"; std::cout << " case" << std::endl; @@ -45,13 +46,15 @@ int main(int argc, char** argv) } } if (!is_basic_only && !is_typed_only) { - const char* value_suite_names[] = { "value", "ns.value" }; + const char* value_suite_names[] = { "value", "ns.value", + "prefix/value" }; for (size_t i = 0; i < ARRAY_SIZE(value_suite_names); i++) { std::cout << value_suite_names[i] << "/test." << std::endl; std::cout << " case/0 # GetParam() = 1" << std::endl; std::cout << " case/1 # GetParam() = \"foo\"" << std::endl; } - const char* param_suite_names[] = { "param", "ns.param" }; + const char* param_suite_names[] = { "param", "ns.param", + "prefix/param" }; for (size_t j = 0; j < ARRAY_SIZE(param_suite_names); j++) { std::cout << param_suite_names[j] << "/special." << std::endl; std::cout << " case/0 # GetParam() = \"semicolon;\"" << std::endl; diff --git a/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt b/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt index 38585eb..352bb68 100644 --- a/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt @@ -3,7 +3,7 @@ CMake Error at global-interface.cmake:2 \(add_library\): GLOBAL - Tried extensions \.c \.C .* -.* -Call Stack \(most recent call first\): + Tried extensions ([^ +]+ +)+Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/NinjaMultiConfig/OutputPathPrefix-all-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/OutputPathPrefix-all-ninja-stdout.txt new file mode 100644 index 0000000..f5bce43 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/OutputPathPrefix-all-ninja-stdout.txt @@ -0,0 +1 @@ +tgt has been built diff --git a/Tests/RunCMake/NinjaMultiConfig/OutputPathPrefix.cmake b/Tests/RunCMake/NinjaMultiConfig/OutputPathPrefix.cmake new file mode 100644 index 0000000..c4e0587 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/OutputPathPrefix.cmake @@ -0,0 +1 @@ +add_custom_target(tgt ALL COMMAND ${CMAKE_COMMAND} -E echo "tgt has been built") diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index c040e8f..47f5eee 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -459,6 +459,15 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_C run_cmake(CompileCommands) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/OutputPathPrefix-build) +run_cmake_with_options(OutputPathPrefix "-DCMAKE_NINJA_OUTPUT_PATH_PREFIX=OutputPathPrefix-build") +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(OutputPathPrefix-all-ninja "${RunCMake_MAKE_PROGRAM}" -f OutputPathPrefix-build/build.ninja OutputPathPrefix-build/all) +run_cmake_command(OutputPathPrefix-clean-ninja "${RunCMake_MAKE_PROGRAM}" -f OutputPathPrefix-build/build.ninja OutputPathPrefix-build/clean) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + # CudaSimple uses separable compilation, which is currently only supported on NVCC. if(CMake_TEST_CUDA) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build) diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt index 5c7882d..05eb42d 100644 --- a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt @@ -3,7 +3,7 @@ CMake Error at MissingSource.cmake:1 \(add_library\): missing.c - Tried extensions \.c \.C .* -.* -Call Stack \(most recent call first\): + Tried extensions ([^ +]+ +)+Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst index ebe40cf..d8cae8b 100644 --- a/Tests/RunCMake/README.rst +++ b/Tests/RunCMake/README.rst @@ -82,3 +82,10 @@ match the regular expression are not run. For example:: This will only run subtests in ``RunCMake.Example`` that start with ``example``. + +To speed up the process of creating a new ``RunCMake`` test, you can run a +script that will automatically perform steps 1 through 4 for you:: + + cmake -DRunCMake_TEST_SUITE=<test suite name> -P Tests/RunCMake/AddRunCMakeTestSuite.cmake + +Be sure to run this from the top-level CMake source directory. diff --git a/Tests/RunCMake/VS10Project/CustomCommandParallel-check.cmake b/Tests/RunCMake/VS10Project/CustomCommandParallel-check.cmake new file mode 100644 index 0000000..87e2f70 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CustomCommandParallel-check.cmake @@ -0,0 +1,40 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_CustomBuild_cmp0147_new 0) +set(found_CustomBuild_cmp0147_old 0) +set(found_BuildInParallel_cmp0147_new 0) +set(found_BuildInParallel_cmp0147_old 0) +set(in_CustomBuild_cmp0147 "") +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES [[<CustomBuild Include=".*\\cmp0147-old\.txt\.rule">]]) + set(found_CustomBuild_cmp0147_old 1) + set(in_CustomBuild_cmp0147 "old") + endif() + if(line MATCHES [[<CustomBuild Include=".*\\cmp0147-new\.txt\.rule">]]) + set(found_CustomBuild_cmp0147_new 1) + set(in_CustomBuild_cmp0147 "new") + endif() + if(line MATCHES [[</CustomBuild>]]) + set(in_CustomBuild_cmp0147 "") + endif() + if(line MATCHES [[<BuildInParallel .*>true</BuildInParallel>]] AND in_CustomBuild_cmp0147) + set(found_BuildInParallel_cmp0147_${in_CustomBuild_cmp0147} 1) + endif() +endforeach() +if(NOT found_CustomBuild_cmp0147_new) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for cmp0147-new.txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_CustomBuild_cmp0147_old) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for cmp0147-old.txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_BuildInParallel_cmp0147_new) + string(APPEND RunCMake_TEST_FAILED "BuildInParallel for cmp0147-new.txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(found_BuildInParallel_cmp0147_old) + string(APPEND RunCMake_TEST_FAILED "BuildInParallel for cmp0147-old.txt.rule incorrectly found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/CustomCommandParallel.cmake b/Tests/RunCMake/VS10Project/CustomCommandParallel.cmake new file mode 100644 index 0000000..784fc68 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CustomCommandParallel.cmake @@ -0,0 +1,5 @@ +cmake_policy(VERSION 3.26) # CMP0147 left unset +add_custom_command(OUTPUT "cmp0147-old.txt" COMMAND echo) +cmake_policy(SET CMP0147 NEW) +add_custom_command(OUTPUT "cmp0147-new.txt" COMMAND echo) +add_custom_target(foo DEPENDS "cmp0147-old.txt" "cmp0147-new.txt") diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index ed74896..669049a 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -8,6 +8,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREA endif() run_cmake(CustomCommandGenex) +if(NOT RunCMake_GENERATOR MATCHES "^Visual Studio 1[1-5] ") + run_cmake(CustomCommandParallel) +endif() run_cmake(VsCsharpSourceGroup) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) diff --git a/Tests/RunCMake/find_package/CMP0146-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0146-NEW-stderr.txt new file mode 100644 index 0000000..0162852 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0146-NEW-stderr.txt @@ -0,0 +1,4 @@ +^CMake Warning at CMP0146-NEW\.cmake:[0-9]+ \(find_package\): + No "FindCUDA\.cmake" found in CMAKE_MODULE_PATH\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/find_package/CMP0146-NEW.cmake b/Tests/RunCMake/find_package/CMP0146-NEW.cmake new file mode 100644 index 0000000..b373227 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0146-NEW.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0146 NEW) +set(_FindCUDA_testing TRUE) +find_package(CUDA MODULE) + +if(_FindCUDA_included) + message(FATAL_ERROR "FindCUDA.cmake erroneously included") +endif() diff --git a/Tests/RunCMake/find_package/CMP0146-OLD.cmake b/Tests/RunCMake/find_package/CMP0146-OLD.cmake new file mode 100644 index 0000000..77cd1f5 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0146-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0146 OLD) +set(_FindCUDA_testing TRUE) +find_package(CUDA MODULE) + +if(NOT _FindCUDA_included) + message(FATAL_ERROR "FindCUDA.cmake not included") +endif() diff --git a/Tests/RunCMake/find_package/CMP0146-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0146-WARN-stderr.txt new file mode 100644 index 0000000..2cd9c5f --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0146-WARN-stderr.txt @@ -0,0 +1,8 @@ +CMake Warning \(dev\) at CMP0146-WARN\.cmake:[0-9]+ \(find_package\): + Policy CMP0146 is not set: The FindCUDA module is removed\. Run "cmake + --help-policy CMP0146" for policy details\. Use the cmake_policy command to + set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/find_package/CMP0146-WARN.cmake b/Tests/RunCMake/find_package/CMP0146-WARN.cmake new file mode 100644 index 0000000..276daf2 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0146-WARN.cmake @@ -0,0 +1,6 @@ +set(_FindCUDA_testing TRUE) +find_package(CUDA MODULE) + +if(NOT _FindCUDA_included) + message(FATAL_ERROR "FindCUDA.cmake not included") +endif() diff --git a/Tests/RunCMake/find_package/CMP0147-NEW-result.txt b/Tests/RunCMake/find_package/CMP0147-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0147-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/CMP0147-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0147-NEW-stderr.txt new file mode 100644 index 0000000..1caf6c5 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0147-NEW-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/FindCUDA.cmake:[0-9]+ \(message\): + The FindCUDA module does not work in Visual Studio with policy CMP0147\. +Call Stack \(most recent call first\): + CMP0147-common\.cmake:[0-9]+ \(find_package\) + CMP0147-NEW\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/find_package/CMP0147-NEW.cmake b/Tests/RunCMake/find_package/CMP0147-NEW.cmake new file mode 100644 index 0000000..0ca5b6c --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0147-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0147 NEW) +include(CMP0147-common.cmake) diff --git a/Tests/RunCMake/find_package/CMP0147-OLD.cmake b/Tests/RunCMake/find_package/CMP0147-OLD.cmake new file mode 100644 index 0000000..61ecee5 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0147-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0147 OLD) +include(CMP0147-common.cmake) diff --git a/Tests/RunCMake/find_package/CMP0147-WARN.cmake b/Tests/RunCMake/find_package/CMP0147-WARN.cmake new file mode 100644 index 0000000..d5f3e91 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0147-WARN.cmake @@ -0,0 +1,2 @@ +# leave CMP0147 unset +include(CMP0147-common.cmake) diff --git a/Tests/RunCMake/find_package/CMP0147-common.cmake b/Tests/RunCMake/find_package/CMP0147-common.cmake new file mode 100644 index 0000000..68a86ee --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0147-common.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0146 OLD) +set(_FindCUDA_testing TRUE) +find_package(CUDA MODULE) diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index f0bb011..26eb908 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -39,6 +39,14 @@ run_cmake(CMP0084-NEW) run_cmake(CMP0145-OLD) run_cmake(CMP0145-WARN) run_cmake(CMP0145-NEW) +run_cmake(CMP0146-OLD) +run_cmake(CMP0146-WARN) +run_cmake(CMP0146-NEW) +if(RunCMake_GENERATOR MATCHES "Visual Studio") + run_cmake(CMP0147-OLD) + run_cmake(CMP0147-WARN) + run_cmake(CMP0147-NEW) +endif() run_cmake(WrongVersionRange) run_cmake(EmptyVersionRange) run_cmake(VersionRangeWithEXACT) diff --git a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt index 0fdb3ca..26ced80 100644 --- a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt +++ b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt @@ -1,8 +1,9 @@ -CMake Error at subdir2/CMakeLists.txt:2 \(include\): +^CMake Error at subdir2/CMakeLists\.txt:2 \(include\): The file - .*/Tests/RunCMake/include/CMP0024-NEW-build/subdir1/theTargets.cmake + [^ +]*/Tests/RunCMake/include/CMP0024-NEW-build/subdir1/theTargets\.cmake - was generated by the export\(\) command. It may not be used as the argument - to the include\(\) command. Use ALIAS targets instead to refer to targets by - alternative names. + was generated by the export\(\) command\. It may not be used as the argument + to the include\(\) command\. Use ALIAS targets instead to refer to targets by + alternative names\. diff --git a/Tests/RunCMake/include/CMP0024-NEW.cmake b/Tests/RunCMake/include/CMP0024-NEW.cmake index 0e03d2a..783cf78 100644 --- a/Tests/RunCMake/include/CMP0024-NEW.cmake +++ b/Tests/RunCMake/include/CMP0024-NEW.cmake @@ -1,8 +1,6 @@ enable_language(CXX) -cmake_policy(SET CMP0024 NEW) - add_library(foo SHARED empty.cpp) add_subdirectory(subdir1) diff --git a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt index 9c79007..8472f41 100644 --- a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt +++ b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt @@ -1,14 +1,24 @@ -CMake Warning \(dev\) at subdir2/CMakeLists.txt:2 \(include\): +^CMake Deprecation Warning at CMP0024-WARN\.cmake:[0-9]+ \(cmake_policy\): + Compatibility with CMake < 3\.5 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a \.\.\.<max> suffix to tell + CMake that the project does not need compatibility with older versions\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Warning \(dev\) at subdir2/CMakeLists\.txt:2 \(include\): Policy CMP0024 is not set: Disallow include export result. Run "cmake - --help-policy CMP0024" for policy details. Use the cmake_policy command to - set the policy and suppress this warning. + --help-policy CMP0024" for policy details\. Use the cmake_policy command to + set the policy and suppress this warning\. The file - .*/Tests/RunCMake/include/CMP0024-WARN-build/subdir1/theTargets.cmake + [^ +]*/Tests/RunCMake/include/CMP0024-WARN-build/subdir1/theTargets\.cmake - was generated by the export\(\) command. It should not be used as the - argument to the include\(\) command. Use ALIAS targets instead to refer to - targets by alternative names. + was generated by the export\(\) command\. It should not be used as the + argument to the include\(\) command\. Use ALIAS targets instead to refer to + targets by alternative names\. -This warning is for project developers. Use -Wno-dev to suppress it. +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/include/CMP0024-WARN.cmake b/Tests/RunCMake/include/CMP0024-WARN.cmake index 783cf78..f267a5a 100644 --- a/Tests/RunCMake/include/CMP0024-WARN.cmake +++ b/Tests/RunCMake/include/CMP0024-WARN.cmake @@ -1,3 +1,4 @@ +cmake_policy(VERSION 2.8.12) # Leave CMP0024 unset. enable_language(CXX) diff --git a/Tests/RunCMake/include/CMP0146-NEW-name-result.txt b/Tests/RunCMake/include/CMP0146-NEW-name-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-NEW-name-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/CMP0146-NEW-name-stderr.txt b/Tests/RunCMake/include/CMP0146-NEW-name-stderr.txt new file mode 100644 index 0000000..7d9e7d8 --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-NEW-name-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMP0146-NEW-name\.cmake:[0-9]+ \(include\): + include could not find requested file: + + FindCUDA +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/include/CMP0146-NEW-name.cmake b/Tests/RunCMake/include/CMP0146-NEW-name.cmake new file mode 100644 index 0000000..feedc6f --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-NEW-name.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0146 NEW) +include(FindCUDA) diff --git a/Tests/RunCMake/include/CMP0146-NEW-path-result.txt b/Tests/RunCMake/include/CMP0146-NEW-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-NEW-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/CMP0146-NEW-path-stderr.txt b/Tests/RunCMake/include/CMP0146-NEW-path-stderr.txt new file mode 100644 index 0000000..916672b --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-NEW-path-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/Modules/FindCUDA.cmake:[0-9]+ \(message\): + The FindCUDA module has been removed by policy CMP0146\. +Call Stack \(most recent call first\): + CMP0146-NEW-path\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/include/CMP0146-NEW-path.cmake b/Tests/RunCMake/include/CMP0146-NEW-path.cmake new file mode 100644 index 0000000..6768d4d --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-NEW-path.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0146 NEW) +include(${CMAKE_ROOT}/Modules/FindCUDA.cmake) diff --git a/Tests/RunCMake/include/CMP0146-OLD.cmake b/Tests/RunCMake/include/CMP0146-OLD.cmake new file mode 100644 index 0000000..654cdf7 --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0146 OLD) +set(_FindCUDA_testing 1) +include(FindCUDA) + +if(NOT _FindCUDA_included) + message(FATAL_ERROR "FindCUDA.cmake not included") +endif() diff --git a/Tests/RunCMake/include/CMP0146-WARN-stderr.txt b/Tests/RunCMake/include/CMP0146-WARN-stderr.txt new file mode 100644 index 0000000..aaaf1dc --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at CMP0146-WARN\.cmake:[0-9]+ \(include\): + Policy CMP0146 is not set: The FindCUDA module is removed\. Run "cmake + --help-policy CMP0146" for policy details\. Use the cmake_policy command to + set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/include/CMP0146-WARN.cmake b/Tests/RunCMake/include/CMP0146-WARN.cmake new file mode 100644 index 0000000..bce1ae8 --- /dev/null +++ b/Tests/RunCMake/include/CMP0146-WARN.cmake @@ -0,0 +1,7 @@ +# Do not set CMP0146. +set(_FindCUDA_testing 1) +include(FindCUDA) + +if(NOT _FindCUDA_included) + message(FATAL_ERROR "FindCUDA.cmake not included") +endif() diff --git a/Tests/RunCMake/include/CMakeLists.txt b/Tests/RunCMake/include/CMakeLists.txt index 4b3de84..93ee9df 100644 --- a/Tests/RunCMake/include/CMakeLists.txt +++ b/Tests/RunCMake/include/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include/EmptyString-stderr.txt b/Tests/RunCMake/include/EmptyString-stderr.txt index 006c647..dab16ea 100644 --- a/Tests/RunCMake/include/EmptyString-stderr.txt +++ b/Tests/RunCMake/include/EmptyString-stderr.txt @@ -1,5 +1,5 @@ -CMake Warning \(dev\) at EmptyString.cmake:1 \(include\): +^CMake Warning \(dev\) at EmptyString\.cmake:1 \(include\): include\(\) given empty file name \(ignored\). Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. + CMakeLists\.txt:3 \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/include/EmptyStringOptional-stderr.txt b/Tests/RunCMake/include/EmptyStringOptional-stderr.txt index b61c679..1b763f2 100644 --- a/Tests/RunCMake/include/EmptyStringOptional-stderr.txt +++ b/Tests/RunCMake/include/EmptyStringOptional-stderr.txt @@ -1,5 +1,5 @@ -CMake Warning \(dev\) at EmptyStringOptional.cmake:1 \(include\): +^CMake Warning \(dev\) at EmptyStringOptional\.cmake:1 \(include\): include\(\) given empty file name \(ignored\). Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. + CMakeLists\.txt:3 \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/include/ExportExportInclude-stderr.txt b/Tests/RunCMake/include/ExportExportInclude-stderr.txt index 6d5c02f..22bf7a1 100644 --- a/Tests/RunCMake/include/ExportExportInclude-stderr.txt +++ b/Tests/RunCMake/include/ExportExportInclude-stderr.txt @@ -1,6 +1,7 @@ -CMake Error at ExportExportInclude.cmake:6 \(include\): +^CMake Error at ExportExportInclude.cmake:6 \(include\): include could not find requested file: - .*/Tests/RunCMake/include/ExportExportInclude-build/theTargets.cmake + [^ +]*/Tests/RunCMake/include/ExportExportInclude-build/theTargets\.cmake Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt b/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt index 5735c29..6ce934d 100644 --- a/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt +++ b/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt @@ -1,6 +1,7 @@ -CMake Error at IncludeIsDirectory.cmake:1 \(include\): +^CMake Error at IncludeIsDirectory.cmake:1 \(include\): include requested file is a directory: - .*/Tests/RunCMake/include/IncludeIsDirectory-build + [^ +]*/Tests/RunCMake/include/IncludeIsDirectory-build Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/include/IncludeMalformed-stderr.txt b/Tests/RunCMake/include/IncludeMalformed-stderr.txt index fc75549..e34e9bb 100644 --- a/Tests/RunCMake/include/IncludeMalformed-stderr.txt +++ b/Tests/RunCMake/include/IncludeMalformed-stderr.txt @@ -1,13 +1,12 @@ -CMake Error at malformedInclude.cmake:1: - Parse error. Function missing ending "\)". End of file reached. +^CMake Error at malformedInclude\.cmake:1: + Parse error\. Function missing ending "\)"\. End of file reached\. Call Stack \(most recent call first\): - IncludeMalformed.cmake:1 \(include\) - CMakeLists.txt:3 \(include\) - - -CMake Error at IncludeMalformed.cmake:1 \(include\): + IncludeMalformed\.cmake:1 \(include\) + CMakeLists\.txt:3 \(include\) ++ +CMake Error at IncludeMalformed\.cmake:1 \(include\): include could not load requested file: - malformedInclude.cmake + malformedInclude\.cmake Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake index 8fb7201..b6fdb54 100644 --- a/Tests/RunCMake/include/RunCMakeTest.cmake +++ b/Tests/RunCMake/include/RunCMakeTest.cmake @@ -7,3 +7,8 @@ run_cmake(CMP0024-NEW) run_cmake(ExportExportInclude) run_cmake(IncludeIsDirectory) run_cmake(IncludeMalformed) + +run_cmake(CMP0146-OLD) +run_cmake(CMP0146-WARN) +run_cmake(CMP0146-NEW-name) +run_cmake(CMP0146-NEW-path) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt index fe65fd3..26dcd42 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt @@ -1,5 +1,6 @@ ^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-all\.cmake:5 \(install\): - install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The - NAMELINK_COMPONENT option may be specified only following LIBRARY\. + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY or ARCHIVE + group\. The NAMELINK_COMPONENT option may be specified only following + LIBRARY or ARCHIVE\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt index 60f52c4..8aed62b 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt @@ -1,5 +1,6 @@ ^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-exc\.cmake:5 \(install\): - install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The - NAMELINK_COMPONENT option may be specified only following LIBRARY\. + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY or ARCHIVE + group\. The NAMELINK_COMPONENT option may be specified only following + LIBRARY or ARCHIVE\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/CMakeLists.txt b/Tests/RunCMake/target_sources/CMakeLists.txt index 727f93a..296fdda 100644 --- a/Tests/RunCMake/target_sources/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 3.11) project(${RunCMake_TEST} LANGUAGES NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt b/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt index c1f7635..06458b9 100644 --- a/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt +++ b/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt @@ -3,9 +3,9 @@ CMake Error at FileSetDirect.cmake:3 \(add_library\): FILE_SET - Tried extensions .c .C .c\+\+ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h - .hh .h\+\+ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc - + Tried extensions ([^ +]+ +)+ Hint: the FILE_SET keyword may only appear after a visibility specifier or another FILE_SET within the target_sources\(\) command. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt index 9a2ca6a..2b5db43 100644 --- a/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt +++ b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at FileSetFileNoExist\.cmake:[0-9]+ \(add_library\): +^CMake Error at FileSetFileNoExist\.cmake:[0-9]+ \(target_sources\): Cannot find source file: [^ diff --git a/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt index 8722347..01db002 100644 --- a/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt +++ b/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt @@ -1,11 +1,11 @@ -CMake Error at FileSetWrongSyntax.cmake:3 \(add_library\): +CMake Error at FileSetWrongSyntax.cmake:4 \(target_sources\): Cannot find source file: FILE_SET - Tried extensions .c .C .c\+\+ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h - .hh .h\+\+ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc - + Tried extensions ([^ +]+ +)+ Hint: the FILE_SET keyword may only appear after a visibility specifier or another FILE_SET within the target_sources\(\) command. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/target_sources/MissingSource-result.txt b/Tests/RunCMake/target_sources/MissingSource-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/MissingSource-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/MissingSource-stderr.txt b/Tests/RunCMake/target_sources/MissingSource-stderr.txt new file mode 100644 index 0000000..b4c81c2 --- /dev/null +++ b/Tests/RunCMake/target_sources/MissingSource-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at MissingSource\.cmake:[0-9]+ \(target_sources\): + Cannot find source file: + + missing\.txt +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_sources/MissingSource.cmake b/Tests/RunCMake/target_sources/MissingSource.cmake new file mode 100644 index 0000000..2bb71e4 --- /dev/null +++ b/Tests/RunCMake/target_sources/MissingSource.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0115 NEW) +add_custom_target(foo) +target_sources(foo PRIVATE missing.txt) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index c1314f7..90915cd 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -9,6 +9,7 @@ run_cmake(OriginDebug) run_cmake(CMP0026-LOCATION) run_cmake(CMP0076-OLD) run_cmake(CMP0076-WARN) +run_cmake(MissingSource) run_cmake(RelativePathInInterface) run_cmake(RelativePathInSubdirGenEx) run_cmake(RelativePathInSubdirInterface) diff --git a/Tests/StagingPrefix/Consumer/CMakeLists.txt b/Tests/StagingPrefix/Consumer/CMakeLists.txt index a230441..f7195b0 100644 --- a/Tests/StagingPrefix/Consumer/CMakeLists.txt +++ b/Tests/StagingPrefix/Consumer/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(Consumer) diff --git a/Tests/StagingPrefix/Producer/CMakeLists.txt b/Tests/StagingPrefix/Producer/CMakeLists.txt index eb3d98f..c02d5de 100644 --- a/Tests/StagingPrefix/Producer/CMakeLists.txt +++ b/Tests/StagingPrefix/Producer/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(Producer) add_library(foo SHARED foo.cpp) diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 068fae9..6c0de9d 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(StringFileTest) include_directories(${StringFileTest_BINARY_DIR}) diff --git a/Tests/SubDirSpaces/CMakeLists.txt b/Tests/SubDirSpaces/CMakeLists.txt index ecd4353..26a7da9 100644 --- a/Tests/SubDirSpaces/CMakeLists.txt +++ b/Tests/SubDirSpaces/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(SUBDIR) # Some systems do not seem to support rpath with spaces. diff --git a/Tests/TargetName/CMakeLists.txt b/Tests/TargetName/CMakeLists.txt index 21752b7..9864001 100644 --- a/Tests/TargetName/CMakeLists.txt +++ b/Tests/TargetName/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(TargetName) add_subdirectory(executables) diff --git a/Tests/TestDriver/CMakeLists.txt b/Tests/TestDriver/CMakeLists.txt index 3cc69c0..cd79372 100644 --- a/Tests/TestDriver/CMakeLists.txt +++ b/Tests/TestDriver/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(TestDriverTest) set(Extra_SRCS testExtraStuff.cxx testExtraStuff2.cxx ) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index 2a0b015..f77370c 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(TestsWorkingDirectoryProj) add_executable(WorkingDirectory main.c) diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 3e46ed5..ab2e007 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) if(POLICY CMP0129) cmake_policy(SET CMP0129 NEW) endif() diff --git a/Tests/TryCompile/Inner/CMakeLists.txt b/Tests/TryCompile/Inner/CMakeLists.txt index 9f89af2..262662d 100644 --- a/Tests/TryCompile/Inner/CMakeLists.txt +++ b/Tests/TryCompile/Inner/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(TryCompileInner C) try_compile(SHOULD_PASS diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index a3fd8d8..a44988e 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.5) project(VSExternalInclude) if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124567]") diff --git a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt index 950ec25..8918d98 100644 --- a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(FortranHello Fortran C) # add a function to test for -lsunquad on sunpro sun systems. diff --git a/Tests/VSMidl/CMakeLists.txt b/Tests/VSMidl/CMakeLists.txt index 342b8fb..f24640f 100644 --- a/Tests/VSMidl/CMakeLists.txt +++ b/Tests/VSMidl/CMakeLists.txt @@ -12,7 +12,7 @@ endif() message(STATUS "CMAKE_BUILDNAME='${CMAKE_BUILDNAME}'") message(STATUS "THIS_TESTNAME='${THIS_TESTNAME}'") -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(${THIS_TESTNAME}) include(ExternalProject) diff --git a/Tests/VSMidl/src/CMakeLists.txt b/Tests/VSMidl/src/CMakeLists.txt index 7e838b4..d8fd934 100644 --- a/Tests/VSMidl/src/CMakeLists.txt +++ b/Tests/VSMidl/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(VSMidl) include_directories("${CMAKE_CURRENT_BINARY_DIR}/\$(IntDir)") diff --git a/Tests/VSNASM/CMakeLists.txt b/Tests/VSNASM/CMakeLists.txt index a038ddd..6f82425 100644 --- a/Tests/VSNASM/CMakeLists.txt +++ b/Tests/VSNASM/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project(VSNASM C ASM_NASM) if(CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 47e4909..a07b6e9 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -4,6 +4,9 @@ import os import re +from dataclasses import dataclass +from typing import Any, cast + # Override much of pygments' CMakeLexer. # We need to parse CMake syntax definitions, not CMake code. @@ -16,6 +19,9 @@ from pygments.lexers import CMakeLexer from pygments.token import Name, Operator, Punctuation, String, Text, Comment, Generic, Whitespace, Number from pygments.lexer import bygroups +# RE to split multiple command signatures +sig_end_re = re.compile(r'(?<=[)])\n') + # Notes on regular expressions below: # - [\.\+-] are needed for string constants like gtk+-2.0 # - Unix paths are recognized by '/'; support for Windows paths may be added if needed @@ -57,16 +63,20 @@ CMakeLexer.tokens["root"] = [ # (r'[^<>\])\}\|$"# \t\n]+', Name.Exception), # fallback, for debugging only ] +from docutils.utils.code_analyzer import Lexer, LexerError from docutils.parsers.rst import Directive, directives from docutils.transforms import Transform from docutils import io, nodes -from sphinx.directives import ObjectDescription +from sphinx.directives import ObjectDescription, nl_escape_re from sphinx.domains import Domain, ObjType from sphinx.roles import XRefRole from sphinx.util.nodes import make_refnode +from sphinx.util import logging, ws_re from sphinx import addnodes +logger = logging.getLogger(__name__) + sphinx_before_1_4 = False sphinx_before_1_7_2 = False try: @@ -99,6 +109,14 @@ if sphinx_before_1_7_2: return new_items QtHelpBuilder.build_keywords = new_build_keywords +@dataclass +class ObjectEntry: + docname: str + objtype: str + node_id: str + name: str + + class CMakeModule(Directive): required_arguments = 1 optional_arguments = 0 @@ -200,14 +218,6 @@ _cmake_index_objs = { 'variable': _cmake_index_entry('variable'), } -def _cmake_object_inventory(env, document, line, objtype, targetid): - inv = env.domaindata['cmake']['objects'] - if targetid in inv: - document.reporter.warning( - 'CMake object "%s" also described in "%s".' % - (targetid, env.doc2path(inv[targetid][0])), line=line) - inv[targetid] = (env.docname, objtype) - class CMakeTransform(Transform): # Run this transform early since we insert nodes we want @@ -270,8 +280,10 @@ class CMakeTransform(Transform): indexnode = addnodes.index() indexnode['entries'] = [make_index_entry(title, targetid)] self.document.insert(0, indexnode) + # Add to cmake domain object inventory - _cmake_object_inventory(env, self.document, 1, objtype, targetid) + domain = cast(CMakeDomain, env.get_domain('cmake')) + domain.note_object(objtype, targetname, targetid, targetid) class CMakeObject(ObjectDescription): @@ -286,39 +298,120 @@ class CMakeObject(ObjectDescription): def add_target_and_index(self, name, sig, signode): if self.objtype == 'command': - targetname = name.lower() + targetname = name.lower() else: - targetname = name + targetname = name targetid = '%s:%s' % (self.objtype, targetname) if targetid not in self.state.document.ids: signode['names'].append(targetid) signode['ids'].append(targetid) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) - _cmake_object_inventory(self.env, self.state.document, - self.lineno, self.objtype, targetid) + + domain = cast(CMakeDomain, self.env.get_domain('cmake')) + domain.note_object(self.objtype, targetname, targetid, targetid, + location=signode) make_index_entry = _cmake_index_objs.get(self.objtype) if make_index_entry: self.indexnode['entries'].append(make_index_entry(name, targetid)) +class CMakeSignatureObject(CMakeObject): + object_type = 'signature' + + option_spec = { + 'target': directives.unchanged, + } + + def get_signatures(self): + content = nl_escape_re.sub('', self.arguments[0]) + lines = sig_end_re.split(content) + return [ws_re.sub(' ', line.strip()) for line in lines] + + def handle_signature(self, sig, signode): + language = 'cmake' + classes = ['code', 'cmake', 'highlight'] + + node = addnodes.desc_name(sig, '', classes=classes) + + try: + tokens = Lexer(sig, language, 'short') + except LexerError as error: + if self.state.document.settings.report_level > 2: + # Silently insert without syntax highlighting. + tokens = Lexer(sig, language, 'none') + else: + raise self.warning(error) + + for classes, value in tokens: + if classes: + node += nodes.inline(value, value, classes=classes) + else: + node += nodes.Text(value) + + signode.clear() + signode += node + + return sig + + def __init__(self, *args, **kwargs): + self.targetnames = {} + super().__init__(*args, **kwargs) + + def add_target_and_index(self, name, sig, signode): + if name in self.targetnames: + sigargs = self.targetnames[name] + else: + def extract_keywords(params): + for p in params: + if p[0].isalpha(): + yield p + else: + return + + keywords = extract_keywords(name.split('(')[1].split()) + sigargs = ' '.join(keywords) + targetname = sigargs.lower() + targetid = nodes.make_id(targetname) + + if targetid not in self.state.document.ids: + signode['names'].append(targetname) + signode['ids'].append(targetid) + signode['first'] = (not self.names) + self.state.document.note_explicit_target(signode) + + # Register the signature as a command object. + command = name.split('(')[0].lower() + refname = f'{command}({sigargs})' + refid = f'command:{command}({targetname})' + + domain = cast(CMakeDomain, self.env.get_domain('cmake')) + domain.note_object('command', name=refname, target_id=refid, + node_id=targetid, location=signode) + + def run(self): + targets = self.options.get('target') + if targets is not None: + signatures = self.get_signatures() + targets = [t.strip() for t in targets.split('\n')] + for signature, target in zip(signatures, targets): + self.targetnames[signature] = target + + return super().run() + class CMakeXRefRole(XRefRole): # See sphinx.util.nodes.explicit_title_re; \x00 escapes '<'. _re = re.compile(r'^(.+?)(\s*)(?<!\x00)<(.*?)>$', re.DOTALL) - _re_sub = re.compile(r'^([^()\s]+)\s*\(([^()]*)\)$', re.DOTALL) + _re_ref = re.compile(r'^.*\s<\w+([(][\w\s]+[)])?>$', re.DOTALL) _re_genex = re.compile(r'^\$<([^<>:]+)(:[^<>]+)?>$', re.DOTALL) _re_guide = re.compile(r'^([^<>/]+)/([^<>]*)$', re.DOTALL) def __call__(self, typ, rawtext, text, *args, **keys): - # Translate CMake command cross-references of the form: - # `command_name(SUB_COMMAND)` - # to have an explicit target: - # `command_name(SUB_COMMAND) <command_name>` if typ == 'cmake:command': - m = CMakeXRefRole._re_sub.match(text) - if m: - text = '%s <%s>' % (text, m.group(1)) + m = CMakeXRefRole._re_ref.match(text) + if m is None: + text = f'{text} <{text}>' elif typ == 'cmake:genex': m = CMakeXRefRole._re_genex.match(text) if m: @@ -374,6 +467,10 @@ class CMakeXRefTransform(Transform): # Do not index cross-references to guide sections. continue + if objtype == 'command': + # Index signature references to their parent command. + objname = objname.split('(')[0].lower() + targetnum = env.new_serialno('index-%s:%s' % (objtype, objname)) targetid = 'index-%s-%s:%s' % (targetnum, objtype, objname) @@ -411,19 +508,9 @@ class CMakeDomain(Domain): 'command': CMakeObject, 'envvar': CMakeObject, 'genex': CMakeObject, + 'signature': CMakeSignatureObject, 'variable': CMakeObject, - # Other object types cannot be created except by the CMakeTransform - # 'generator': CMakeObject, - # 'module': CMakeObject, - # 'policy': CMakeObject, - # 'prop_cache': CMakeObject, - # 'prop_dir': CMakeObject, - # 'prop_gbl': CMakeObject, - # 'prop_inst': CMakeObject, - # 'prop_sf': CMakeObject, - # 'prop_test': CMakeObject, - # 'prop_tgt': CMakeObject, - # 'manual': CMakeObject, + # Other `object_types` cannot be created except by the `CMakeTransform` } roles = { 'command': CMakeXRefRole(fix_parens = True, lowercase = True), @@ -450,25 +537,46 @@ class CMakeDomain(Domain): def clear_doc(self, docname): to_clear = set() - for fullname, (fn, _) in self.data['objects'].items(): - if fn == docname: + for fullname, obj in self.data['objects'].items(): + if obj.docname == docname: to_clear.add(fullname) for fullname in to_clear: del self.data['objects'][fullname] def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): - targetid = '%s:%s' % (typ, target) + targetid = f'{typ}:{target}' obj = self.data['objects'].get(targetid) + + if obj is None and typ == 'command': + # If 'command(args)' wasn't found, try just 'command'. + # TODO: remove this fallback? warn? + # logger.warning(f'no match for {targetid}') + command = target.split('(')[0] + targetid = f'{typ}:{command}' + obj = self.data['objects'].get(targetid) + if obj is None: # TODO: warn somehow? return None - return make_refnode(builder, fromdocname, obj[0], targetid, + + return make_refnode(builder, fromdocname, obj.docname, obj.node_id, contnode, target) + def note_object(self, objtype: str, name: str, target_id: str, + node_id: str, location: Any = None): + if target_id in self.data['objects']: + other = self.data['objects'][target_id].docname + logger.warning( + f'CMake object {target_id!r} also described in {other!r}', + location=location) + + self.data['objects'][target_id] = ObjectEntry( + self.env.docname, objtype, node_id, name) + def get_objects(self): - for refname, (docname, type) in self.data['objects'].items(): - yield (refname, refname, type, docname, refname, 1) + for refname, obj in self.data['objects'].items(): + yield (refname, obj.name, obj.objtype, obj.docname, obj.node_id, 1) def setup(app): app.add_directive('cmake-module', CMakeModule) diff --git a/Utilities/Sphinx/static/cmake.css b/Utilities/Sphinx/static/cmake.css index 324cd92..dd0dd02 100644 --- a/Utilities/Sphinx/static/cmake.css +++ b/Utilities/Sphinx/static/cmake.css @@ -17,6 +17,29 @@ div.sphinxsidebarwrapper { background-color: #dfdfdf; } +/* Apply <pre> style (from classic.css) to signature directive argument. */ +.signature .sig { + padding: 5px; + background-color: #eeeeee; + color: #333333; + line-height: 120%; + border: 1px solid #ac9; + border-left: none; + border-right: none; +} + +/* Add additional styling to signature directive argument. */ +.signature .sig { + margin-bottom: 5px; + padding-left: calc(5px + 3em); + text-indent: -3em; + font-family: monospace; +} + +.signature .sig .code.sig-name { + font-weight: normal; +} + /* Remove unwanted margin in case list item contains a div-wrapping directive like `.. versionadded` or `.. deprecated`. */ dd > :first-child > p { |