-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathCMakeLists.txt
61 lines (44 loc) · 1.32 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
59
60
61
cmake_minimum_required(VERSION 3.14)
PROJECT(limonp
LANGUAGES CXX)
################
# cmake config #
################
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
message(STATUS "CMAKE_CXX_STANDARD is ${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
##############
# dependency #
##############
include(GNUInstallDirs)
##########
# target #
##########
add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>)
########
# test #
########
ENABLE_TESTING()
ADD_SUBDIRECTORY(test)
ADD_TEST(NAME ./test/demo COMMAND ./test/demo)
ADD_TEST(NAME ./test/test.run COMMAND ./test/test.run)
###########
# install #
###########
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME})
install(EXPORT ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake/
NAMESPACE ${PROJECT_NAME}::
FILE ${PROJECT_NAME}-config.cmake)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})