我想用cmake添加自定義目標,但其中一些必須「無聲」,因爲它不是必需的。例如,對於乾淨的自定義命令:在cmake自定義目標中禁用自動消息
// In CMakeLists.txt
add_custom_target(clean-temporaries
${CMAKE_COMMAND} -P clean-temporaries.cmake
COMMENT "Deleting temporary files"
)
// clean-temporaries.cmake
file(GLOB_RECURSE temporary_files "*[~#]")
file(REMOVE ${temporary_files})
$ cmake .
$ make clean-temporals
[100%] Deleting temporary files
[100%] Built target clean-temporaries
$ make clean
$
我們可以看到,CMake的準備「做乾淨」爲不顯示的消息,但是,我怎麼能到CMake的說,我不希望在一個自定義的目標的消息?