-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
58 lines (51 loc) · 1.56 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.12)
project(Iris
VERSION 0.1.0
LANGUAGES CXX
)
include(GNUInstallDirs)
# Creates a library Iris which is an interface (header files only)
add_library(Iris INTERFACE)
# If you want to use Iris prefer to link against Iris using this alias target
add_library(Iris::Iris ALIAS Iris)
# Specify build type ifnot
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "CMAKE_BUILD_TYPE not specified: Use Release by default.")
endif(NOT CMAKE_BUILD_TYPE)
# Determine whether this is a standalone project or included by other projects
set(IRIS_STANDALONE_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(IRIS_STANDALONE_PROJECT ON)
endif()
# Project options
option(IRIS_INSTALL "Generate and install Iris target" ${IRIS_STANDALONE_PROJECT})
option(IRIS_TEST "Build and perform Iris tests" ${IRIS_STANDALONE_PROJECT})
# Setup include directory
add_subdirectory(include)
if(IRIS_INSTALL)
install(
TARGETS Iris
EXPORT IrisConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
DIRECTORY include/iris
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# Make library importable by other projects
install(
EXPORT IrisConfig
NAMESPACE Iris::
FILE IrisConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Iris
# EXPORT_LINK_INTERFACE_LIBRARIES
)
endif()
if(IRIS_TEST)
include(CTest)
add_subdirectory(tests)
endif()