mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-11 06:47:14 +02:00
62 lines
1.6 KiB
CMake
62 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.12)
|
|
set(CMAKE_CXX_STANDARD 17) #TODO! Global or per target?
|
|
project(aare
|
|
VERSION 0.1
|
|
DESCRIPTION "Data processing library for PSI detectors"
|
|
HOMEPAGE_URL "https://github.com/slsdetectorgroup/aare"
|
|
LANGUAGES C CXX
|
|
)
|
|
|
|
add_library(aare_compiler_flags INTERFACE)
|
|
target_compile_features(aare_compiler_flags INTERFACE cxx_std_17)
|
|
|
|
cmake_policy(SET CMP0135 NEW)
|
|
cmake_policy(SET CMP0079 NEW)
|
|
|
|
include(GNUInstallDirs)
|
|
include(FetchContent)
|
|
|
|
|
|
option(AARE_USE_WARNINGS "Eable warnings" OFF)
|
|
option(AARE_PYTHON_BINDINGS "Build python bindings" ON)
|
|
option(AARE_TESTS "Build tests" ON)
|
|
option(AARE_EXAMPLES "Build examples" ON)
|
|
option(AARE_DEBUG "Compile in debug mode" ON)
|
|
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
find_package(fmt 6 REQUIRED)
|
|
|
|
if (AARE_DEBUG)
|
|
target_compile_options(aare_compiler_flags INTERFACE -Og -ggdb3 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC)
|
|
else()
|
|
target_compile_options(aare_compiler_flags INTERFACE -O3)
|
|
endif()
|
|
|
|
if(AARE_USE_WARNINGS)
|
|
target_compile_options(aare_compiler_flags INTERFACE -Wall -Wextra -pedantic -Wshadow )
|
|
endif()
|
|
|
|
if(AARE_BUILD_TESTS)
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
add_subdirectory(core)
|
|
add_subdirectory(file_io)
|
|
|
|
|
|
#Overall target to link to when using the library
|
|
add_library(aare INTERFACE)
|
|
target_link_libraries(aare INTERFACE core file_io)
|
|
target_include_directories(aare INTERFACE
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
|
|
add_subdirectory(examples)
|
|
target_link_libraries(example PUBLIC aare)
|
|
|
|
|
|
if(AARE_PYTHON_BINDINGS)
|
|
add_subdirectory(python)
|
|
endif() |