On 11/12/2015 09:54 AM, Daniel Wirtz wrote:
Dear all,
i've been thinking on this for a while but i can't seem to get my head
around how to solve this.
The task is simple: How can i display a custom error message if a
target fails to build for whatever reason?
- cmake ..
- make
- <build starts, stuff goes wrong, error out>
- below the (compile-tool dependent error output) i'd like to print
something like "Whoops it went wrong, type this and that or visit this
or that website for help"
There is no generic build system feature for this.
You haven't provided any details on what kind of target this concerns or
what is to be diagnosed specifically but ...
Assuming this is a custom target / custom command you could replace the
actual command with a wrapper (e.g. cmake -P script) that:
- runs the actual command (e.g. execute_process())
- outputs a message based on the actual command's exit status (e.g.
message("This and that"))
- exits with (roughly) the same exit status as the actual command
(e.g. message(FATAL_ERROR) on failure))
For regular build targets (executables, libraries) there is nothing to
be done at build time.
Depending on what it is you are actually diagnosing you might want to
try to diagnose it during configuration rather than during the build.
Nils
--
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