From ce1abfa4149ae0b3920626bef2dd15e8ee8b1940 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 17 Nov 2016 11:34:32 -0500 Subject: cmake: If ldd for LINK_WHAT_YOU_USE fails to run then report why --- Source/cmcmd.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 945913e..dca5ffc 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -378,11 +378,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Run the ldd -u -r command line. // Capture its stdout and hide its stderr. + // Ignore its return code because the tool always returns non-zero + // if there are any warnings, but we just want to warn. std::string stdOut; - if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, CM_NULLPTR, - &ret, CM_NULLPTR, + std::string stdErr; + if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, &stdErr, &ret, + CM_NULLPTR, cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << lwyu_cmd[0] << "'\n"; + std::cerr << "Error running '" << lwyu_cmd[0] << "': " << stdErr + << "\n"; return 1; } -- cgit v0.12