From fcc220dc293b97d160c3b0d9978e8effe9c00732 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco Date: Thu, 26 Jun 2014 00:03:46 +0200 Subject: [PATCH] CMake scripts: better verbosity control --- cmakemodules/FindSuiteSparse.cmake | 2 ++ cmakemodules/UtilsMacros.cmake | 15 ++++++++++----- cmakemodules/script_eigen.cmake | 3 +++ cmakemodules/script_openni2.cmake | 4 +++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cmakemodules/FindSuiteSparse.cmake b/cmakemodules/FindSuiteSparse.cmake index 9b373a304a..362742896a 100644 --- a/cmakemodules/FindSuiteSparse.cmake +++ b/cmakemodules/FindSuiteSparse.cmake @@ -259,7 +259,9 @@ macro(SuiteSparse_FIND_COMPONENTS ) ## set the final SuiteSparse_FOUND based on all previous components found (status) foreach(componentToCheck ${SuiteSparse_FOUND_LIST}) set(SuiteSparse_FOUND ON) + if(SuiteSparse_VERBOSE) MESSAGE(STATUS "final check: ${componentToCheck}") + endif() if(NOT ${componentToCheck}) set(SuiteSparse_FOUND OFF) break() ## one component not found is enought to failed diff --git a/cmakemodules/UtilsMacros.cmake b/cmakemodules/UtilsMacros.cmake index 88e1dc8ede..19baea4187 100644 --- a/cmakemodules/UtilsMacros.cmake +++ b/cmakemodules/UtilsMacros.cmake @@ -33,20 +33,25 @@ ENDMACRO(APPEND_MRPT_LIBS) # Only if GNU GCC is used, add one "-isystem" flag for each include directory. # Useful to discard -pedantic errors in system libraries not prepared to be so... well, pedantic. MACRO(ADD_DIRECTORIES_AS_ISYSTEM INCLUDE_DIRS) - IF(CMAKE_COMPILER_IS_GNUCXX) + IF($ENV{VERBOSE}) + MESSAGE(STATUS "isystem: INCLUDE_DIRS= ${${INCLUDE_DIRS}}") + ENDIF($ENV{VERBOSE}) + IF(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") FOREACH(DIR ${${INCLUDE_DIRS}}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${DIR}") - #MESSAGE(STATUS " ->>>>>>>>>>>>>>> ${INCLUDE_DIRS}: ${DIR}") ENDFOREACH(DIR) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) + ENDIF(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ENDMACRO(ADD_DIRECTORIES_AS_ISYSTEM) MACRO(ADD_DIRECTORIES_AS_INCLUDE_AND_ISYSTEM INCLUDE_DIRS) - IF(CMAKE_COMPILER_IS_GNUCXX) + IF($ENV{VERBOSE}) + MESSAGE(STATUS "isystem: INCLUDE_DIRS= ${${INCLUDE_DIRS}}") + ENDIF($ENV{VERBOSE}) + IF(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") FOREACH(DIR ${${INCLUDE_DIRS}}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I ${DIR} -isystem ${DIR}") ENDFOREACH(DIR) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) + ENDIF(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ENDMACRO(ADD_DIRECTORIES_AS_INCLUDE_AND_ISYSTEM) diff --git a/cmakemodules/script_eigen.cmake b/cmakemodules/script_eigen.cmake index 2a358f957e..27474063ec 100644 --- a/cmakemodules/script_eigen.cmake +++ b/cmakemodules/script_eigen.cmake @@ -55,6 +55,9 @@ ELSE(EIGEN_USE_EMBEDDED_VERSION) ENDIF(EIGEN_USE_EMBEDDED_VERSION) +# Add directories as "-isystem" to avoid warnings with : +SET(AUX_EIGEN_INCL_DIR ${MRPT_EIGEN_INCLUDE_DIR}/Eigen) +ADD_DIRECTORIES_AS_ISYSTEM(AUX_EIGEN_INCL_DIR) # Detect Eigen version (just to show it in the CMake config summary) SET(EIGEN_VER_H "${MRPT_EIGEN_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h") diff --git a/cmakemodules/script_openni2.cmake b/cmakemodules/script_openni2.cmake index ed2b8208f0..e3b14d092d 100644 --- a/cmakemodules/script_openni2.cmake +++ b/cmakemodules/script_openni2.cmake @@ -65,7 +65,9 @@ IF(MRPT_HAS_OPENNI2) # Add include directories as "-isystem" to avoid warnings : ADD_DIRECTORIES_AS_ISYSTEM(OPENNI2_INCLUDE_DIRS) - message(STATUS "OpenNI2 found (include: ${OPENNI2_INCLUDE_DIR}, lib: ${OPENNI2_LIBRARY})") + if ($ENV{VERBOSE}) + message(STATUS "OpenNI2 found (include: ${OPENNI2_INCLUDE_DIR}, lib: ${OPENNI2_LIBRARY})") + endif ($ENV{VERBOSE}) ELSE (OPENNI2_INCLUDE_DIRS AND OPENNI2_LIBRARIES) message(FATAL_ERROR "OpenNI2 not found: Either correctly set OPENNI2_INCLUDE_DIR and OPENNI2_LIBRARY or uncheck MRPT_HAS_OPENNI2") ENDIF (OPENNI2_INCLUDE_DIRS AND OPENNI2_LIBRARIES)