Example: # cat CMakeLists.txt execute_process(COMMAND echo master WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE BRANCH )
add_custom_target(do-it COMMAND echo "${BRANCH}" COMMAND echo "${BRANCH}" ) # cmake . -GNinja >/dev/null # echo $? 0 # ninja ninja: error: # Examining the build.ninja file shows: build CMakeFiles/do-it: CUSTOM_COMMAND COMMAND = cd /home/cody/foo && echo master && echo master (That is a newline before the '&&') Make output is similarly flawed, but recovers due to more lenient syntax: CMakeFiles/do-it: echo master echo master -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake