-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
80 lines (65 loc) · 1.68 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
cmake_minimum_required(VERSION 3.5)
project(pwcard
VERSION 0.1.0
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(LIBRARY_PUBLIC_HEADER
include/pwcard/pwcard.h
)
set(LIBRARY_HEADERS
include/linear_congruential_engine.h
include/shuffle.h
include/uniform_int_distribution.h
)
set(LIBRARY_SOURCES
src/linear_congruential_engine.cpp
src/pwcard.cpp
src/uniform_int_distribution.cpp
)
add_library(${PROJECT_NAME} SHARED
${LIBRARY_PUBLIC_HEADER}
${LIBRARY_HEADERS}
${LIBRARY_SOURCES}
)
target_include_directories(${PROJECT_NAME} PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
)
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 0
PUBLIC_HEADER ${LIBRARY_PUBLIC_HEADER}
)
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
EXPORT PwCardConfig
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT lib
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMPONENT dev
)
export(TARGETS ${PROJECT_NAME}
NAMESPACE PwCard::
FILE ${CMAKE_CURRENT_BINARY_DIR}/PwCardConfig.cmake
)
install(EXPORT PwCardConfig
DESTINATION ${CMAKE_INSTALL_DATADIR}/PwCard/cmake
NAMESPACE PwCard::
)
option(BUILD_EXAMPLE "Build example app" OFF)
if (BUILD_EXAMPLE)
add_subdirectory(example)
endif()
include(CTest)
if (BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()