'How do I use message() in CMake?
I have a CMakeLists with this code:
macro(set_up_additional_targets)
add_custom_target(generate_things
message("Generating stuff")
COMMAND python3 generator.py --outfile ${CMAKE_CURRENT_SOURCE_DIR}/sources/stuff
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/generator/
)
endmacro(set_up_additional_targets)
I get this error:
/bin/sh: -c: line 0: syntax error near unexpected token `Generating\ stuff'
/bin/sh: -c: line 0: `cd /home/me/workspaces/foo/tools/generator && message ( Generating\ stuff )'
make[3]: *** [CMakeFiles/generate_things.dir/build.make:70: CMakeFiles/generate_things] Error 1
make[2]: *** [CMakeFiles/Makefile2:699: CMakeFiles/generate_things.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:706: CMakeFiles/generate_things.dir/rule] Error 2
make: *** [Makefile:439: generate_things] Error 2
I changed from COMMAND echo "Generating stuff" to message("Generating stuff") to become more platform independent, but it obviously doesn't work. It is not clear from the CMake manual how this could be wrong, though, as usual with CMake, there are no examples in the manual.
What is my mistake?
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kamath |
