[CMake] Spaces in a command

Bill Newcomb bnewcomb at nvidia.com
Fri Jul 25 12:20:43 EDT 2014


I want to add stuff to a custom command based on some definition:

cmake_minimum_required(VERSION 2.6)

set(DO_RELAX 1)
if(DO_RELAX)
    set(OR_RELAX "|| echo \"no big deal\"")
else()
    set(OR_RELAX "")
endif()

add_custom_command(OUTPUT foo COMMAND generate-foo ${OR_RELAX})
add_custom_target(do-foo ALL DEPENDS foo)


However, this produces the following rule in the generated makefile:

foo:
        $(CMAKE_COMMAND) -E cmake_progress_report /home/bnewcomb/tmp/cmake-tests/custom-or/CMakeFiles $(CMAKE_PROGRESS_1)
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold "Generating foo"
        generate-foo ||\ echo\ "no\ big\ deal"

Is there some way I can get cmake to not escape all of the 
spaces in the value of OR_RELAX?

Thanks,
B.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


More information about the CMake mailing list