Skip to content

Commit

Permalink
CMake scripts: better verbosity control
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jun 25, 2014
1 parent 84ed433 commit fcc220d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions cmakemodules/FindSuiteSparse.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions cmakemodules/UtilsMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
3 changes: 3 additions & 0 deletions cmakemodules/script_eigen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion cmakemodules/script_openni2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fcc220d

Please sign in to comment.