cmake: factor out error messages
Instead of using BoldRed and ColourReset everywhere, wrap it up in a function.
This commit is contained in:
parent
9aa48b6c50
commit
a87ce09461
|
@ -30,11 +30,18 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8.6)
|
cmake_minimum_required(VERSION 2.8.6)
|
||||||
|
|
||||||
if(NOT WIN32)
|
function (die msg)
|
||||||
|
if (NOT WIN32)
|
||||||
string(ASCII 27 Esc)
|
string(ASCII 27 Esc)
|
||||||
set(ColourReset "${Esc}[m")
|
set(ColourReset "${Esc}[m")
|
||||||
set(BoldRed "${Esc}[1;31m")
|
set(BoldRed "${Esc}[1;31m")
|
||||||
endif()
|
else ()
|
||||||
|
set(ColourReset "")
|
||||||
|
set(BoldRed "")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}")
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
@ -204,11 +211,11 @@ endif()
|
||||||
find_package(Boost 1.53 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
|
find_package(Boost 1.53 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
|
||||||
|
|
||||||
if(NOT Boost_FOUND)
|
if(NOT Boost_FOUND)
|
||||||
MESSAGE(FATAL_ERROR "${BoldRed}Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent${ColourReset}")
|
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 54))
|
if((${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 54))
|
||||||
message(FATAL_ERROR "${BoldRed}Boost version 1.54 is unsupported due to a bug (see: http://goo.gl/RrCFmA), please install Boost 1.53 or 1.55 and above${ColourReset}")
|
die("Boost version 1.54 is unsupported due to a bug (see: http://goo.gl/RrCFmA), please install Boost 1.53 or 1.55 and above")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||||
|
|
|
@ -89,14 +89,14 @@ IF(!UNBOUND_INCLUDE_DIR OR STATIC)
|
||||||
|
|
||||||
FIND_PACKAGE(OpenSSL QUIET)
|
FIND_PACKAGE(OpenSSL QUIET)
|
||||||
IF(!OPENSSL_LIBRARIES)
|
IF(!OPENSSL_LIBRARIES)
|
||||||
MESSAGE(FATAL_ERROR "${BoldRed}Could not find the openssl library. Please make sure you have installed openssl or libssl-dev or the equivalent${ColourReset}")
|
die("Could not find the openssl library. Please make sure you have installed openssl or libssl-dev or the equivalent")
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(STATUS "Found openssl libraries")
|
MESSAGE(STATUS "Found openssl libraries")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
FIND_PACKAGE(Expat QUIET)
|
FIND_PACKAGE(Expat QUIET)
|
||||||
IF(!EXPAT_LIBRARIES)
|
IF(!EXPAT_LIBRARIES)
|
||||||
MESSAGE(FATAL_ERROR "${BoldRed}Could not find the expat library. Please make sure you have installed libexpat or libexpat-dev or the equivalent${ColourReset}")
|
die("Could not find the expat library. Please make sure you have installed libexpat or libexpat-dev or the equivalent")
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(STATUS "Found expat libraries")
|
MESSAGE(STATUS "Found expat libraries")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -170,6 +170,6 @@ ELSE()
|
||||||
set(UNBOUND_INCLUDE ${UNBOUND_INCLUDE_DIR} PARENT_SCOPE)
|
set(UNBOUND_INCLUDE ${UNBOUND_INCLUDE_DIR} PARENT_SCOPE)
|
||||||
set(UNBOUND_LIBRARY ${UNBOUND_LIBRARIES} PARENT_SCOPE)
|
set(UNBOUND_LIBRARY ${UNBOUND_LIBRARIES} PARENT_SCOPE)
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "${BoldRed}Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent${ColourReset}")
|
die("Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
Loading…
Reference in New Issue