Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: CMake find directives, policy grouping #4026

Merged
merged 6 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,36 @@ include(ActsRetrieveVersion)

project(Acts VERSION ${_acts_version} LANGUAGES CXX)

# policy settings

# Steers how project() handles the VERSION option
cmake_policy(SET CMP0048 NEW)

# the `<project_name>_VERSION` variables set by `setup(... VERSION ...)` have
# only local scope, i.e. they are not accessible her for dependencies added
# via `add_subdirectory`. this overrides the `project(...)` function for
# sub-projects such that the resulting `<project_name>_VERSION` has
# global scope and is accessible within the main project later on.
macro(project)
_project(${ARGN})
set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "")
endmacro()

# Controls the way python is located
if(POLICY CMP0094)
cmake_policy(SET CMP0094 NEW)
endif()

# Controls behavior of DOWNLOAD_EXTRACT_TIMESTAMP
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()

# Use boost's cmake config files
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()

# build options

# all options and compile-time parameters must be defined here for clear
Expand Down Expand Up @@ -253,17 +283,8 @@ set(_acts_boost_recommended_version 1.78.0)
# Include the sources for the external dependencies.
include(ActsExternSources)

# Controls behavior of DOWNLOAD_EXTRACT_TIMESTAMP
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()

# required packages
if(ACTS_SETUP_BOOST)
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()

# Enable both program_options and unit_test_framework to reduce complexity
# Also Cuda tests seem to use program_options
if(
Expand Down Expand Up @@ -311,17 +332,6 @@ endif()

find_package(Filesystem REQUIRED)

# the `<project_name>_VERSION` variables set by `setup(... VERSION ...)` have
# only local scope, i.e. they are not accessible her for dependencies added
# via `add_subdirectory`. this overrides the `project(...)` function for
# sub-projects such that the resulting `<project_name>_VERSION` has
# global scope and is accessible within the main project later on.
cmake_policy(SET CMP0048 NEW)
macro(project)
_project(${ARGN})
set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "")
endmacro()

# CUDA settings are collected here in a macro, so that they can be reused by different plugins
macro(enable_cuda)
enable_language(CUDA)
Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_COMPILE_WARNING_AS_ERROR": "ON",
"CMAKE_FIND_FRAMEWORK": "LAST",
"ACTS_FORCE_ASSERTIONS": "ON",
"ACTS_ENABLE_LOG_FAILURE_THRESHOLD": "ON",
"ACTS_BUILD_BENCHMARKS": "ON",
Expand Down
Loading