How to output cmake's status message during colcon build? [closed]
Hi,
In one of my project, in the cmake, there are several message output, like
if(CUDA_VERBOSE)
message("CUDA is available!")
message("CUDA Libs: ${CUDA_LIBRARIES}")
message("CUDA Headers: ${CUDA_INCLUDE_DIRS}")
endif()
I would like to check the cmake messages during a colcon build.
I tried this build command but failed:
colcon build --packages-select image_projection_based_fusion --event-handlers console_direct+ --cmake-args -DCUDA_VERBOSE:BOOL=ON
--event-handlers console_direct+
does enable some output messages, but they are not cmake message.
So, what's the correnct colcon arguments?
Please see whether #q395456 and #q363112 sufficiently address this.
If they do, please mark yours as a duplicate and close it.
In neither of the answers to the two questions linked above could I find an answer to the OP's question, which was how to get cmake messages to display.
What does work btw are WARNING messages, like so:
But regular status messages do not display for me under colcon.
The OP closed the question, so I assume he got things to work.
However, a quick test shows everything higher than
message("some string")
(ie:NOTICE
) is included in the--event-handlers console_direct+ --cmake-args -DCMAKE_VERBOSE_MAKEFILE=ON
output on my system (ie:message(STATUS "some string")
,message(WARNING ..)
andmessage(FATAL_ERROR ..)
etc).message("some string")
gets routed tostderr
by CMake, so they do end up in the Colcon build log, but are not shown in the terminal.I believe recommended practice would be
message(STATUS ..)
, but that's probably not going to be something many CMake projects do.message("some string")
shows up for me as part of theconsole_direct+
output when invoking Colcon like:Note that
VERBOSE=1
typically only works for (GNU) Make driven builds.This was mentioned by @Dirk Thomas in #q363112.
Note also:
and this will cause Colcon to assume your package's build was not (completely) successful. It will not fail or abort the build (that would not be one of Colcon's responsibilities), but it will print a
stderr
summary at the end of the build.Something like:
Note the
some string
at the top there.