forked from cinemast/libjson-rpc-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (71 loc) · 3.08 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 2.6)
project(libjson-rpc-cpp)
cmake_policy(SET CMP0007 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wnon-virtual-dtor -fprofile-arcs -ftest-coverage -fPIC -O0")
SET(MAJOR_VERSION 0)
SET(MINOR_VERSION 4)
SET(PATCH_VERSION 0)
SET(SO_VERSION 0)
#possible modules that can be enabled/disabled
SET(HTTP_SERVER YES CACHE BOOL "Include HTTP server using libmicrohttpd")
SET(HTTP_CLIENT YES CACHE BOOL "Include HTTP client support using curl")
SET(COMPILE_TESTS YES CACHE BOOL "Compile test framework")
SET(COMPILE_STUBGEN YES CACHE BOOL "Compile the stubgenerator")
SET(COMPILE_EXAMPLES YES CACHE BOOL "Compile example programs")
IF(WIN32)
include_directories(${CMAKE_SOURCE_DIR}/win32-deps/include)
SET(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/dist)
SET(BOOST_ROOT "C:/boost_1_57_0")
ENDIF()
#the core framework
add_subdirectory(src/jsonrpccpp)
#the stubgenerator
IF(COMPILE_STUBGEN)
add_subdirectory(src/stubgenerator)
ENDIF()
#the examples
IF(COMPILE_EXAMPLES AND HTTP_SERVER AND HTTP_CLIENT)
add_subdirectory(src/examples)
ENDIF()
#the test suite
find_package(Boost COMPONENTS unit_test_framework)
IF(Boost_FOUND AND COMPILE_TESTS)
ENABLE_TESTING()
add_subdirectory(src/test)
ENDIF()
find_package(Doxygen)
if(DOXYGEN_FOUND)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc)
message(STATUS "Found doxygen: ${DOXYGEN_EXECUTABLE}")
configure_file("${CMAKE_SOURCE_DIR}/doc/doxyfile.in" "${CMAKE_BINARY_DIR}/Doxyfile" @ONLY)
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc COMMENT "Generating API documentation")
endif(DOXYGEN_FOUND)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
#packaging stuff
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libjson-rpc-cpp")
SET(CPACK_PACKAGE_VENDOR "Peter Spiess-Knafl <psk@autistici.org>")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
IF(WIN32 AND NOT UNIX)
SET(CPACK_GENERATOR "NSIS")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} libjson-rpc-cpp")
SET(CPACK_NSIS_HELP_LINK "http://github.com/cinemast/libjson-rpc-cpp")
SET(CPACK_NSIS_URL_INFO_ABOUT "http://github.com/cinemast/libjson-rpc-cpp")
SET(CPACK_NSIS_CONTACT "psk@autistici.org")
SET(CPACK_NSIS_MODIFY_PATH ON)
ENDIF(WIN32 AND NOT UNIX)
INCLUDE(CPack)