-
Notifications
You must be signed in to change notification settings - Fork 42
/
CMakeLists.txt
54 lines (44 loc) · 1.76 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
cmake_minimum_required(VERSION 3.11.4)
project(Encryptions LANGUAGES CXX)
# require C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# cygwin doesn't define _POSIX_C_SOURCE by default
if (CMAKE_SYSTEM_NAME STREQUAL "CYGWIN")
add_definitions(-D_POSIX_C_SOURCE=200809L)
endif()
add_library(Encryptions_static STATIC Encryptions.h)
# build a separate set of object files with PIC enabled
set(BUILD_SHARED_LIB ON CACHE BOOL "Build a shared library")
if (BUILD_SHARED_LIB)
add_library(Encryptions_shared SHARED Encryptions.h)
set_target_properties(Encryptions_shared PROPERTIES OUTPUT_NAME "Encryptions")
install(TARGETS Encryptions_shared DESTINATION lib)
endif()
add_subdirectory(common)
add_subdirectory(Encryptions)
add_subdirectory(modes)
enable_testing()
add_subdirectory(tests)
target_include_directories(Encryptions_static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
set_target_properties(Encryptions_static
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${BINARY_DIR}/lib
RUNTIME_OUTPUT_DIRECTORY ${BINARY_DIR}
VERSION ${PROJECT_VERSION}
SOVERSION 1
DEBUG_POSTFIX "d"
)
install(TARGETS Encryptions_static EXPORT Encryptions_staticConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES Encryptions.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/modes DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(EXPORT Encryptions_staticConfig DESTINATION share/Encryptions_staticConfig/cmake)
export(TARGETS Encryptions_static FILE Encryptions_staticConfig.cmake)