From c0a05fc1ca13385c0ae5b4eb67ed5a83813cbbae Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Thu, 17 Oct 2024 20:50:32 +0700 Subject: [PATCH] feat: rename `DEFINES` option in `add_cmake_script_test` to `DEFINITIONS` (#268) Signed-off-by: Alfi Maulana --- README.md | 6 +++--- cmake/Assertion.cmake | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index bc930d4..0764951 100644 --- a/README.md +++ b/README.md @@ -97,17 +97,17 @@ This variable contains the version of the included `Assertion.cmake` module. Adds a new test that processes the given CMake file in script mode. ```cmake -add_cmake_script_test( [NAME ] [DEFINES ...]) +add_cmake_script_test( [NAME ] [DEFINITIONS ...]) ``` This function adds a new test that processes the given `` in script mode. If `NAME` is specified, it will use `` as the test name; otherwise, it will use ``. -If `DEFINES` is specified, the script is processed with predefined variables listed in `...`. Each entry in `...` should be in the format `=`, where `` is the variable name and `` is the variable value. +If `DEFINITIONS` is specified, the script is processed with predefined variables listed in ``. Each entry in `` should be in the format `=`, where `` is the variable name and `` is the variable value. #### Example ```cmake -add_cmake_script_test(test_foo.cmake NAME "Test Foo" DEFINES FOO=foo BAR=bar) +add_cmake_script_test(test_foo.cmake NAME "Test Foo" DEFINITIONS FOO=foo BAR=bar) ``` The example above adds a new test named `Test Foo`, which processes the `test_foo.cmake` file in script mode with predefined `FOO` and `BAR` variables. diff --git a/cmake/Assertion.cmake b/cmake/Assertion.cmake index a503312..3ec4448 100644 --- a/cmake/Assertion.cmake +++ b/cmake/Assertion.cmake @@ -25,18 +25,18 @@ set(ASSERTION_VERSION 2.0.0) # Adds a new test that processes the given CMake file in script mode. # -# add_cmake_script_test( [NAME ] [DEFINES ...]) +# add_cmake_script_test( [NAME ] [DEFINITIONS ...]) # # This function adds a new test that processes the given `` in script # mode. If `NAME` is specified, it will use `` as the test name; # otherwise, it will use ``. # -# If `DEFINES` is specified, the script is processed with predefined variables -# listed in `...`. Each entry in `...` should be in the -# format `=`, where `` is the variable name and `` is -# the variable value. +# If `DEFINITIONS` is specified, the script is processed with predefined +# variables listed in ``. Each entry in `` should be in +# the format `=`, where `` is the variable name and `` +# is the variable value. function(add_cmake_script_test FILE) - cmake_parse_arguments(PARSE_ARGV 1 ARG "" NAME DEFINES) + cmake_parse_arguments(PARSE_ARGV 1 ARG "" NAME DEFINITIONS) if(NOT DEFINED ARG_NAME) set(ARG_NAME "${FILE}") @@ -48,8 +48,8 @@ function(add_cmake_script_test FILE) endif() set(TEST_COMMAND "${CMAKE_COMMAND}") - foreach(DEFINE IN LISTS ARG_DEFINES) - list(APPEND TEST_COMMAND -D "${DEFINE}") + foreach(DEFINITION IN LISTS ARG_DEFINITIONS) + list(APPEND TEST_COMMAND -D "${DEFINITION}") endforeach() list(APPEND TEST_COMMAND -P "${FILE}")