0

When CMake generates make rules, they often have a form similar to the following:

myexecutable: ...
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/mydir/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable myexecutable"
        cd /mydir && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/myexecutable.dir/link.txt --verbose=$(VERBOSE)

Ignoring the progress indication line, the main line, in itself, does not do anything meaningful; it only triggers another command which itself will execute meaningful commands (from the link script). Is it possible to alter the Makefile generation so that such lines get prepended with a silencing @? i.e.

myexecutable: ...
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/mydir/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable myexecutable"
        @cd /mydir && @$(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/myexecutable.dir/link.txt --verbose=$(VERBOSE)

? More specifically, can this be done...

  1. From within a CMakeLists.txt file?
  2. By creating a modified copy of generator-related files in a CMake installation? or
  3. Only by changing the CMake sources and rebuilding a custom version of it?

Note: This is a followup question to How can I get make to be verbose but with only "meaningful" lines when building with cmake?

einpoklum
  • 102,731
  • 48
  • 279
  • 553

0 Answers0