I'm assuming this is under a Unix platform - in my experience, on Windows, I get the color escape codes even running cmake builds under Jenkins. On Unix platforms, you could install expect and use the unbuffer tool, e.g. "unbuffer make -j8 -k". -- Daniel Schepler ________________________________________ From: CMake [cmake-boun...@cmake.org] on behalf of Daniel Wirtz [daniel.wi...@simtech.uni-stuttgart.de] Sent: Thursday, November 12, 2015 2:05 AM To: cmake@cmake.org Subject: Re: [CMake] Custom message if target fails
Hey, neat idea, i've tried and it works (i have custom targets there). However, the "nice" colored build text output of such a solution gets lost completely (pipes etc); are there any alternative ideas/solutions? thanks again! Dr. Daniel Wirtz Dipl. Math. Dipl. Inf. SRC SimTech Pfaffenwaldring 5a +49 711 685 60044 On 11/12/2015 10:10 AM, Nils Gladitz wrote: > 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 -- 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