-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (40 loc) · 1.41 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
cmake_minimum_required(VERSION 3.12)
project(althas
VERSION 1.0
DESCRIPTION "Header-only C++ library provides auto-management & table-driven testing facilities for Verilator simulaus."
HOMEPAGE_URL "https://github.com/Ray-Eldath/althas")
set(CMAKE_CXX_STANDARD 17)
#
# althas
#
add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
#
# example
#
option(${PROJECT_NAME}_BUILD_EXAMPLE "Build example for ${PROJECT_NAME}." OFF)
if (${PROJECT_NAME}_BUILD_EXAMPLE)
add_subdirectory(example/pc)
add_subdirectory(example/termcolor)
endif ()
#
# install & export
#
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config.cmake
DESTINATION lib/cmake/${PROJECT_NAME})
install(DIRECTORY include/
DESTINATION include)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
INCLUDES DESTINATION include)
install(EXPORT ${PROJECT_NAME}-targets
NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/${PROJECT_NAME})