Skip to content
Snippets Groups Projects
Commit b17e3d87 authored by Benjamin Morgan's avatar Benjamin Morgan
Browse files

Simplify use of COLOR_DEFS output

Color variables will be empty strings if color isn't available, so
message() calls can use them directly and not worry about this.
parent 3cd8f410
No related branches found
No related tags found
1 merge request!184Modernisation of CMake scripting to simplify build of FullSimLight
......@@ -14,15 +14,9 @@ set(default_build_type "Release")
# endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if( COLOR_DEFS )
message(STATUS "${Blue}INFO: Setting build type to '${default_build_type}' as none was specified.${ColourReset}")
else()
message(STATUS "INFO: Setting build type to '${default_build_type}' as none was specified.")
endif()
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
message(STATUS "${Blue}INFO: Setting build type to '${default_build_type}' as none was specified.${ColourReset}")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
if( COLOR_DEFS )
message(STATUS "-----")
message(STATUS "${BoldYellow}Building with type: ${CMAKE_BUILD_TYPE}${ColourReset}")
message(STATUS "${BoldYellow}Using C++ standard: ${CMAKE_CXX_STANDARD}${ColourReset}")
message(STATUS "-----")
else()
message(STATUS "-----")
message(STATUS "Building with type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Using C++ standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "-----")
endif()
message(STATUS "-----")
message(STATUS "${BoldYellow}Building with type: ${CMAKE_BUILD_TYPE}${ColourReset}")
message(STATUS "${BoldYellow}Using C++ standard: ${CMAKE_CXX_STANDARD}${ColourReset}")
message(STATUS "-----")
......@@ -20,11 +20,7 @@ option( GEOMODEL_USE_BUILTIN_COIN3D
if( GEOMODEL_USE_BUILTIN_COIN3D )
# Tell the user what's happening.
if( COLOR_DEFS )
message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_COIN3D' was set to 'true' ==> Building Coin and SoQt as part of the project${ColourReset}" )
else()
message( STATUS "'GEOMODEL_USE_BUILTIN_COIN3D' was set to 'true' ==> Building Coin and SoQt as part of the project" )
endif()
message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_COIN3D' was set to 'true' ==> Building Coin and SoQt as part of the project${ColourReset}" )
# External(s) required for the build.
find_package( Boost REQUIRED )
......
......@@ -21,11 +21,7 @@ option( GEOMODEL_USE_BUILTIN_JSON
if( GEOMODEL_USE_BUILTIN_JSON )
# Tell the user what's happening.
if( COLOR_DEFS )
message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_JSON' was set to 'true' ==> Building nlohmann_json as part of the project${ColourReset}" )
else()
message( STATUS "'GEOMODEL_USE_BUILTIN_JSON' was set to 'true' ==> Building nlohmann_json as part of the project" )
endif()
message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_JSON' was set to 'true' ==> Building nlohmann_json as part of the project${ColourReset}" )
# The include directory and library that will be produced.
set( nlohmann_json_INCLUDE_DIR
......
......@@ -20,16 +20,12 @@ option( GEOMODEL_USE_BUILTIN_XERCESC
if( GEOMODEL_USE_BUILTIN_XERCESC )
# Tell the user what's happening.
if( COLOR_DEFS )
message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_XERCESC' was set to 'true' ==> Building XercesC as part of the project${ColourReset}" )
else()
message( STATUS "'GEOMODEL_USE_BUILTIN_XERCESC' was set to 'true' ==> Building XercesC as part of the project" )
endif()
message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_XERCESC' was set to 'true' ==> Building XercesC as part of the project${ColourReset}" )
# The include directory and library that will be produced.
set( XercesC_INCLUDE_DIR
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH "Path to the Xerces-C include directory" FORCE )
set( XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}" )
set( XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}" )
set( XercesC_LIBRARY
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/lib/${CMAKE_SHARED_LIBRARY_PREFIX}xerces-c${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE PATH "Path to the Xerces-C library file" FORCE )
set( XercesC_LIBRARIES "${XercesC_LIBRARY}" )
......
......@@ -18,8 +18,7 @@
set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" )
set( CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard used for the build" )
set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" )
set( CMAKE_CXX_STANDARD_REQUIRED TRUE CACHE BOOL
"Require the specified C++ standard for the build" )
set( CMAKE_CXX_STANDARD_REQUIRED TRUE CACHE BOOL "Require the specified C++ standard for the build" )
# Setting CMAKE_CXX_FLAGS to avoid "deprecated" warnings
set(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations" ) # very basic
......@@ -28,7 +27,6 @@ set(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations" ) # very basic
#set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror -pedantic-errors" ) # better for an even more severe check
#set(CMAKE_CXX_FLAGS "-Weverything -Werror -pedantic-errors" ) # not recommended, it warns for really EVERYTHING!
# TODO: for Debug and with GCC, do we want to set the flags below by default?
# set( CMAKE_BUILD_TYPE DEBUG )
# set(CMAKE_CXX_FLAGS "-fPIC -O0 -g -gdwarf-2" )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment