2018-11-02 23:56:32 +01:00
|
|
|
cmake_minimum_required (VERSION 3.1)
|
2018-08-10 03:28:31 +02:00
|
|
|
project(xdgjson
|
2019-01-01 09:42:42 +01:00
|
|
|
VERSION 0.2.3
|
2018-08-10 03:28:31 +02:00
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
|
|
|
|
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2019-01-01 09:42:42 +01:00
|
|
|
set(CMAKE_CXX_FLAGS
|
|
|
|
"${CMAKE_CXX_FLAGS} -Wpedantic -Wall -Wextra -g -Og -fno-omit-frame-pointer")
|
2018-08-10 03:28:31 +02:00
|
|
|
|
|
|
|
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
|
|
|
|
include_directories(${JSONCPP_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
|
|
|
|
link_directories(${JSONCPP_LIBRARY_DIRS})
|
|
|
|
|
|
|
|
add_library(xdgjson SHARED src/xdgjson.cpp)
|
|
|
|
set_target_properties(xdgjson PROPERTIES
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${xdgjson_VERSION_MAJOR})
|
|
|
|
target_link_libraries(xdgjson
|
|
|
|
${LIBXDG_BASEDIR_LIBRARIES} ${JSONCPP_LIBRARIES}
|
|
|
|
stdc++fs)
|
|
|
|
|
|
|
|
add_library(xdgjson_static STATIC src/xdgjson.cpp)
|
|
|
|
set_target_properties(xdgjson_static PROPERTIES
|
|
|
|
OUTPUT_NAME xdgjson)
|
|
|
|
|
|
|
|
add_executable(example src/example.cpp)
|
|
|
|
target_link_libraries(example xdgjson ${JSONCPP_LIBRARIES})
|
|
|
|
|
|
|
|
install(TARGETS xdgjson LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
install(TARGETS xdgjson_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
install(FILES src/xdgjson.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|