Newer
Older
#####################################################################################
# (c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations #
# #
# This software is distributed under the terms of the Apache version 2 licence, #
# copied verbatim in the file "LICENSE". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
#####################################################################################
cmake_minimum_required(VERSION 3.6)
Attila Krasznahorkay
committed
# Configurable options for building Gaudi in the ATLAS software stack:
option( GAUDI_ATLAS "Enable ATLAS-specific settings" OFF )
Attila Krasznahorkay
committed
set( GAUDI_ATLAS_BASE_PROJECT "AthenaExternals" CACHE STRING
Attila Krasznahorkay
committed
"Name of the ATLAS base project to build Gaudi against" )
# Ensure that we can find GaudiProjectConfig.cmake
# (this works only for projects embedding GaudiProjectConfig.cmake)
if(NOT GaudiProject_DIR AND ("$ENV{GaudiProject_DIR}" STREQUAL ""))
set(GaudiProject_DIR ${CMAKE_SOURCE_DIR}/cmake)
endif()
#---------------------------------------------------------------
# Load macros and functions for Gaudi-based projects
find_package(GaudiProject REQUIRED)
#---------------------------------------------------------------
Attila Krasznahorkay
committed
# Base Gaudi on "the ATLAS base project" (AtlasExternals by default) when
# building for ATLAS:
Attila Krasznahorkay
committed
if( GAUDI_ATLAS )
Attila Krasznahorkay
committed
find_package( ${GAUDI_ATLAS_BASE_PROJECT} )
Attila Krasznahorkay
committed
gaudi_ctest_setup() # Needed for correct CTest usage in this setup
endif()
Attila Krasznahorkay
committed
# Find/set up some needed externals:
include(${CMAKE_SOURCE_DIR}/cmake/externals.cmake)
# Declare project name and version
# Special hack to make sure downstream projects see fmt::fmt
# This is going to be much cleaner with gaudi/Gaudi!986 (CMake modernization)
if(EXISTS ${CMAKE_CONFIG_OUTPUT_DIRECTORY}/GaudiPlatformConfig.cmake)
file(APPEND ${CMAKE_CONFIG_OUTPUT_DIRECTORY}/GaudiPlatformConfig.cmake "
find_package(fmt REQUIRED)
")
endif()
# These tests do not really fit in a subdirectory.
add_test(NAME cmake.CMakeModules
COMMAND nosetests ${CMAKE_SOURCE_DIR}/cmake/tests)
gaudi_add_test(cmake.QMTDeps
COMMAND nosetests --with-doctest ${CMAKE_SOURCE_DIR}/cmake/extract_qmtest_metadata.py)
# Configure how CPack should run:
find_file( _cpack_config NAMES GaudiCPackSettings.cmake
PATHS ${CMAKE_MODULE_PATH} )
if( _cpack_config )
include( ${_cpack_config} )
else()
message( WARNING "Could not find GaudiCPackSettings.cmake" )
unset( _cpack_config )
mark_as_advanced( _cpack_config )