Discussion:
[cmake-developers] Quiet option for cmake
Craig Scott
2018-08-21 21:04:44 UTC
Permalink
A user has recently been asking
<https://gitlab.kitware.com/cmake/cmake/issues/18257> about reducing the
output coming from a FetchContent population when nothing needs to be done
(i.e. the content has already been populated). Because this is implemented
as a sub-build, you always see the following extra lines in the main
project's configure output (during the main configure, I'm not talking here
about the same messages at the end of the main configure):

-- Configuring done
-- Generating done
-- Build files have been written to: ...

I'm wondering if it makes sense to add support for a --quiet or --silent
option to cmake (and probably ccmake and cmake gui) which would skip these
messages? It would be an option question whether ordinary status messages
and messages which don't set any message mode should still be output for
such an option (maybe they would for --quiet but not for --silent). While
FetchContent is the motivation for this, perhaps other uses of CMake may
also find it useful as well.
--
Craig Scott
Melbourne, Australia
https://crascit.com

New book released: Professional CMake: A Practical Guide
<https://crascit.com/professional-cmake/>
Brad King
2018-08-22 18:40:07 UTC
Permalink
A user has recently been asking about reducing the output coming from a
FetchContent population when nothing needs to be done
Because this is implemented as a sub-build, you always see the following
-- Configuring done
-- Generating done
-- Build files have been written to: ...
Isn't that output coming from the invocation here:

https://gitlab.kitware.com/cmake/cmake/blob/v3.12.1/Modules/FetchContent.cmake#L776-781

rather than inside ExternalProject?

Why is that output not always captured?

-Brad
--
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:
https://cmake.org/mailman/listinfo/cmake-developers
Craig Scott
2018-08-23 10:02:25 UTC
Permalink
Post by Brad King
A user has recently been asking about reducing the output coming from a
FetchContent population when nothing needs to be done
Because this is implemented as a sub-build, you always see the following
-- Configuring done
-- Generating done
-- Build files have been written to: ...
https://gitlab.kitware.com/cmake/cmake/blob/v3.12.1/
Modules/FetchContent.cmake#L776-781
rather than inside ExternalProject?
Yes, that is where I'd like to be able to use the proposed --quiet or
--silent option.
Post by Brad King
Why is that output not always captured?
If you capture it, then you don't get to see it until the command has
completed. It can take non-trivial time and in some cases may require user
input (e.g. to enter a password for a private SSH key). If you captured the
output and the download hung for some reason, there would be no output to
give any indication of where the download was up to. For cases where you
don't expect problems, you can use the QUIET option and the output is
indeed captured and only output at the end. This is the default because
otherwise the output is rather noisy with all the ExternalProject step
logging. But for cases where you need to investigate problems, you don't
want the output captured.

Now that I've said all that, I guess FetchContent could check if the output
of a QUIET run was just the above-mentioned three lines and drop them to
leave no output in that case. Might be the simpler solution. Furthermore,
for the second execute_process() call a few lines after the one referenced
above (which does the build stage of the sub-build), we could potentially
make use of the logging verbosity improvements in MR 2129
<https://gitlab.kitware.com/cmake/cmake/merge_requests/2129> if/when it is
done to further minimise the output of the "nothing to do" case.
--
Craig Scott
Melbourne, Australia
https://crascit.com

New book released: Professional CMake: A Practical Guide
<https://crascit.com/professional-cmake/>
Craig Scott
2018-08-23 10:15:25 UTC
Permalink
Post by Craig Scott
Post by Brad King
A user has recently been asking about reducing the output coming from a
FetchContent population when nothing needs to be done
Because this is implemented as a sub-build, you always see the following
-- Configuring done
-- Generating done
-- Build files have been written to: ...
https://gitlab.kitware.com/cmake/cmake/blob/v3.12.1/Modules/
FetchContent.cmake#L776-781
rather than inside ExternalProject?
Yes, that is where I'd like to be able to use the proposed --quiet or
--silent option.
Post by Brad King
Why is that output not always captured?
If you capture it, then you don't get to see it until the command has
completed. It can take non-trivial time and in some cases may require user
input (e.g. to enter a password for a private SSH key). If you captured the
output and the download hung for some reason, there would be no output to
give any indication of where the download was up to. For cases where you
don't expect problems, you can use the QUIET option and the output is
indeed captured and only output at the end. This is the default because
otherwise the output is rather noisy with all the ExternalProject step
logging. But for cases where you need to investigate problems, you don't
want the output captured.
Now that I've said all that, I guess FetchContent could check if the
output of a QUIET run was just the above-mentioned three lines and drop
them to leave no output in that case. Might be the simpler solution.
Furthermore, for the second execute_process() call a few lines after the
one referenced above (which does the build stage of the sub-build), we
could potentially make use of the logging verbosity improvements in MR
2129 <https://gitlab.kitware.com/cmake/cmake/merge_requests/2129> if/when
it is done to further minimise the output of the "nothing to do" case.
Sorry, got my wires crossed a bit there. The QUIET option already fully
absorbs the output unless there's an error. I missed this in the original
issue that prompted this request. Let me go back to that issue and see if
there's really anything needed here after all.
--
Craig Scott
Melbourne, Australia
https://crascit.com

New book released: Professional CMake: A Practical Guide
<https://crascit.com/professional-cmake/>
Loading...