-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
49 lines (36 loc) · 1.39 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
cmake_minimum_required(VERSION 3.9)
project(gcwatchdog)
set(CPACK_GENERATOR "TGZ")
include(CPack)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
find_package(Threads REQUIRED)
include(UseJava)
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/catch2)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/extern/catch2")
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
set(JMM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/java)
include_directories(${JNI_INCLUDE_DIRS} ${JMM_INCLUDE_DIR} include)
add_subdirectory(src)
enable_testing()
add_subdirectory(test)
set(TARGET gcwatchdog)
set(TEST_TARGET gcwatchdog_tests)
if(APPLE)
set(UTIL_SOURCE src/util_macos.cpp)
else()
set(UTIL_SOURCE src/util_linux.cpp)
endif()
set(SOURCE src/agent.cpp src/vm.cpp src/gc.cpp src/log.cpp src/param.cpp)
set(TEST_SOURCES test/main.cpp test/config_parse_test.cpp test/logger_test.cpp)
add_executable(${TEST_TARGET} ${UTIL_SOURCE} ${SOURCE} ${TEST_SOURCES})
target_link_libraries(${TEST_TARGET} Catch ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
add_library(${TARGET} SHARED ${UTIL_SOURCE} ${SOURCE})
target_link_libraries(${TARGET} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
include(CTest)
include(Catch)
catch_discover_tests(${TEST_TARGET})
install(TARGETS ${TARGET} DESTINATION ".")