From 0b739ab14259c185f284737277384872ccac8755 Mon Sep 17 00:00:00 2001 From: Andre Sailer <andre.philippe.sailer@cern.ch> Date: Mon, 19 Aug 2019 18:56:25 +0200 Subject: [PATCH] Cmake: fail if standard not compatible, fix for try_compile in examples --- cmake/DD4hepBuild.cmake | 4 ++-- cmake/DD4hepConfig.cmake.in | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index 6bcbe5c05..d1ed9ac2d 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -1147,7 +1147,7 @@ endfunction() #--------------------------------------------------------------------------------------------------- function(dd4hep_add_dictionary dictionary ) cmake_parse_arguments(ARG "" "" "SOURCES;EXCLUDE;LINKDEF;OPTIONS;USES;DEFINITIONS;INCLUDES;OUTPUT" ${ARGN} ) - dd4hep_print ( "|++> Building dictionary ... ${dictionary}" ) + dd4hep_print ( "|++++> Building dictionary ... ${dictionary}" ) file(GLOB headers ${ARG_SOURCES}) file(GLOB excl_headers ${ARG_EXCLUDE}) @@ -1315,7 +1315,7 @@ MACRO(DD4HEP_SETUP_BOOST_TARGETS) dd4hep_debug("|++> Checking if compiler supports filesystem library") FOREACH(FS_LIB_NAME stdc++fs c++fs ) dd4hep_debug("|++++> linking against ${FS_LIB_NAME}") - try_compile(HAVE_FILESYSTEM ${CMAKE_BINARY_DIR}/try ${CMAKE_SOURCE_DIR}/cmake/TryFileSystem.cpp + try_compile(HAVE_FILESYSTEM ${CMAKE_BINARY_DIR}/try ${CMAKE_CURRENT_LIST_DIR}/cmake/TryFileSystem.cpp CXX_STANDARD ${CMAKE_CXX_STANDARD} CXX_EXTENSIONS False OUTPUT_VARIABLE HAVE_FS_OUTPUT diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in index d9d9e6a3f..f0e4315b8 100644 --- a/cmake/DD4hepConfig.cmake.in +++ b/cmake/DD4hepConfig.cmake.in @@ -32,7 +32,7 @@ set ( DD4hep_BUILD_CXX_STANDARD @CMAKE_CXX_STANDARD@ ) # figure out if including build has compatible standard set if (NOT "${CMAKE_CXX_STANDARD}" EQUAL "${DD4hep_BUILD_CXX_STANDARD}") - message( SEND_ERROR "CMAKE_CXX_STANDARD is set to C++${CMAKE_CXX_STANDARD} but C++${DD4hep_BUILD_CXX_STANDARD} is required for DD4hep.") + message( FATAL_ERROR "CMAKE_CXX_STANDARD is set to C++${CMAKE_CXX_STANDARD} but C++${DD4hep_BUILD_CXX_STANDARD} is required for DD4hep.") endif() # set ( GEANT4_USE_CLHEP "@GEANT4_USE_CLHEP@" ) @@ -54,11 +54,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() -FIND_PACKAGE(Boost REQUIRED COMPONENTS filesystem system) -SET_TARGET_PROPERTIES(Boost::boost - PROPERTIES - INTERFACE_COMPILE_DEFINITIONS BOOST_SPIRIT_USE_PHOENIX_V3 - ) +FIND_PACKAGE(Boost REQUIRED) +DD4HEP_SETUP_BOOST_TARGETS() if(DD4HEP_USE_GEANT4) find_package(Geant4 10.2.2 REQUIRED gdml ui_all vis_all) -- GitLab