Warning, /acts/Detray/extern/fastor/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008
0009 # CMake include(s).
0010 cmake_minimum_required(VERSION 3.11)
0011 include(FetchContent)
0012
0013 # Tell the user what's happening.
0014 message(STATUS "Building Fastor as part of the Detray project")
0015
0016 # Warn the user, if they are not on an x86 platform.
0017 if(NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64")
0018 message(WARNING "Fastor is only supported on the x86 platforms")
0019 endif()
0020
0021 # Declare where to get Fastor from.
0022 # We need to use this alternative syntax for FetchContent_Declare because the
0023 # latest release for Fastor does not have a CMakeLists.txt file.
0024 set(DETRAY_FASTOR_SOURCE
0025 "URL;https://github.com/romeric/Fastor/archive/refs/tags/V${DETRAY_FASTOR_VERSION}.tar.gz;URL_MD5;${DETRAY_FASTOR_DIGEST}"
0026 CACHE STRING
0027 "Source for Fastor, when built as part of this project"
0028 )
0029 mark_as_advanced(DETRAY_FASTOR_SOURCE)
0030
0031 # Mark the import as a system library on modern CMake versions
0032 if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25.0)
0033 set(DETRAY_FASTOR_SOURCE_FULL "${DETRAY_FASTOR_SOURCE};SYSTEM")
0034 else()
0035 set(DETRAY_FASTOR_SOURCE_FULL "${DETRAY_FASTOR_SOURCE}")
0036 endif()
0037 mark_as_advanced(DETRAY_FASTOR_SOURCE_FULL)
0038
0039 FetchContent_Declare(fastor ${DETRAY_FASTOR_SOURCE_FULL})
0040
0041 # Turn off the unit tests for Fastor.
0042 if(DEFINED CACHE{BUILD_TESTING})
0043 set(_buildTestingValue ${BUILD_TESTING})
0044 endif()
0045 set(BUILD_TESTING FALSE CACHE INTERNAL "Forceful setting of BUILD_TESTING")
0046
0047 # Get it into the current directory.
0048 FetchContent_MakeAvailable(fastor)
0049
0050 # Reset the BUILD_TESTING variable.
0051 if(DEFINED _buildTestingValue)
0052 set(BUILD_TESTING
0053 ${_buildTestingValue}
0054 CACHE BOOL
0055 "Turn tests on/off"
0056 FORCE
0057 )
0058 unset(_buildTestingValue)
0059 else()
0060 unset(BUILD_TESTING CACHE)
0061 endif()
0062
0063 # Treat the Fastor headers as "system headers", to avoid getting warnings from
0064 # them.
0065 get_target_property(_incDirs Fastor INTERFACE_INCLUDE_DIRECTORIES)
0066 target_include_directories(Fastor SYSTEM INTERFACE ${_incDirs})
0067 unset(_incDirs)
0068
0069 # Set up an alias for the Fastor target, with the same name that it will have
0070 # when "finding it".
0071 add_library(Fastor::Fastor ALIAS Fastor)