I recently updated my project to CMake, one thing is annoying. When building source files it prints the directory where object files are saved.
[ 13%] Building CXX object a/CMakeFiles/a.dir/src/A.cpp.o
[ 14%] Building CXX object b/CMakeFiles/b.dir/src/B.cpp.o
[ 15%] Building CXX object c/CMakeFiles/c.dir/src/C.cpp.o
I want to make it like this
[ 13%] Building CXX object A.cpp.o
[ 14%] Building CXX object B.cpp.o
[ 15%] Building CXX object C.cpp.o
I can't find anything about this.
As @Hugues Moreau commented those texts are directly coded into CMake and can't be modified.
You could - without utilizing another script parsing your command line or output -
only suppress the output with setting global RULE_MESSAGES
property to OFF
and adding your own echo
call.
NOTE:
- It omits the percentage and color information also
- It works only for
Makefiles
generators
CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(HelloWorld)
if(CMAKE_GENERATOR MATCHES "Makefiles")
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
set(
CMAKE_CXX_COMPILE_OBJECT
"$(CMAKE_COMMAND) -E echo Building <LANGUAGE> object $(@F)"
"${CMAKE_CXX_COMPILE_OBJECT}"
)
endif()
add_executable(HelloWorld main.cpp)
References
- GNU Make - Automatic Variables