linux - CMake: how to use if condition in add_custom_command(...) -


i want use linux if condition in cmakelists.txt add_custom_command(...) need run these if condition , judgement in makefile. this:

cmake_minimum_required(version 2.8) add_custom_target(temp_target all) add_custom_command(target temp_target                    pre_build                    command if ["a" != "b"]; echo 1; fi;                    verbatim ) 

what should if want use

if ["a" != "b"]; echo 1; fi; 

when make makefile? lot help!

you may specify one-line shell code using /bin/sh -c command argument:

command /bin/sh -c "if [ 'a' != 'b' ]; echo 1; fi;" 

note, [ extension of bash, may unknown simple shells "dash".


Comments

Popular posts from this blog

c++ - list<myClass<int> * > sort -

SoapUI on windows 10 - high DPI/4K scaling issue -

java - why am i getting a "cannot resolve method" error on getApplication? -