On Fri, 27 Mar 2020 07:18:11 +0100
Hendrik Sattler <p...@hendrik-sattler.de> wrote:

> Hi Carlo,
> 
> The answer is already right in front of you: "a && b" executes b only
> if a returns positive (zero exit code). This is already done for the
> mkdir.
> 
> And to answer the other question: no, you cannot assume a POSIX shell
> in a Makefile.
> 
> HS

Hi Hendrik,

thank you for your reply :). I kinda overlooked that I have to admit.
I think my brain saw the '&&' as shell scripting and the question
was if that is portable, or that the generated Makefile on my system
made use of that because of the platform that I am using.

So, for clarity, I can use:

    add_custom_command(
      ...
      COMMAND ${cmd} && ${CMAKE_COMMAND} -E touch ${stamp_file}
    )

Where ${cmd} is the user defined command,
and that will work portably on all supported platforms?

How should I do this for GENERATOR_IS_MULTI_CONFIG?

Carlo Wood

PS I assume that '||' also works then. Namely I also need the
   stamp file to be created when it doesn't exist.

   So really I need in addition

   COMMAND test -e ${stamp_file} || ${CMAKE_COMMAND} -E touch ${stamp_file}

Is 'test -e' also portable?

-- 

Powered by kitware.com/cmake

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit https://cmake.org/services

Visit other Kitware open-source projects at https://www.kitware.com/platforms

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

This mailing list is deprecated in favor of https://discourse.cmake.org

Reply via email to