[CMake] Order of COMMENT display for custom command and target
Mateusz Loskot
mateusz at loskot.net
Wed Jul 11 17:56:50 EDT 2012
Hi,
I'm working with add_custom_command and add_custom_target commands
as implemented in CMake 2.8.8.
For my command and target, I set COMMENT property.
I'd like to understand the actual order in which COMMENT messages are
displayed for command vs target.
The documentation says:
"If COMMENT is set, the value will be displayed as a message
before the commands are executed at build time."
When I look at the CMake output, the semantic of 'before' is slightly confusing.
Here is quick example:
$ cat ../CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
project (Hello)
add_custom_command(OUTPUT my.out
COMMAND echo "touch my.out"
COMMENT "Touching my.out"
VERBATIM
)
add_custom_target(MyOut ALL
DEPENDS my.out
COMMENT "Making MyOut"
VERBATIM)
The custom target depends on custom command.
AFAIU, processing order is as follows:
1. The target is built, dependency discovered.
2. The command is built.
In details, given the documentation on COMMENT displaying included
above, I'd expect this:
1. The target MyOut requested to build
1.1. COMMENT "Making MyOut" is displayed, before building target
1.2. The target MyOUT is built, dependency discovered.
2. The command requested to build:
2.1. COMMENT "Touching my.out" is displayed, before executing command
2.2. COMMAND echo "touch my.out" executed
However, actual output of the build looks like this:
mloskot build $ cmake ../
...
mloskot build $ make
[ 50%] Touching my.out
touch my.out
[100%] Making MyOut
[100%] Built target MyOut
mloskot build $
The COMMENT messages are displayed in reverse order than
I'd expect according to my interpretation of the manual.
I'd also say that the reverse order is counter-intuitive, isn't it?
Is my interpretation incorrect or there is anything in my
CMakeLists.txt or anywhere?
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
More information about the CMake
mailing list