File: CMakeLists.txt

package info (click to toggle)
trompeloeil-cpp 49-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,640 kB
  • sloc: cpp: 20,576; sh: 126; makefile: 5
file content (96 lines) | stat: -rw-r--r-- 1,978 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
cmake_minimum_required(VERSION 3.14)
project(trompeloeil CXX)

include(GNUInstallDirs)
include(ExternalProject)
include(CMakePackageConfigHelpers)
include(CheckCXXCompilerFlag)

option(TROMPELOEIL_BUILD_TESTS "Build self test programs" off)

write_basic_package_version_file(
  "${CMAKE_CURRENT_BINARY_DIR}/trompeloeil/trompeloeil-config-version.cmake"
  VERSION 49
  COMPATIBILITY AnyNewerVersion
  ARCH_INDEPENDENT)

add_library(trompeloeil INTERFACE)
add_library(trompeloeil::trompeloeil ALIAS trompeloeil)

set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

target_include_directories(
  trompeloeil
  INTERFACE
    $<BUILD_INTERFACE:${INCLUDE_DIR}>
)

target_include_directories(
  trompeloeil
  INTERFACE
    $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
)

set(MASTER_PROJECT OFF)
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
  set(MASTER_PROJECT ON)
endif()

option(TROMPELOEIL_INSTALL_TARGETS "Sets whether trompeloeil should be installed" ${MASTER_PROJECT})
option(TROMPELOEIL_INSTALL_DOCS "Install documentation" ${TROMPELOEIL_INSTALL_TARGETS})

if (MASTER_PROJECT AND TROMPELOEIL_BUILD_TESTS)
  add_subdirectory(test)
endif()

if (TROMPELOEIL_INSTALL_TARGETS)
install(
  TARGETS
    trompeloeil
  EXPORT
    trompeloeil-targets
  INCLUDES DESTINATION
    include
)

install(
  EXPORT
    trompeloeil-targets
  NAMESPACE
    trompeloeil::
  DESTINATION
    ${CMAKE_INSTALL_LIBDIR}/cmake/trompeloeil
)
install(
  FILES
    trompeloeil-config.cmake
    "${CMAKE_CURRENT_BINARY_DIR}/trompeloeil/trompeloeil-config-version.cmake"
  DESTINATION
    ${CMAKE_INSTALL_LIBDIR}/cmake/trompeloeil
  COMPONENT
    Devel
)

install(
  DIRECTORY
    include/
  DESTINATION
    ${CMAKE_INSTALL_INCLUDEDIR}
)
endif(TROMPELOEIL_INSTALL_TARGETS)

if(TROMPELOEIL_INSTALL_DOCS)
  install(
    FILES
      LICENSE_1_0.txt
    DESTINATION
      ${CMAKE_INSTALL_DOCDIR}
  )

  install(
    DIRECTORY
      docs
    DESTINATION
      ${CMAKE_INSTALL_DOCDIR}
  )
endif()