-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
68 lines (56 loc) · 1.54 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
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(pbotp)
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
option(BUILD_PAM_TEST "build PAM test harness")
add_compile_options(
-Wall
-Wextra
-Wshadow
-Wno-unused-parameter
-Wmissing-noreturn
-Wmissing-prototypes
-Wstrict-prototypes
)
set(COMMON_FILES
base64.c
challenge.c
hmac.c
sha256.c
tweetnacl.c
utils.c
)
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_search_module(QRENCODE libqrencode)
if(QRENCODE_FOUND)
add_compile_definitions(HAVE_QR)
set(COMMON_FILES ${COMMON_FILES} qr.c)
else()
message("libqrencode not found, not building QR code support")
endif()
else()
message("PkgConfig not found, cannot detect QR code support")
endif()
add_executable(genkey base64.c tweetnacl.c utils.c genkey.c)
add_library(pam_pbotp SHARED pam_pbotp.c ${COMMON_FILES})
set_target_properties(pam_pbotp PROPERTIES C_VISIBILITY_PRESET hidden)
set_target_properties(pam_pbotp PROPERTIES PREFIX "")
target_link_libraries(pam_pbotp pam)
if(QRENCODE_FOUND)
target_link_libraries(pam_pbotp ${QRENCODE_LIBRARIES})
target_include_directories(pam_pbotp PRIVATE ${QRENCODE_INCLUDE_DIRS})
endif()
if(BUILD_PAM_TEST)
add_executable(pam-test pam-test.c pam_pbotp.c ${COMMON_FILES})
if(QRENCODE_FOUND)
target_link_libraries(pam-test ${QRENCODE_LIBRARIES})
target_include_directories(pam-test PRIVATE ${QRENCODE_INCLUDE_DIRS})
endif()
endif()
include(CTest)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
install(TARGETS pam_pbotp LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/security/")