MantisBT - CMake
View Issue Details
0014121CMakeCMakepublic2013-04-29 16:512013-10-31 10:24
Nils Gladitz 
Robert Maynard 
normalminoralways
closedfixed 
 
CMake 2.8.12CMake 3.0 
0014121: Custom command errors are hidden when CTest launchers are used with Ninja
I couldn't get any build errors from custom commands on my CDash dashboard when using Ninja with CTest launchers.

Neither are there errors from custom commands with failure exit status nor from those with output matched by CTEST_CUSTOM_ERROR_MATCH.
I've set up a test project for which I tested make and ninja with and without launchers.

CTEST_CUSTOM_ERROR_MATCH is set to "FooBar".

The project contains three custom commands with the following outputs and exit codes:

    CustomCommand1: "this is a FooBar message" (exit success)
    CustomCommand2: "this is a fatal error" (exit failure)
    CustomCommand3: "this is a FooBar fatal error" (exit failure)
    
These are the results that I got (numbers in braces indicate which custom commands produce output visible on CDash):

    Ninja (Launchers enabled): 0 Build Errors
    Ninja (Launchers disabled): 4 Build Errors (1, 2, 3)

    Unix Makefiles (Launchers enabled): 2 Build Errors (2, 3)
    Unix Makefiles (Launchers disabled): 4 Build Errors (1, 2, 3)
    
CTEST_CUSTOM_ERROR_MATCH seems to only work with launchers disabled with Makefiles as well so I assume this is by design (though unexpected).

At the very least the exit status in the Ninja + Launchers case should be evaluated as it is with Makefiles.
No tags attached.
gz issue_14121.tar.gz (874) 2013-04-29 16:56
https://public.kitware.com/Bug/file/4753/issue_14121.tar.gz
patch 0001-run-custom-commands-through-launcher-if-available.patch (2,755) 2013-05-04 09:05
https://public.kitware.com/Bug/file/4755/0001-run-custom-commands-through-launcher-if-available.patch
Issue History
2013-04-29 16:51Nils GladitzNew Issue
2013-04-29 16:56Nils GladitzFile Added: issue_14121.tar.gz
2013-04-29 16:58Nils GladitzNote Added: 0032962
2013-05-04 03:34Nils GladitzNote Added: 0032970
2013-05-04 09:05Nils GladitzFile Added: 0001-run-custom-commands-through-launcher-if-available.patch
2013-05-04 09:15Nils GladitzNote Added: 0032971
2013-06-03 14:18Robert MaynardAssigned To => Robert Maynard
2013-06-03 14:18Robert MaynardStatusnew => assigned
2013-06-03 14:37Robert MaynardTarget Version => CMake 2.8.12
2013-10-31 10:24Nils GladitzNote Added: 0034298
2013-10-31 10:24Nils GladitzStatusassigned => resolved
2013-10-31 10:24Nils GladitzFixed in Version => CMake 3.0
2013-10-31 10:24Nils GladitzResolutionopen => fixed
2013-10-31 10:24Nils GladitzStatusresolved => closed

Notes
(0032962)
Nils Gladitz   
2013-04-29 16:58   
I've uploaded a slightly cleaned up (removed server info from CTestConfig.cmake) version of my test project: issue_14121.tar.gz.
(0032970)
Nils Gladitz   
2013-05-04 03:34   
I traced through Ninja CTest runs and apparently the custom commands are run without the launcher.

CMake defines three global properties RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK and RULE_LAUNCH_CUSTOM.

Only the first two seem to actually get referenced from the Ninja generator source files.
(0032971)
Nils Gladitz   
2013-05-04 09:15   
With the patch I attached I tried to mimic (read copy&paste) the custom command launcher logic from the makefile generator.

The makefile generator appears to produce distinct rules for the same custom command if it is attached to multiple targets.
For the same case in Ninja there seems to be only a single rule.
Because of this I didn't know how to properly fill the target and left it empty.

This results in <TARGET_NAME> expanding to "TARGET_NAME" and I'm not sure what the consequences of that are exactly.

At the very least my custom command errors (at least those with non-success exit status) are no longer hidden.
(0034298)
Nils Gladitz   
2013-10-31 10:24   
Fixed by http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4fcb97eaac5de1cdd4adc86ac757ce68b37c9858 [^]