[CMake] Escaping/quoting special option keywords

Rémi Rampin remirampin at gmail.com
Thu Jan 22 14:29:21 EST 2015


Hi everyone,

I'm trying to figure out a way to escape the special keywords that are
used to introduce named options in function arguments (see
CMakeParseArguments [1]), for example to pass the string
RESULT_VARIABLE as argument to a command executed via
execute_process():

    set(what "RESULT_VARIABLE")
    execute_process(COMMAND echo ${what})

Example result:

    CMake Error at CMakeLists.txt:2 (execute_process):
      execute_process called with no value for RESULT_VARIABLE.

The documentation doesn't seem to mention anything, nor did I see a
solution for this in CMakeParseArguments.cmake. Is there a way to do
that, or do I have to just accept that some argument values will crash
CMake? That would be a bummer.

I'd appreciate any pointers,
-- 
Rémi Rampin

[1] http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html


More information about the CMake mailing list