-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
50 lines (43 loc) · 1.78 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
cmake_minimum_required(VERSION 3.14)
project(cotila VERSION 1.2.1 LANGUAGES CXX DESCRIPTION "A compile time linear algebra system" HOMEPAGE_URL "https://github.com/calebzulawski/cotila")
option(BUILD_TESTING "Build Cotila tests" ON)
option(BUILD_DOCS "Build Doxygen documentation" OFF)
# Interface target
include(GNUInstallDirs)
add_library(cotila INTERFACE)
target_include_directories(cotila INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_features(cotila INTERFACE cxx_std_17)
add_library(cotila::cotila ALIAS cotila)
# Docs build
if (BUILD_DOCS)
find_package(Doxygen REQUIRED)
# Options from Doxyfile
set(DOXYGEN_DOXYFILE_ENCODING "utf-8")
set(DOXYGEN_PROJECT_LOGO "logo.svg")
set(DOXYGEN_OUTPUT_DIRECTORY "docs/") # will be in {binary_dir}/docs
set(DOXYGEN_REPEAT_BRIEF "NO")
set(DOXYGEN_SEPARATE_MEMBER_PAGES "YES")
set(DOXYGEN_EXCLUDE_PATTERNS "*/detail/*")
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "mainpage.md")
set(DOXYGEN_LAYOUT_FILE "layout.xml")
doxygen_add_docs(doc include/ mainpage.md layout.xml COMMENT "Generating documentation")
endif()
# installing
install(DIRECTORY include/cotila DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS cotila EXPORT cotila-config DESTINATION ${CMAKE_INSTALL_DATADIR})
install(EXPORT cotila-config NAMESPACE cotila:: DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/cotila")
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${PROJECT_BINARY_DIR}/cotila-configVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
ARCH_INDEPENDENT
)
install(FILES "${PROJECT_BINARY_DIR}/cotila-configVersion.cmake" DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/cotila")
# testing
if(BUILD_TESTING)
enable_testing()
add_subdirectory("test/")
endif()