Skip to content

[BUG] Overloaded message command strip semicolon characters in lists #116

@josephgarnier

Description

@josephgarnier

Describe the bug
In CMake, the message command delimits the elements of a list with a semicolon character when surrounded by quotes. But CMakeTest, by overriding this command in cmake/cmake_test/overrides.cmake, removes this feature.

However, this file states that overriding should only occur when FATAL_ERROR is used: If the first argument is not FATAL_ERROR, this function will behave exactly as the original message().. This doesn't seem to be the case and when I comment the code in the overload function, the bug disappears.

Environment:

  • Operating system: Windows 10
  • CMake version: 4.0.1

To Reproduce
Steps to reproduce the behavior:

  1. In CMakeLists.txt without tests, copy the code bellow.
  2. Execute the CMake build command

Expected behavior

Let's assume the following use case without then with a CMakeTest inclusion:

message("------")
set(input_text "A B C")
message("${input_text}") # would give A B C
set(input_list A B C)
message("${input_list}") # would give A;B;C
set(input_list "A" "B" "C")
message("${input_list}") # would give A;B;C
set(input_list "A" "B" "C")
message(${input_list}) # would give ABC

include(cmake_test/cmake_test OPTIONAL RESULT_VARIABLE cmake_test_found)

message("------")
set(input_text "A B C")
message("${input_text}") # would give A B C => OK
set(input_list A B C)
message("${input_list}") # would give A;B;C => not OK, give ABC
set(input_list "A" "B" "C")
message("${input_list}") # would give A;B;C => not OK, give ABC
set(input_list "A" "B" "C")
message(${input_list}) # would give ABC => OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions