From 804e15c35db843c0efb9277f8cd6c49ccb740fb4 Mon Sep 17 00:00:00 2001 From: Larry Gritz Date: Wed, 15 Nov 2023 18:07:31 -0800 Subject: [PATCH] build: Better cmake verbose behavior (#4037) When we bumped to cmake 3.15 minimum for 2.5, we changed lots of constructs like this: if (VERBOSE) message (STATUS "blah") endif () to this: message (VERBOSE "blah") but I didn't realize that this was not enough, and to do it right requires CMAKE_MESSAGE_LOG_LEVEL. So even when VERBOSE=ON, we weren't actually getting all the verbose messages. Here, we fix it. Also, when verbose, print the list of C++ compile features that cmake discovers. Signed-off-by: Larry Gritz --- CMakeLists.txt | 5 +++++ Makefile | 2 +- src/cmake/compiler.cmake | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0781016ff2..e96ee63386 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,11 @@ endif () option (VERBOSE "Print lots of messages while compiling" OFF) +if (VERBOSE) + set (CMAKE_MESSAGE_LOG_LEVEL "VERBOSE" CACHE STRING "CMake log level to display") +else () + set (CMAKE_MESSAGE_LOG_LEVEL "STATUS" CACHE STRING "CMake log level to display") +endif () option (${PROJ_NAME}_BUILD_TOOLS "Build the command-line tools" ON) option (${PROJ_NAME}_BUILD_TESTS "Build the unit tests" ON) set (OIIO_LIBNAME_SUFFIX "" CACHE STRING diff --git a/Makefile b/Makefile index 9fbeb484ed..210acb1b1c 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ INSTALL_PREFIX ?= ${working_dir}/${dist_dir} VERBOSE ?= ${SHOWCOMMANDS} ifneq (${VERBOSE},) MY_MAKE_FLAGS += VERBOSE=${VERBOSE} -MY_CMAKE_FLAGS += -DVERBOSE:BOOL=${VERBOSE} +MY_CMAKE_FLAGS += -DVERBOSE:BOOL=${VERBOSE} --log-level=VERBOSE ifneq (${VERBOSE},0) MY_NINJA_FLAGS += -v TEST_FLAGS += -V diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake index fa6c213053..657277e0d3 100644 --- a/src/cmake/compiler.cmake +++ b/src/cmake/compiler.cmake @@ -20,6 +20,7 @@ message (VERBOSE "CMAKE_SYSTEM_VERSION = ${CMAKE_SYSTEM_VERSION}") message (VERBOSE "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}") message (STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}") message (STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") +message (VERBOSE "CMAKE_CXX_COMPILE_FEATURES = ${CMAKE_CXX_COMPILE_FEATURES}") ###########################################################################