-
Notifications
You must be signed in to change notification settings - Fork 19
/
CMakeLists.txt
65 lines (50 loc) · 1.65 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
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(jsNet)
set(CMAKE_CXX_STANDARD 14)
enable_language(C)
enable_language(CXX)
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
include_directories(
${PROJECT_SOURCE_DIR}/dev/cpp
)
add_library(
jsNet
dev/cpp/Network.cpp
)
set(GOOGLETEST_ROOT test/googletest/googletest CACHE STRING "Google Test source root")
set(GOOGLEMOCK_ROOT test/googletest/googlemock CACHE STRING "Google Mock source root")
include_directories(
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/include
${PROJECT_SOURCE_DIR}/${GOOGLEMOCK_ROOT}
${PROJECT_SOURCE_DIR}/${GOOGLEMOCK_ROOT}/include
)
set(GOOGLETEST_SOURCES
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/src/gtest-all.cc
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/src/gtest_main.cc
${PROJECT_SOURCE_DIR}/${GOOGLEMOCK_ROOT}/src/gmock-all.cc
${PROJECT_SOURCE_DIR}/${GOOGLEMOCK_ROOT}/src/gmock_main.cc
)
foreach(_source ${GOOGLETEST_SOURCES})
set_source_files_properties(${_source} PROPERTIES GENERATED 1)
endforeach()
add_library(googletest ${GOOGLETEST_SOURCES})
add_executable(
cpp-tests
test/cpp-test.cpp
)
add_dependencies(cpp-tests googletest)
target_link_libraries(
cpp-tests
googletest
jsNet
pthread
)
include(CTest)
enable_testing()
add_test(unit ${PROJECT_BINARY_DIR}/cpp-tests)