-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
51 lines (39 loc) · 1.26 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
# CMAkeLists.txt file for mumpi project
cmake_minimum_required(VERSION 3.0.0)
# Options. Turn on with 'cmake -Dvarname=ON'.
option(test "Build all tests." OFF) # makes boolean 'test' available
set(CMAKE_BUILD_TYPE Debug)
# Project
project(klv)
# Compiler settings
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
endif ()
else ()
set (CMAKE_CXX_STANDARD 11)
endif ()
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# Check for packages
INCLUDE(FindPkgConfig)
pkg_check_modules(LOG4CPP "log4cpp")
# INCLUDES
include_directories(${LOG4CPP_INCLUDE_DIRS})
include_directories(include)
# SOURCES
#Can manually add the sources using the set command as follows:
#set(SOURCES src/mainapp.cpp src/Student.cpp)
file(GLOB SOURCES "src/*.cpp")
add_library(klv SHARED ${SOURCES})
# LINKING
# target_link_libraries(libklv z) # zlib
# target_link_libraries(libklv m) # math
target_link_libraries(klv ${LOG4CPP_LIBRARIES})
# TESTING
# TESTING
enable_testing()
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/googletest")
file(GLOB TESTS "test/*.cpp")
add_executable(runUnitTests ${TESTS})
target_link_libraries(runUnitTests gtest gtest_main gmock klv)
add_test(NAME libklv-test COMMAND runUnitTests)