-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
73 lines (61 loc) · 1.83 KB
/
CMakeLists.txt
File metadata and controls
73 lines (61 loc) · 1.83 KB
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
# CMake version
cmake_minimum_required( VERSION 3.1.0 )
# Project name
project( pocket_plus VERSION 0.2.0 DESCRIPTION "PocketPlus" )
# Compiler flags
set( CMAKE_CXX_STANDARD 17 )
# Includes
enable_testing()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package( Threads REQUIRED )
find_package( GTest REQUIRED )
include_directories( ${GTEST_INCLUDE_DIRS} )
# Code coverage
include(${CMAKE_CURRENT_SOURCE_DIR}/CodeCoverage.cmake)
set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
# Include source folders
include_directories(
./src
./src/compressor
./src/decompressor
./src/utils
./tests
)
# Declare source files
set(SOURCES
./src/main.cpp
./src/compressor/pocketpluscompressor.cpp
./src/decompressor/pocketplusdecompressor.cpp
./src/utils/pocketplusutils.cpp
)
set(TEST_SOURCES
./tests/utils_tests.cpp
./tests/compressor_tests.cpp
./tests/decompressor_tests.cpp
)
# Declare library target
add_library( PocketPlus SHARED ${SOURCES} )
set_target_properties( PocketPlus PROPERTIES VERSION ${PROJECT_VERSION} )
set_target_properties( PocketPlus PROPERTIES PUBLIC_HEADER
"src/compressor/pocketpluscompressor.h;src/decompressor/pocketplusdecompressor.h;src/utils/pocketplusutils.h"
)
# Declare binary target
add_executable( PocketPlus.exe ${SOURCES} )
# Declare test target
add_executable( PocketPlus_tests ${TEST_SOURCES} )
target_link_libraries(
PocketPlus_tests
gtest
gtest_main
pthread
PocketPlus
)
SETUP_TARGET_FOR_COVERAGE(
PocketPlus_tests_coverage # Name for custom target.
PocketPlus_tests # Name of the test driver executable that runs the tests.
coverage # Name of output directory.
)
# Discover test cases
gtest_discover_tests( PocketPlus_tests )
# Install
install( TARGETS PocketPlus LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include )