-
Notifications
You must be signed in to change notification settings - Fork 122
/
CMakeLists.txt
54 lines (42 loc) · 1.48 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
project(subhook)
cmake_minimum_required(VERSION 2.8)
set(SUBHOOK_VERSION_MAJOR 0)
set(SUBHOOK_VERSION_MINOR 2)
set(SUBHOOK_VERSION_PATCH 1)
set(SUBHOOK_VERSION ${SUBHOOK_VERSION_MAJOR})
set(SUBHOOK_VERSION ${SUBHOOK_VERSION}.${SUBHOOK_VERSION_MINOR})
set(SUBHOOK_VERSION ${SUBHOOK_VERSION}.${SUBHOOK_VERSION_PATCH})
set(SUBHOOK_HEADERS subhook.h)
set(SUBHOOK_SOURCES subhook.c subhook_private.h)
add_definitions(-DSUBHOOK_IMPLEMENTATION)
if(SUBHOOK_STATIC)
add_library(subhook STATIC ${SUBHOOK_HEADERS} ${SUBHOOK_SOURCES})
else()
add_library(subhook SHARED ${SUBHOOK_HEADERS} ${SUBHOOK_SOURCES})
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY
INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
if(SUBHOOK_STATIC)
add_definitions(-DSUBHOOK_STATIC)
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY
COMPILE_DEFINITIONS SUBHOOK_STATIC)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(NOT SUBHOOK_NO_INSTALL)
install(TARGETS subhook
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)
install(FILES ${SUBHOOK_HEADERS} DESTINATION include)
endif()
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR ${SUBHOOK_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SUBHOOK_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SUBHOOK_VERSION_PATCH})
include(CPack)
include(CTest)
if(BUILD_TESTING AND NOT SUBHOOK_NO_TESTS)
enable_testing()
add_subdirectory(test)
endif()