<div dir="ltr"><div>I think this works like you want:<br><br>cmake_minimum_required(VERSION 2.6)<br><br>set(DO_RELAX 1)<br>if(DO_RELAX)<br>    set(OR_RELAX || echo \"no big deal\")<br>else()<br>    set(OR_RELAX)<br>
endif()<br><br>add_custom_command(OUTPUT foo COMMAND generate-foo ${OR_RELAX} VERBATIM)<br>add_custom_target(do-foo ALL DEPENDS foo)<br><br><br>--<br></div>Glenn<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 29 July 2014 19:19, J Decker <span dir="ltr"><<a href="mailto:d3ck0r@gmail.com" target="_blank">d3ck0r@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">can try removing the quotes and subst space for semicolon?</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 29, 2014 at 11:13 AM, Bill Newcomb <span dir="ltr"><<a href="mailto:bnewcomb@nvidia.com" target="_blank">bnewcomb@nvidia.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That doesn't work either:<br>
<div><br>
foo:<br>
        $(CMAKE_COMMAND) -E cmake_progress_report /home/bnewcomb/tmp/cmake-tests/custom-or/CMakeFiles $(CMAKE_PROGRESS_1)<br>
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold "Generating foo"<br>
</div>        generate-foo "|| echo \"no big deal\""<br>
<br>
The whole string gets passed as the first argument to generate-foo.<br>
<span><font color="#888888"><br>
B.<br>
</font></span><div><div><br>
On 07/25/2014 09:43 AM, Iosif Neitzke wrote:<br>
> "If VERBATIM is given then all arguments to the commands will be<br>
> escaped properly for the build tool so that the invoked command<br>
> receives each argument unchanged. Note that one level of escapes is<br>
> still used by the CMake language processor before add_custom_command<br>
> even sees the arguments. Use of VERBATIM is recommended as it enables<br>
> correct behavior. When VERBATIM is not given the behavior is platform<br>
> specific because there is no protection of tool-specific special<br>
> characters."<br>
><br>
> <a href="http://www.cmake.org/cmake/help/v3.0/command/add_custom_command.html" target="_blank">http://www.cmake.org/cmake/help/v3.0/command/add_custom_command.html</a><br>
><br>
> On Fri, Jul 25, 2014 at 11:20 AM, Bill Newcomb <<a href="mailto:bnewcomb@nvidia.com" target="_blank">bnewcomb@nvidia.com</a>> wrote:<br>
>> I want to add stuff to a custom command based on some definition:<br>
>><br>
>> cmake_minimum_required(VERSION 2.6)<br>
>><br>
>> set(DO_RELAX 1)<br>
>> if(DO_RELAX)<br>
>>      set(OR_RELAX "|| echo \"no big deal\"")<br>
>> else()<br>
>>      set(OR_RELAX "")<br>
>> endif()<br>
>><br>
>> add_custom_command(OUTPUT foo COMMAND generate-foo ${OR_RELAX})<br>
>> add_custom_target(do-foo ALL DEPENDS foo)<br>
>><br>
>><br>
>> However, this produces the following rule in the generated makefile:<br>
>><br>
>> foo:<br>
>>          $(CMAKE_COMMAND) -E cmake_progress_report /home/bnewcomb/tmp/cmake-tests/custom-or/CMakeFiles $(CMAKE_PROGRESS_1)<br>
>>          @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold "Generating foo"<br>
>>          generate-foo ||\ echo\ "no\ big\ deal"<br>
>><br>
>> Is there some way I can get cmake to not escape all of the<br>
>> spaces in the value of OR_RELAX?<br>
>><br>
>> Thanks,<br>
>> B.<br>
>><br>
>> -----------------------------------------------------------------------------------<br>
>> This email message is for the sole use of the intended recipient(s) and may contain<br>
>> confidential information.  Any unauthorized review, use, disclosure or distribution<br>
>> is prohibited.  If you are not the intended recipient, please contact the sender by<br>
>> reply email and destroy all copies of the original message.<br>
>> -----------------------------------------------------------------------------------<br>
>> --<br>
>><br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
>><br>
>> CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
>> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
>><br>
>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>