43 lines
1.1 KiB
CMake
43 lines
1.1 KiB
CMake
cmake_minimum_required (VERSION 3.1)
|
|
project(xdgcfg
|
|
VERSION 0.3.1
|
|
LANGUAGES CXX
|
|
)
|
|
|
|
set(WITH_EXAMPLES "NO" CACHE STRING "WITH_EXAMPLES defaults to \"NO\"")
|
|
set(WITH_TESTS "NO" CACHE STRING "WITH_TESTS defaults to \"NO\"")
|
|
|
|
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 -Wextra -Wpedantic -ftrapv \
|
|
-fsanitize=undefined -g -Og -fno-omit-frame-pointer")
|
|
|
|
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
|
|
include_directories(${LIBCONFIG_INCLUDE_DIRS})
|
|
|
|
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
|
|
link_directories(${LIBCONFIG_LIBRARY_DIRS})
|
|
|
|
set(COMMON_LIBRARIES
|
|
${LIBXDG_BASEDIR_LIBRARIES} ${LIBCONFIG_LIBRARIES} stdc++fs)
|
|
|
|
if (WITH_EXAMPLES)
|
|
add_executable(example src/example.cpp)
|
|
target_link_libraries(example
|
|
${COMMON_LIBRARIES})
|
|
endif()
|
|
|
|
if(WITH_TESTS)
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
install(FILES src/xdgcfg.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|