I want to pass a variable's value to a function as if I had directly written it. Here is what I have tried:
cmake_minimum_required (VERSION 3.5.1)
project(test)
message(WARNING "This is a warning")
# CMake Warning at CMakeLists.txt:4 (message):
# This is a warning
set(variable "WARNING \"This is a warning\"")
message(${variable})
# WARNING "This is a warning"
Unfortunately, you can see that the second call to message doesn't behave like the first one. How to achieve this purpose?
message(WARNING ${message_var})?