File: CMakeLists.txt

package info (click to toggle)
python-awkward 2.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 23,088 kB
  • sloc: python: 148,689; cpp: 33,562; sh: 432; makefile: 21; javascript: 8
file content (62 lines) | stat: -rw-r--r-- 1,802 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# BSD 3-Clause License; see
# https://github.com/scikit-hep/awkward/blob/main/LICENSE

cmake_minimum_required(VERSION 3.15...3.24)

project(
  awkward-headers
  LANGUAGES CXX
  VERSION 1.0.0)

include(GNUInstallDirs)

# Build tests?
option(BUILD_TESTS OFF)

# Add aliases for `add_subdirectory`
set(NAMESPACE "awkward::")

# We want to specify different compile options, so we split the headers into
# "components"
macro(add_component name)
  add_library(${name} INTERFACE)
  add_library(${NAMESPACE}${name} ALIAS ${name})
  target_include_directories(
    ${name} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${name}>
                      $<INSTALL_INTERFACE:include/${name}>)
  target_compile_features(${name} INTERFACE cxx_std_17)

  install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${name}/awkward"
          DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${name}")
endmacro(add_component)

# Component: Builder Options
add_component(builder-options)
# Component: Growable Buffer
add_component(growable-buffer)
target_link_libraries(growable-buffer INTERFACE builder-options)
# Component: Layout Builder
add_component(layout-builder)
target_link_libraries(layout-builder INTERFACE growable-buffer builder-options)

# Build test suite?
if(BUILD_TESTS)
  add_subdirectory(tests)
endif(BUILD_TESTS)

# Installation
install(
  TARGETS layout-builder growable-buffer builder-options
  EXPORT ${PROJECT_NAME}Targets
  INCLUDES
  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(
  EXPORT ${PROJECT_NAME}Targets
  FILE ${PROJECT_NAME}Config.cmake
  NAMESPACE ${NAMESPACE}
  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
  ${PROJECT_NAME}ConfigVersion.cmake
  VERSION ${PROJECT_VERSION}
  COMPATIBILITY AnyNewerVersion)