forked from web-eid/libpcsc-mock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (48 loc) · 1.17 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
cmake_minimum_required(VERSION 3.8.0)
if(POLICY CMP0092)
cmake_policy(SET CMP0092 NEW)
endif()
project(pcsc-mock)
# The pcsc-mock library itself.
add_library(${PROJECT_NAME}
STATIC
include/${PROJECT_NAME}/${PROJECT_NAME}.hpp
src/${PROJECT_NAME}.cpp
)
target_compile_options(${PROJECT_NAME} PUBLIC
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -pedantic -Werror>
)
target_compile_definitions(${PROJECT_NAME} PUBLIC
$<$<CXX_COMPILER_ID:MSVC>:WIN32_LEAN_AND_MEAN;UNICODE>
)
target_include_directories(${PROJECT_NAME}
PUBLIC
include
)
target_compile_features(${PROJECT_NAME}
PUBLIC
cxx_std_17
)
# PC/SC API dependencies.
if(MSVC)
# no extra includes required
elseif(APPLE)
# no extra includes required
else()
find_package(PkgConfig)
pkg_check_modules(PCSC libpcsclite)
target_include_directories(${PROJECT_NAME} PUBLIC ${PCSC_INCLUDE_DIRS})
endif()
# Tests with Google Test.
enable_testing()
find_package(GTest REQUIRED)
set(TEST_EXE lib${PROJECT_NAME}-test)
add_executable(${TEST_EXE}
tests/${PROJECT_NAME}-test.cpp
)
target_link_libraries(${TEST_EXE}
${PROJECT_NAME}
GTest::Main
)
add_test(${TEST_EXE} ${TEST_EXE})