From 94c1e4fdb35c01ef5ad57ed3284b20d8d7fc3496 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 May 2020 13:25:13 -0400 Subject: cmake_language: Rename command from cmake_command Also rename the `INVOKE` signature to `CALL`. Fixes: #20732 --- Help/command/cmake_command.rst | 90 ----------------- Help/command/cmake_language.rst | 90 +++++++++++++++++ Help/command/function.rst | 6 +- Help/command/macro.rst | 6 +- Help/manual/cmake-commands.7.rst | 2 +- Help/release/dev/cmake_command-command.rst | 6 -- Help/release/dev/cmake_language-command.rst | 6 ++ Source/CMakeLists.txt | 4 +- Source/cmCMakeCommand.cxx | 111 --------------------- Source/cmCMakeCommand.h | 20 ---- Source/cmCMakeLanguageCommand.cxx | 111 +++++++++++++++++++++ Source/cmCMakeLanguageCommand.h | 20 ++++ Source/cmCommands.cxx | 4 +- Tests/RunCMake/CMakeLists.txt | 3 +- Tests/RunCMake/cmake_command/CMakeLists.txt | 3 - Tests/RunCMake/cmake_command/RunCMakeTest.cmake | 23 ----- ...ake_command_eval_expand_command_name-stderr.txt | 1 - .../cmake_command_eval_expand_command_name.cmake | 2 - ..._eval_expanded_command_and_arguments-stderr.txt | 1 - ...mmand_eval_expanded_command_and_arguments.cmake | 2 - ...tra_parameters_between_eval_and_code-result.txt | 1 - ...tra_parameters_between_eval_and_code-stderr.txt | 5 - ...al_extra_parameters_between_eval_and_code.cmake | 1 - .../cmake_command_eval_message-stderr.txt | 1 - .../cmake_command/cmake_command_eval_message.cmake | 1 - ...ake_command_eval_message_fatal_error-result.txt | 1 - ...ake_command_eval_message_fatal_error-stderr.txt | 5 - .../cmake_command_eval_message_fatal_error.cmake | 5 - .../cmake_command_eval_no_code-result.txt | 1 - .../cmake_command_eval_no_code-stderr.txt | 2 - .../cmake_command/cmake_command_eval_no_code.cmake | 1 - .../cmake_command_eval_no_parameters-result.txt | 1 - .../cmake_command_eval_no_parameters-stderr.txt | 2 - .../cmake_command_eval_no_parameters.cmake | 1 - ...ommand_eval_variable_outside_message-stderr.txt | 1 - ...ake_command_eval_variable_outside_message.cmake | 2 - ...ake_command_invoke_double_evaluation-stderr.txt | 1 - .../cmake_command_invoke_double_evaluation.cmake | 2 - ...e_command_invoke_expand_command_name-stderr.txt | 1 - .../cmake_command_invoke_expand_command_name.cmake | 2 - ..._command_invoke_expand_function_name-stderr.txt | 1 - ...cmake_command_invoke_expand_function_name.cmake | 11 -- ...make_command_invoke_expanded_command-stderr.txt | 1 - .../cmake_command_invoke_expanded_command.cmake | 6 -- ...nvoke_expanded_command_and_arguments-result.txt | 1 - ...nvoke_expanded_command_and_arguments-stderr.txt | 4 - ...and_invoke_expanded_command_and_arguments.cmake | 2 - ...anded_command_with_explicit_argument-stderr.txt | 1 - ...e_expanded_command_with_explicit_argument.cmake | 2 - .../cmake_command_invoke_message-stderr.txt | 1 - .../cmake_command_invoke_message.cmake | 1 - ...e_command_invoke_message_fatal_error-result.txt | 1 - ...e_command_invoke_message_fatal_error-stderr.txt | 5 - .../cmake_command_invoke_message_fatal_error.cmake | 1 - .../cmake_command_invoke_no_parameters-result.txt | 1 - .../cmake_command_invoke_no_parameters-stderr.txt | 2 - .../cmake_command_invoke_no_parameters.cmake | 1 - ...ke_command_invoke_preserve_arguments-stderr.txt | 6 -- .../cmake_command_invoke_preserve_arguments.cmake | 12 --- ...make_command_invoke_unknown_function-result.txt | 1 - ...make_command_invoke_unknown_function-stderr.txt | 2 - .../cmake_command_invoke_unknown_function.cmake | 1 - .../cmake_command_no_parameters-result.txt | 1 - .../cmake_command_no_parameters-stderr.txt | 2 - .../cmake_command_no_parameters.cmake | 1 - ...cmake_command_unknown_meta_operation-result.txt | 1 - ...cmake_command_unknown_meta_operation-stderr.txt | 2 - .../cmake_command_unknown_meta_operation.cmake | 1 - Tests/RunCMake/cmake_language/CMakeLists.txt | 3 + Tests/RunCMake/cmake_language/RunCMakeTest.cmake | 23 +++++ .../call_double_evaluation-stderr.txt | 1 + .../cmake_language/call_double_evaluation.cmake | 2 + .../call_expand_command_name-stderr.txt | 1 + .../cmake_language/call_expand_command_name.cmake | 2 + .../call_expand_function_name-stderr.txt | 1 + .../cmake_language/call_expand_function_name.cmake | 11 ++ .../call_expanded_command-stderr.txt | 1 + .../cmake_language/call_expanded_command.cmake | 6 ++ .../call_expanded_command_and_arguments-result.txt | 1 + .../call_expanded_command_and_arguments-stderr.txt | 4 + .../call_expanded_command_and_arguments.cmake | 2 + ...anded_command_with_explicit_argument-stderr.txt | 1 + ...l_expanded_command_with_explicit_argument.cmake | 2 + .../cmake_language/call_message-stderr.txt | 1 + Tests/RunCMake/cmake_language/call_message.cmake | 1 + .../call_message_fatal_error-result.txt | 1 + .../call_message_fatal_error-stderr.txt | 5 + .../cmake_language/call_message_fatal_error.cmake | 1 + .../cmake_language/call_no_parameters-result.txt | 1 + .../cmake_language/call_no_parameters-stderr.txt | 2 + .../cmake_language/call_no_parameters.cmake | 1 + .../call_preserve_arguments-stderr.txt | 6 ++ .../cmake_language/call_preserve_arguments.cmake | 12 +++ .../call_unknown_function-result.txt | 1 + .../call_unknown_function-stderr.txt | 2 + .../cmake_language/call_unknown_function.cmake | 1 + .../eval_expand_command_name-stderr.txt | 1 + .../cmake_language/eval_expand_command_name.cmake | 2 + .../eval_expanded_command_and_arguments-stderr.txt | 1 + .../eval_expanded_command_and_arguments.cmake | 2 + ...tra_parameters_between_eval_and_code-result.txt | 1 + ...tra_parameters_between_eval_and_code-stderr.txt | 5 + ...al_extra_parameters_between_eval_and_code.cmake | 1 + .../cmake_language/eval_message-stderr.txt | 1 + Tests/RunCMake/cmake_language/eval_message.cmake | 1 + .../eval_message_fatal_error-result.txt | 1 + .../eval_message_fatal_error-stderr.txt | 5 + .../cmake_language/eval_message_fatal_error.cmake | 5 + .../cmake_language/eval_no_code-result.txt | 1 + .../cmake_language/eval_no_code-stderr.txt | 2 + Tests/RunCMake/cmake_language/eval_no_code.cmake | 1 + .../cmake_language/eval_no_parameters-result.txt | 1 + .../cmake_language/eval_no_parameters-stderr.txt | 2 + .../cmake_language/eval_no_parameters.cmake | 1 + .../eval_variable_outside_message-stderr.txt | 1 + .../eval_variable_outside_message.cmake | 2 + .../cmake_language/no_parameters-result.txt | 1 + .../cmake_language/no_parameters-stderr.txt | 2 + Tests/RunCMake/cmake_language/no_parameters.cmake | 1 + .../unknown_meta_operation-result.txt | 1 + .../unknown_meta_operation-stderr.txt | 2 + .../cmake_language/unknown_meta_operation.cmake | 1 + 122 files changed, 380 insertions(+), 381 deletions(-) delete mode 100644 Help/command/cmake_command.rst create mode 100644 Help/command/cmake_language.rst delete mode 100644 Help/release/dev/cmake_command-command.rst create mode 100644 Help/release/dev/cmake_language-command.rst delete mode 100644 Source/cmCMakeCommand.cxx delete mode 100644 Source/cmCMakeCommand.h create mode 100644 Source/cmCMakeLanguageCommand.cxx create mode 100644 Source/cmCMakeLanguageCommand.h delete mode 100644 Tests/RunCMake/cmake_command/CMakeLists.txt delete mode 100644 Tests/RunCMake/cmake_command/RunCMakeTest.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt delete mode 100644 Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake create mode 100644 Tests/RunCMake/cmake_language/CMakeLists.txt create mode 100644 Tests/RunCMake/cmake_language/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_double_evaluation.cmake create mode 100644 Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_expand_command_name.cmake create mode 100644 Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_expand_function_name.cmake create mode 100644 Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_expanded_command.cmake create mode 100644 Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt create mode 100644 Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake create mode 100644 Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake create mode 100644 Tests/RunCMake/cmake_language/call_message-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_message.cmake create mode 100644 Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt create mode 100644 Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_message_fatal_error.cmake create mode 100644 Tests/RunCMake/cmake_language/call_no_parameters-result.txt create mode 100644 Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_no_parameters.cmake create mode 100644 Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_preserve_arguments.cmake create mode 100644 Tests/RunCMake/cmake_language/call_unknown_function-result.txt create mode 100644 Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/call_unknown_function.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_expand_command_name.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt create mode 100644 Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_message-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_message.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt create mode 100644 Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_no_code-result.txt create mode 100644 Tests/RunCMake/cmake_language/eval_no_code-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_no_code.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_no_parameters-result.txt create mode 100644 Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_no_parameters.cmake create mode 100644 Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake create mode 100644 Tests/RunCMake/cmake_language/no_parameters-result.txt create mode 100644 Tests/RunCMake/cmake_language/no_parameters-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/no_parameters.cmake create mode 100644 Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt create mode 100644 Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt create mode 100644 Tests/RunCMake/cmake_language/unknown_meta_operation.cmake diff --git a/Help/command/cmake_command.rst b/Help/command/cmake_command.rst deleted file mode 100644 index 08b7832..0000000 --- a/Help/command/cmake_command.rst +++ /dev/null @@ -1,90 +0,0 @@ -cmake_command -------------- - -Call meta-operations on CMake commands. - -Synopsis -^^^^^^^^ - -.. parsed-literal:: - - cmake_command(`INVOKE`_ [...]) - cmake_command(`EVAL`_ CODE ...) - -Introduction -^^^^^^^^^^^^ - -This command will call meta-operations on built-in CMake commands or -those created via the :command:`macro` or :command:`function` commands. - -``cmake_command`` does not introduce a new variable or policy scope. - -Invoking Commands -^^^^^^^^^^^^^^^^^ - -.. _INVOKE: - -.. code-block:: cmake - - cmake_command(INVOKE [...]) - -Invokes the named ```` with the given arguments (if any). -For example, the code: - -.. code-block:: cmake - - set(message_command "message") - cmake_command(INVOKE ${message_command} STATUS "Hello World!") - -is equivalent to - -.. code-block:: cmake - - message(STATUS "Hello World!") - -Evaluating Code -^^^^^^^^^^^^^^^ - -.. _EVAL: - -.. code-block:: cmake - - cmake_command(EVAL CODE ...) - -Evaluates the ``...`` as CMake code. - -For example, the code: - -.. code-block:: cmake - - set(A TRUE) - set(B TRUE) - set(C TRUE) - set(condition "(A AND B) OR C") - - cmake_command(EVAL CODE " - if (${condition}) - message(STATUS TRUE) - else() - message(STATUS FALSE) - endif()" - ) - -is equivalent to - -.. 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()" - ) - - include(${CMAKE_CURRENT_BINARY_DIR}/eval.cmake) diff --git a/Help/command/cmake_language.rst b/Help/command/cmake_language.rst new file mode 100644 index 0000000..21f51a0 --- /dev/null +++ b/Help/command/cmake_language.rst @@ -0,0 +1,90 @@ +cmake_language +-------------- + +Call meta-operations on CMake commands. + +Synopsis +^^^^^^^^ + +.. parsed-literal:: + + cmake_language(`CALL`_ [...]) + cmake_language(`EVAL`_ CODE ...) + +Introduction +^^^^^^^^^^^^ + +This command will call meta-operations on built-in CMake commands or +those created via the :command:`macro` or :command:`function` commands. + +``cmake_language`` does not introduce a new variable or policy scope. + +Calling Commands +^^^^^^^^^^^^^^^^ + +.. _CALL: + +.. code-block:: cmake + + cmake_language(CALL [...]) + +Calls the named ```` with the given arguments (if any). +For example, the code: + +.. code-block:: cmake + + set(message_command "message") + cmake_language(CALL ${message_command} STATUS "Hello World!") + +is equivalent to + +.. code-block:: cmake + + message(STATUS "Hello World!") + +Evaluating Code +^^^^^^^^^^^^^^^ + +.. _EVAL: + +.. code-block:: cmake + + cmake_language(EVAL CODE ...) + +Evaluates the ``...`` as CMake code. + +For example, the code: + +.. code-block:: cmake + + 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()" + ) + +is equivalent to + +.. 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()" + ) + + include(${CMAKE_CURRENT_BINARY_DIR}/eval.cmake) diff --git a/Help/command/function.rst b/Help/command/function.rst index 30938b3..7a9b907 100644 --- a/Help/command/function.rst +++ b/Help/command/function.rst @@ -44,14 +44,14 @@ can be invoked through any of foo() Foo() FOO() - cmake_command(INVOKE foo) + cmake_language(CALL foo) and so on. However, it is strongly recommended to stay with the case chosen in the function definition. Typically functions use all-lowercase names. -The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the -function. +The :command:`cmake_language(CALL ...)` command can also be used to +invoke the function. Arguments ^^^^^^^^^ diff --git a/Help/command/macro.rst b/Help/command/macro.rst index 65159f4..797a90d 100644 --- a/Help/command/macro.rst +++ b/Help/command/macro.rst @@ -42,14 +42,14 @@ can be invoked through any of foo() Foo() FOO() - cmake_command(INVOKE foo) + cmake_language(CALL foo) and so on. However, it is strongly recommended to stay with the case chosen in the macro definition. Typically macros use all-lowercase names. -The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the -macro. +The :command:`cmake_language(CALL ...)` command can also be used to +invoke the macro. Arguments ^^^^^^^^^ diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 87743b4..0aa4f75 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -16,8 +16,8 @@ These commands are always available. :maxdepth: 1 /command/break - /command/cmake_command /command/cmake_host_system_information + /command/cmake_language /command/cmake_minimum_required /command/cmake_parse_arguments /command/cmake_policy diff --git a/Help/release/dev/cmake_command-command.rst b/Help/release/dev/cmake_command-command.rst deleted file mode 100644 index 6200ae2..0000000 --- a/Help/release/dev/cmake_command-command.rst +++ /dev/null @@ -1,6 +0,0 @@ -cmake_command -------------- - -* The :command:`cmake_command()` command was added for meta-operations on - scripted or built-in commands, starting with a mode to ``INVOKE`` other - commands, and ``EVAL CODE`` to inplace evaluate a CMake script. diff --git a/Help/release/dev/cmake_language-command.rst b/Help/release/dev/cmake_language-command.rst new file mode 100644 index 0000000..5c00cea --- /dev/null +++ b/Help/release/dev/cmake_language-command.rst @@ -0,0 +1,6 @@ +cmake_language-command +---------------------- + +* The :command:`cmake_language()` command was added for meta-operations on + scripted or built-in commands, starting with a mode to ``CALL`` other + commands, and ``EVAL CODE`` to inplace evaluate a CMake script. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6d585ee..22d8032 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -488,10 +488,10 @@ set(SRCS cmBuildCommand.h cmBuildNameCommand.cxx cmBuildNameCommand.h - cmCMakeCommand.cxx - cmCMakeCommand.h cmCMakeHostSystemInformationCommand.cxx cmCMakeHostSystemInformationCommand.h + cmCMakeLanguageCommand.cxx + cmCMakeLanguageCommand.h cmCMakeMinimumRequired.cxx cmCMakeMinimumRequired.h cmCMakePolicyCommand.cxx diff --git a/Source/cmCMakeCommand.cxx b/Source/cmCMakeCommand.cxx deleted file mode 100644 index 23bc0ea..0000000 --- a/Source/cmCMakeCommand.cxx +++ /dev/null @@ -1,111 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmCMakeCommand.h" - -#include -#include -#include -#include - -#include "cmExecutionStatus.h" -#include "cmListFileCache.h" -#include "cmMakefile.h" -#include "cmRange.h" -#include "cmStringAlgorithms.h" - -bool cmCMakeCommand(std::vector const& args, - cmExecutionStatus& status) -{ - if (args.empty()) { - status.SetError("called with incorrect number of arguments"); - return false; - } - - cmMakefile& makefile = status.GetMakefile(); - cmListFileContext context = makefile.GetExecutionContext(); - - bool result = false; - - std::vector dispatchExpandedArgs; - std::vector dispatchArgs; - dispatchArgs.emplace_back(args[0]); - makefile.ExpandArguments(dispatchArgs, dispatchExpandedArgs); - - if (dispatchExpandedArgs.empty()) { - status.SetError("called with incorrect number of arguments"); - return false; - } - - if (dispatchExpandedArgs[0] == "INVOKE") { - if ((args.size() == 1 && dispatchExpandedArgs.size() != 2) || - dispatchExpandedArgs.size() > 2) { - status.SetError("called with incorrect number of arguments"); - return false; - } - - // First argument is the name of the function to call - std::string invokeCommand; - size_t startArg; - if (dispatchExpandedArgs.size() == 1) { - std::vector functionExpandedArg; - std::vector functionArg; - functionArg.emplace_back(args[1]); - makefile.ExpandArguments(functionArg, functionExpandedArg); - - if (functionExpandedArg.size() != 1) { - status.SetError("called with incorrect number of arguments"); - return false; - } - - invokeCommand = functionExpandedArg[0]; - startArg = 2; - } else { - invokeCommand = dispatchExpandedArgs[1]; - startArg = 1; - } - - cmListFileFunction func; - func.Name = invokeCommand; - func.Line = context.Line; - - // The rest of the arguments are passed to the function call above - for (size_t i = startArg; i < args.size(); ++i) { - cmListFileArgument lfarg; - lfarg.Delim = args[i].Delim; - lfarg.Line = context.Line; - lfarg.Value = args[i].Value; - func.Arguments.emplace_back(lfarg); - } - - result = makefile.ExecuteCommand(func, status); - } else if (dispatchExpandedArgs[0] == "EVAL") { - std::vector expandedArgs; - makefile.ExpandArguments(args, expandedArgs); - - if (expandedArgs.size() < 2) { - status.SetError("called with incorrect number of arguments"); - return false; - } - - if (expandedArgs[1] != "CODE") { - auto code_iter = - std::find(expandedArgs.begin() + 2, expandedArgs.end(), "CODE"); - if (code_iter == expandedArgs.end()) { - status.SetError("called without CODE argument"); - } else { - status.SetError( - "called with unsupported arguments between EVAL and CODE arguments"); - } - return false; - } - - const std::string code = - cmJoin(cmMakeRange(expandedArgs.begin() + 2, expandedArgs.end()), " "); - result = makefile.ReadListFileAsString( - code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL")); - } else { - status.SetError("called with unknown meta-operation"); - } - - return result; -} diff --git a/Source/cmCMakeCommand.h b/Source/cmCMakeCommand.h deleted file mode 100644 index 7dbecff..0000000 --- a/Source/cmCMakeCommand.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCMakeCommand_h -#define cmCMakeCommand_h - -#include "cmConfigure.h" // IWYU pragma: keep - -#include - -class cmExecutionStatus; -struct cmListFileArgument; - -/** - * \brief Calls a scripted or build-in command - * - */ -bool cmCMakeCommand(std::vector const& args, - cmExecutionStatus& status); - -#endif diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx new file mode 100644 index 0000000..66857be --- /dev/null +++ b/Source/cmCMakeLanguageCommand.cxx @@ -0,0 +1,111 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCMakeLanguageCommand.h" + +#include +#include +#include +#include + +#include "cmExecutionStatus.h" +#include "cmListFileCache.h" +#include "cmMakefile.h" +#include "cmRange.h" +#include "cmStringAlgorithms.h" + +bool cmCMakeLanguageCommand(std::vector const& args, + cmExecutionStatus& status) +{ + if (args.empty()) { + status.SetError("called with incorrect number of arguments"); + return false; + } + + cmMakefile& makefile = status.GetMakefile(); + cmListFileContext context = makefile.GetExecutionContext(); + + bool result = false; + + std::vector dispatchExpandedArgs; + std::vector dispatchArgs; + dispatchArgs.emplace_back(args[0]); + makefile.ExpandArguments(dispatchArgs, dispatchExpandedArgs); + + if (dispatchExpandedArgs.empty()) { + status.SetError("called with incorrect number of arguments"); + return false; + } + + if (dispatchExpandedArgs[0] == "CALL") { + if ((args.size() == 1 && dispatchExpandedArgs.size() != 2) || + dispatchExpandedArgs.size() > 2) { + status.SetError("called with incorrect number of arguments"); + return false; + } + + // First argument is the name of the function to call + std::string callCommand; + size_t startArg; + if (dispatchExpandedArgs.size() == 1) { + std::vector functionExpandedArg; + std::vector functionArg; + functionArg.emplace_back(args[1]); + makefile.ExpandArguments(functionArg, functionExpandedArg); + + if (functionExpandedArg.size() != 1) { + status.SetError("called with incorrect number of arguments"); + return false; + } + + callCommand = functionExpandedArg[0]; + startArg = 2; + } else { + callCommand = dispatchExpandedArgs[1]; + startArg = 1; + } + + cmListFileFunction func; + func.Name = callCommand; + func.Line = context.Line; + + // The rest of the arguments are passed to the function call above + for (size_t i = startArg; i < args.size(); ++i) { + cmListFileArgument lfarg; + lfarg.Delim = args[i].Delim; + lfarg.Line = context.Line; + lfarg.Value = args[i].Value; + func.Arguments.emplace_back(lfarg); + } + + result = makefile.ExecuteCommand(func, status); + } else if (dispatchExpandedArgs[0] == "EVAL") { + std::vector expandedArgs; + makefile.ExpandArguments(args, expandedArgs); + + if (expandedArgs.size() < 2) { + status.SetError("called with incorrect number of arguments"); + return false; + } + + if (expandedArgs[1] != "CODE") { + auto code_iter = + std::find(expandedArgs.begin() + 2, expandedArgs.end(), "CODE"); + if (code_iter == expandedArgs.end()) { + status.SetError("called without CODE argument"); + } else { + status.SetError( + "called with unsupported arguments between EVAL and CODE arguments"); + } + return false; + } + + const std::string code = + cmJoin(cmMakeRange(expandedArgs.begin() + 2, expandedArgs.end()), " "); + result = makefile.ReadListFileAsString( + code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL")); + } else { + status.SetError("called with unknown meta-operation"); + } + + return result; +} diff --git a/Source/cmCMakeLanguageCommand.h b/Source/cmCMakeLanguageCommand.h new file mode 100644 index 0000000..7306515 --- /dev/null +++ b/Source/cmCMakeLanguageCommand.h @@ -0,0 +1,20 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmCMakeLanguageCommand_h +#define cmCMakeLanguageCommand_h + +#include "cmConfigure.h" // IWYU pragma: keep + +#include + +class cmExecutionStatus; +struct cmListFileArgument; + +/** + * \brief Calls a scripted or build-in command + * + */ +bool cmCMakeLanguageCommand(std::vector const& args, + cmExecutionStatus& status); + +#endif diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 28b4267..c94f128 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -91,8 +91,8 @@ # include "cmAddLinkOptionsCommand.h" # include "cmAuxSourceDirectoryCommand.h" # include "cmBuildNameCommand.h" -# include "cmCMakeCommand.h" # include "cmCMakeHostSystemInformationCommand.h" +# include "cmCMakeLanguageCommand.h" # include "cmExportCommand.h" # include "cmExportLibraryDependenciesCommand.h" # include "cmFLTKWrapUICommand.h" @@ -197,9 +197,9 @@ void GetScriptingCommands(cmState* state) "match the opening WHILE command."); #if !defined(CMAKE_BOOTSTRAP) - state->AddBuiltinCommand("cmake_command", cmCMakeCommand); state->AddBuiltinCommand("cmake_host_system_information", cmCMakeHostSystemInformationCommand); + state->AddBuiltinCommand("cmake_language", cmCMakeLanguageCommand); state->AddBuiltinCommand("load_cache", cmLoadCacheCommand); state->AddBuiltinCommand("remove", cmRemoveCommand); state->AddBuiltinCommand("variable_watch", cmVariableWatchCommand); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 230f168..0f94e4e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -281,6 +281,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(execute_process) add_RunCMake_test(export) +add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(cmake_parse_arguments) add_RunCMake_test(continue) @@ -676,5 +677,3 @@ add_RunCMake_test("CTestCommandExpandLists") add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test("UnityBuild") - -add_RunCMake_test(cmake_command) diff --git a/Tests/RunCMake/cmake_command/CMakeLists.txt b/Tests/RunCMake/cmake_command/CMakeLists.txt deleted file mode 100644 index 2632ffa..0000000 --- a/Tests/RunCMake/cmake_command/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake b/Tests/RunCMake/cmake_command/RunCMakeTest.cmake deleted file mode 100644 index a6b2efe..0000000 --- a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake +++ /dev/null @@ -1,23 +0,0 @@ -include(RunCMake) - -run_cmake(cmake_command_no_parameters) -run_cmake(cmake_command_unknown_meta_operation) -run_cmake(cmake_command_invoke_double_evaluation) -run_cmake(cmake_command_invoke_expanded_command) -run_cmake(cmake_command_invoke_expanded_command_and_arguments) -run_cmake(cmake_command_invoke_expanded_command_with_explicit_argument) -run_cmake(cmake_command_invoke_expand_command_name) -run_cmake(cmake_command_invoke_expand_function_name) -run_cmake(cmake_command_invoke_message) -run_cmake(cmake_command_invoke_message_fatal_error) -run_cmake(cmake_command_invoke_no_parameters) -run_cmake(cmake_command_invoke_preserve_arguments) -run_cmake(cmake_command_invoke_unknown_function) -run_cmake(cmake_command_eval_expand_command_name) -run_cmake(cmake_command_eval_expanded_command_and_arguments) -run_cmake(cmake_command_eval_extra_parameters_between_eval_and_code) -run_cmake(cmake_command_eval_message) -run_cmake(cmake_command_eval_message_fatal_error) -run_cmake(cmake_command_eval_no_code) -run_cmake(cmake_command_eval_no_parameters) -run_cmake(cmake_command_eval_variable_outside_message) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name-stderr.txt deleted file mode 100644 index d640661..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -OK! diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name.cmake deleted file mode 100644 index 4cea393..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_expand_command_name.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set (my_eval "EVAL") -cmake_command (${my_eval} CODE message("OK!")) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments-stderr.txt deleted file mode 100644 index d640661..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -OK! diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments.cmake deleted file mode 100644 index fcc399b..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_expanded_command_and_arguments.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(cmd EVAL CODE [[message("OK!")]]) -cmake_command(${cmd}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-result.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-stderr.txt deleted file mode 100644 index 13c114e..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at cmake_command_eval_extra_parameters_between_eval_and_code.cmake:1 \(cmake_command\): - cmake_command called with unsupported arguments between EVAL and CODE - arguments -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code.cmake deleted file mode 100644 index 0927631..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_extra_parameters_between_eval_and_code.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(EVAL BAD CODE "message(BAD CODE)") diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt deleted file mode 100644 index cfc8694..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -WORKS! diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake deleted file mode 100644 index 9ef5e25..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(EVAL CODE message(WORKS!)) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt deleted file mode 100644 index 6a8a124..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at cmake_command_eval_message_fatal_error.cmake:1:EVAL:2 \(message\): - error! -Call Stack \(most recent call first\): - cmake_command_eval_message_fatal_error.cmake:1 \(cmake_command\) - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake deleted file mode 100644 index 22913de..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake +++ /dev/null @@ -1,5 +0,0 @@ -cmake_command(EVAL CODE -" - message(FATAL_ERROR error!) -" -) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt deleted file mode 100644 index ee53312..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_eval_no_code.cmake:1 \(cmake_command\): - cmake_command called without CODE argument diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake deleted file mode 100644 index 22e1667..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(EVAL message "too many parameters") diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt deleted file mode 100644 index e9fc317..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_eval_no_parameters.cmake:1 \(cmake_command\): - cmake_command called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake deleted file mode 100644 index a5ba2c7..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(EVAL) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt deleted file mode 100644 index cfc8694..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -WORKS! diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake deleted file mode 100644 index b7a06a5..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake +++ /dev/null @@ -1,2 +0,0 @@ -cmake_command(EVAL CODE "set(phrase \"WORKS!\")") -message(${phrase}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation-stderr.txt deleted file mode 100644 index 59a70bd..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -var='\${foo}' diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation.cmake deleted file mode 100644 index 10970fc..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_double_evaluation.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(var [[${foo}]]) -cmake_command(INVOKE cmake_command INVOKE message "var='${var}'") diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name-stderr.txt deleted file mode 100644 index d640661..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -OK! diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name.cmake deleted file mode 100644 index d59afe4..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_command_name.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set (my_invoke "INVOKE") -cmake_command (${my_invoke} message "OK!") diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name-stderr.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name.cmake deleted file mode 100644 index 923ddaa..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expand_function_name.cmake +++ /dev/null @@ -1,11 +0,0 @@ -function(some_function_1) - message(1) -endfunction() - -function(some_function_2) - message(2) -endfunction() - -set(function_version 1) - -cmake_command(INVOKE some_function_${function_version}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command-stderr.txt deleted file mode 100644 index d640661..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -OK! diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command.cmake deleted file mode 100644 index bca7d2f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command.cmake +++ /dev/null @@ -1,6 +0,0 @@ -function (itsok) - message(OK!) -endfunction() - -set (cmd INVOKE itsok) -cmake_command (${cmd}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-result.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-stderr.txt deleted file mode 100644 index 6d0e241..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at cmake_command_invoke_expanded_command_and_arguments.cmake:2 \(cmake_command\): - cmake_command called with incorrect number of arguments -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments.cmake deleted file mode 100644 index 6bfa3a7..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_and_arguments.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(invoke_message INVOKE message a b) -cmake_command(${invoke_message}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument-stderr.txt deleted file mode 100644 index d640661..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -OK! diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument.cmake deleted file mode 100644 index eb0411f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_expanded_command_with_explicit_argument.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set (cmd INVOKE message) -cmake_command (${cmd} "OK!") diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt deleted file mode 100644 index cfc8694..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -WORKS! diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake deleted file mode 100644 index 336d78a..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE message WORKS!) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt deleted file mode 100644 index 2c9dab5..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at cmake_command_invoke_message_fatal_error.cmake:1 \(message\): - error! -Call Stack \(most recent call first\): - cmake_command_invoke_message_fatal_error.cmake:1 \(cmake_command\) - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake deleted file mode 100644 index 6b42764..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE message FATAL_ERROR error!) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt deleted file mode 100644 index 7741b41..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_invoke_no_parameters.cmake:1 \(cmake_command\): - cmake_command called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake deleted file mode 100644 index b9c5e14..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt deleted file mode 100644 index 4670e60..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -foo\(...\) -\[a;b\] -\[c;d\] -cmake_command\(INVOKE foo ...\) -\[a;b\] -\[c;d\] diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake deleted file mode 100644 index 53ac2e6..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake +++ /dev/null @@ -1,12 +0,0 @@ -function(foo arg1 arg2) - math(EXPR last "${ARGC} - 1") - foreach(i RANGE 0 ${last}) - message("[${ARGV${i}}]") - endforeach() -endfunction() - -message("foo(...)") -foo("a;b" "c;d") - -message("cmake_command(INVOKE foo ...)") -cmake_command(INVOKE foo "a;b" "c;d") diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt deleted file mode 100644 index 50a81a3..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_invoke_unknown_function.cmake:1 \(unknown\): - Unknown CMake command "unknown". diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake deleted file mode 100644 index f19a04b..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE unknown) diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt b/Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt deleted file mode 100644 index 772b604..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_no_parameters.cmake:1 \(cmake_command\): - cmake_command called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake deleted file mode 100644 index b9c5e14..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE) diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt b/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt deleted file mode 100644 index 7b9b915..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_unknown_meta_operation.cmake:1 \(cmake_command\): - cmake_command called with unknown meta-operation diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake b/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake deleted file mode 100644 index f7c77e5..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(UNKNOWN) diff --git a/Tests/RunCMake/cmake_language/CMakeLists.txt b/Tests/RunCMake/cmake_language/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/cmake_language/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake new file mode 100644 index 0000000..c556e42 --- /dev/null +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +run_cmake(no_parameters) +run_cmake(unknown_meta_operation) +run_cmake(call_double_evaluation) +run_cmake(call_expanded_command) +run_cmake(call_expanded_command_and_arguments) +run_cmake(call_expanded_command_with_explicit_argument) +run_cmake(call_expand_command_name) +run_cmake(call_expand_function_name) +run_cmake(call_message) +run_cmake(call_message_fatal_error) +run_cmake(call_no_parameters) +run_cmake(call_preserve_arguments) +run_cmake(call_unknown_function) +run_cmake(eval_expand_command_name) +run_cmake(eval_expanded_command_and_arguments) +run_cmake(eval_extra_parameters_between_eval_and_code) +run_cmake(eval_message) +run_cmake(eval_message_fatal_error) +run_cmake(eval_no_code) +run_cmake(eval_no_parameters) +run_cmake(eval_variable_outside_message) diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt new file mode 100644 index 0000000..59a70bd --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt @@ -0,0 +1 @@ +var='\${foo}' diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation.cmake b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake new file mode 100644 index 0000000..cf8fc91 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake @@ -0,0 +1,2 @@ +set(var [[${foo}]]) +cmake_language(CALL cmake_language CALL message "var='${var}'") diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name.cmake b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake new file mode 100644 index 0000000..e03bb1f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake @@ -0,0 +1,2 @@ +set (my_call "CALL") +cmake_language (${my_call} message "OK!") diff --git a/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_expand_function_name.cmake b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake new file mode 100644 index 0000000..565a7df --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake @@ -0,0 +1,11 @@ +function(some_function_1) + message(1) +endfunction() + +function(some_function_2) + message(2) +endfunction() + +set(function_version 1) + +cmake_language(CALL some_function_${function_version}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expanded_command.cmake b/Tests/RunCMake/cmake_language/call_expanded_command.cmake new file mode 100644 index 0000000..e76e612 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command.cmake @@ -0,0 +1,6 @@ +function (itsok) + message(OK!) +endfunction() + +set (cmd CALL itsok) +cmake_language (${cmd}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt new file mode 100644 index 0000000..e87e9bc --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at call_expanded_command_and_arguments.cmake:2 \(cmake_language\): + cmake_language called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake new file mode 100644 index 0000000..4ce6b34 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake @@ -0,0 +1,2 @@ +set(call_message CALL message a b) +cmake_language(${call_message}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake new file mode 100644 index 0000000..0563400 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake @@ -0,0 +1,2 @@ +set (cmd CALL message) +cmake_language (${cmd} "OK!") diff --git a/Tests/RunCMake/cmake_language/call_message-stderr.txt b/Tests/RunCMake/cmake_language/call_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_language/call_message.cmake b/Tests/RunCMake/cmake_language/call_message.cmake new file mode 100644 index 0000000..31aefdf --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message.cmake @@ -0,0 +1 @@ +cmake_language(CALL message WORKS!) diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt new file mode 100644 index 0000000..83eb3d8 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at call_message_fatal_error.cmake:1 \(message\): + error! +Call Stack \(most recent call first\): + call_message_fatal_error.cmake:1 \(cmake_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake new file mode 100644 index 0000000..935b437 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake @@ -0,0 +1 @@ +cmake_language(CALL message FATAL_ERROR error!) diff --git a/Tests/RunCMake/cmake_language/call_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt new file mode 100644 index 0000000..9e2c08f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at call_no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/call_no_parameters.cmake b/Tests/RunCMake/cmake_language/call_no_parameters.cmake new file mode 100644 index 0000000..8353e08 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(CALL) diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt new file mode 100644 index 0000000..8ec5483 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt @@ -0,0 +1,6 @@ +foo\(...\) +\[a;b\] +\[c;d\] +cmake_language\(CALL foo ...\) +\[a;b\] +\[c;d\] diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake new file mode 100644 index 0000000..bfef0fd --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake @@ -0,0 +1,12 @@ +function(foo arg1 arg2) + math(EXPR last "${ARGC} - 1") + foreach(i RANGE 0 ${last}) + message("[${ARGV${i}}]") + endforeach() +endfunction() + +message("foo(...)") +foo("a;b" "c;d") + +message("cmake_language(CALL foo ...)") +cmake_language(CALL foo "a;b" "c;d") diff --git a/Tests/RunCMake/cmake_language/call_unknown_function-result.txt b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt new file mode 100644 index 0000000..d09e708 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at call_unknown_function.cmake:1 \(unknown\): + Unknown CMake command "unknown". diff --git a/Tests/RunCMake/cmake_language/call_unknown_function.cmake b/Tests/RunCMake/cmake_language/call_unknown_function.cmake new file mode 100644 index 0000000..efd6baf --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function.cmake @@ -0,0 +1 @@ +cmake_language(CALL unknown) diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake new file mode 100644 index 0000000..2397232 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake @@ -0,0 +1,2 @@ +set (my_eval "EVAL") +cmake_language (${my_eval} CODE message("OK!")) diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake new file mode 100644 index 0000000..f7d2d51 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake @@ -0,0 +1,2 @@ +set(cmd EVAL CODE [[message("OK!")]]) +cmake_language(${cmd}) diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt new file mode 100644 index 0000000..d32054f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at eval_extra_parameters_between_eval_and_code.cmake:1 \(cmake_language\): + cmake_language called with unsupported arguments between EVAL and CODE + arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake new file mode 100644 index 0000000..7c004d7 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake @@ -0,0 +1 @@ +cmake_language(EVAL BAD CODE "message(BAD CODE)") diff --git a/Tests/RunCMake/cmake_language/eval_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_language/eval_message.cmake b/Tests/RunCMake/cmake_language/eval_message.cmake new file mode 100644 index 0000000..91edcdd --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message.cmake @@ -0,0 +1 @@ +cmake_language(EVAL CODE message(WORKS!)) diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt new file mode 100644 index 0000000..5cf11e3 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at eval_message_fatal_error.cmake:1:EVAL:2 \(message\): + error! +Call Stack \(most recent call first\): + eval_message_fatal_error.cmake:1 \(cmake_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake new file mode 100644 index 0000000..72e155d --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake @@ -0,0 +1,5 @@ +cmake_language(EVAL CODE +" + message(FATAL_ERROR error!) +" +) diff --git a/Tests/RunCMake/cmake_language/eval_no_code-result.txt b/Tests/RunCMake/cmake_language/eval_no_code-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt new file mode 100644 index 0000000..608ba88 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at eval_no_code.cmake:1 \(cmake_language\): + cmake_language called without CODE argument diff --git a/Tests/RunCMake/cmake_language/eval_no_code.cmake b/Tests/RunCMake/cmake_language/eval_no_code.cmake new file mode 100644 index 0000000..7f5bc21 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code.cmake @@ -0,0 +1 @@ +cmake_language(EVAL message "too many parameters") diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt new file mode 100644 index 0000000..6166898 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at eval_no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters.cmake b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake new file mode 100644 index 0000000..e7ae808 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(EVAL) diff --git a/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake new file mode 100644 index 0000000..71f0457 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake @@ -0,0 +1,2 @@ +cmake_language(EVAL CODE "set(phrase \"WORKS!\")") +message(${phrase}) diff --git a/Tests/RunCMake/cmake_language/no_parameters-result.txt b/Tests/RunCMake/cmake_language/no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt new file mode 100644 index 0000000..194bbe3 --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/no_parameters.cmake b/Tests/RunCMake/cmake_language/no_parameters.cmake new file mode 100644 index 0000000..8353e08 --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(CALL) diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt new file mode 100644 index 0000000..6a1d4fd --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at unknown_meta_operation.cmake:1 \(cmake_language\): + cmake_language called with unknown meta-operation diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake new file mode 100644 index 0000000..699f36f --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake @@ -0,0 +1 @@ +cmake_language(UNKNOWN) -- cgit v0.12