-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,500 additions
and
1,532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,42 @@ | ||
# __ ____ __ __ _ ____ ____ ___ _ _ | ||
# _( )/ ___) / \ ( ( \( _ \( _ \ / __)( ) ( ) | ||
# / \) \\___ \( O )/ / ) / ) __/( (__(_ _)(_ _) | ||
# \____/(____/ \__/ \_)__)(__\_)(__) \___)(_) (_) | ||
|
||
# This file is part of jsonrpc++ | ||
# Copyright (C) 2017-2018 Johannes Pohl | ||
|
||
# This software may be modified and distributed under the terms | ||
# of the MIT license. See the LICENSE file for details. | ||
|
||
|
||
cmake_minimum_required(VERSION 3.0.0) | ||
|
||
project(jsonrpcpp VERSION 1.1.1 LANGUAGES CXX) | ||
project(jsonrpcpp VERSION 1.2.0 LANGUAGES CXX) | ||
set(PROJECT_DESCRIPTION "C++ JSON-RPC 2.0 library") | ||
set(PROJECT_URL "https://github.com/badaix/jsonrpcpp") | ||
|
||
option(BUILD_SHARED_LIBS "Build jsonrpcpp as a shared library" ON) | ||
option(BUILD_STATIC_LIBS "Build jsonrpcpp as a static library" ON) | ||
option(BUILD_TESTS "Build tests (run tests with make test)" ON) | ||
option(BUILD_EXAMPLE "Build example (build jsonrpcpp_example demo)" ON) | ||
|
||
if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) | ||
message(FATAL_ERROR "One or both of BUILD_SHARED_LIBS or BUILD_STATIC_LIBS" | ||
"must be set to ON to build") | ||
endif() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR) | ||
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries") | ||
endif() | ||
|
||
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) | ||
SET(CMAKE_INSTALL_INCLUDEDIR include CACHE | ||
PATH "Output directory for header files") | ||
SET(CMAKE_INSTALL_INCLUDEDIR include CACHE | ||
PATH "Output directory for header files") | ||
endif() | ||
|
||
include_directories(lib) | ||
set(JSONRPCPP_SOURCES lib/jsonrp.cpp) | ||
|
||
if (BUILD_SHARED_LIBS) | ||
add_library(jsonrpcpp SHARED "${JSONRPCPP_SOURCES}") | ||
target_compile_features(jsonrpcpp PUBLIC cxx_std_11) | ||
if(WIN32) | ||
install(TARGETS jsonrpcpp RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}") | ||
else() | ||
install(TARGETS jsonrpcpp LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") | ||
endif() | ||
|
||
endif (BUILD_SHARED_LIBS) | ||
include_directories( | ||
"include" | ||
) | ||
|
||
if (BUILD_STATIC_LIBS) | ||
add_library(jsonrpcpp-static STATIC "${JSONRPCPP_SOURCES}") | ||
set_target_properties(jsonrpcpp-static PROPERTIES OUTPUT_NAME jsonrpcpp) | ||
target_compile_features(jsonrpcpp-static PUBLIC cxx_std_11) | ||
install(TARGETS jsonrpcpp-static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") | ||
endif (BUILD_STATIC_LIBS) | ||
if (BUILD_EXAMPLE) | ||
add_executable(jsonrpcpp_example jsonrpcpp_example.cpp) | ||
endif (BUILD_EXAMPLE) | ||
|
||
if (BUILD_TESTS) | ||
if (NOT BUILD_STATIC_LIBS) | ||
message(FATAL_ERROR "Tests can only be built against static libraries " | ||
"(set BUILD_STATIC_LIBS=ON)") | ||
endif (NOT BUILD_STATIC_LIBS) | ||
add_executable(jsonrpctest jsonrpctest.cpp) | ||
target_link_libraries(jsonrpctest jsonrpcpp-static) | ||
target_compile_features(jsonrpctest PUBLIC cxx_std_11) | ||
endif (BUILD_TESTS) | ||
|
||
install(FILES lib/jsonrp.hpp lib/json.hpp | ||
install(FILES include/jsonrpcpp.hpp include/json.hpp | ||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/jsonrpcpp") | ||
|
||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/jsonrpcpp.pc.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/jsonrpcpp.pc" | ||
@ONLY) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/jsonrpcpp.pc" | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.