Hi,
The following project:
cmake_minimum_required(VERSION 3.15)
project(test_quoting_macro_and_function)
function(my_func)
message("func ARGV: ${ARGV}")
endfunction()
macro(my_macro)
message("macro ARGV: ${ARGV}")
endmacro()
my_func (LIBS_SUFFIX="\\\\"_${CMAKE_SYSTEM_PROCESSOR}.so\\\\"")
my_macro(LIBS_SUFFIX="\\\\"_${CMAKE_SYSTEM_PROCESSOR}.so\\\\"")
generates the following output:
func ARGV: LIBS_SUFFIX="\\"_x86_64.so\\""
macro ARGV: LIBS_SUFFIX="\"_x86_64.so\""
In the macro case. a pair of slashes disappear.
My ultimate goal is to allow passing a value like LIBS_SUFFIX="\\\\"_${CMAKE_SYSTEM_PROCESSOR}.so\\\\""
to a macro, and within that macro to forward the exact same value to a function.
So something like:
function(foo)
# do stuff
endfunction()
macro(wrapper)
foo(${ARGV})
endmacro()
Is this somehow achievable? Am supposed to do something like? What else would i be missing then?
string(REPLACE "\\" "\\\\" my_var ${ARGV})
The reasoning is to provide a compatibility api for a function that got renamed, and thus the arguments from the macro should be sent verbatim to the function.
Thanks.