This repository has been archived on 2020-05-16. You can view files and clone it, but cannot push or open issues or pull requests.
xdgcfg/CMakeLists.txt

42 lines
1.3 KiB
CMake
Raw Normal View History

2018-08-10 02:22:06 +02:00
cmake_minimum_required (VERSION 3.7)
project(xdgcfg
VERSION 0.1.0
LANGUAGES CXX
)
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
pkg_check_modules(LIBCONFIG REQUIRED libconfig++)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
include_directories(${LIBCONFIG_INCLUDE_DIRS})
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
link_directories(${LIBCONFIG_LIBRARY_DIRS})
add_library(xdgcfg SHARED src/xdgcfg.cpp)
set_target_properties(xdgcfg PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${xdgcfg_VERSION_MAJOR})
target_link_libraries(xdgcfg
${LIBXDG_BASEDIR_LIBRARIES} ${LIBCONFIG_LIBRARIES}
stdc++fs)
add_library(xdgcfg_static STATIC src/xdgcfg.cpp)
set_target_properties(xdgcfg_static PROPERTIES
OUTPUT_NAME xdgcfg)
add_executable(example src/example.cpp)
target_link_libraries(example xdgcfg)
install(TARGETS xdgcfg LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS xdgcfg_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES src/xdgcfg.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})