Compare commits

...

4 Commits

Author SHA1 Message Date
tastytea 9337964266
Install headers more elegantly.
continuous-integration/drone/push Build is passing Details
2019-08-03 22:18:16 +02:00
tastytea 49b2117f13
License change to BSD-3-Clause.
continuous-integration/drone/push Build is passing Details
2019-08-03 15:01:15 +02:00
tastytea 3da87609f4
Set BUILD_SHARED_LIBS via option().
continuous-integration/drone/push Build is passing Details
2019-08-03 13:12:09 +02:00
tastytea 32e0a46a7f
Require CMake 3.6. 2019-08-03 13:11:56 +02:00
7 changed files with 47 additions and 17 deletions

View File

@ -1,6 +1,7 @@
# Support version 3.1 and above, but use policy settings up to 3.14.
cmake_minimum_required(VERSION 3.1...3.14)
# Ranges are supported from 3.12, set policy to current for 3.1 - 3.11.
# Support version 3.6 and above, but use policy settings up to 3.14.
# 3.6 is needed because of IMPORTED_TARGET in pkg_check_modules().
cmake_minimum_required(VERSION 3.6...3.14)
# Ranges are supported from 3.12, set policy to current for < 3.12.
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
@ -18,9 +19,7 @@ endif()
# All custom build switches.
option(WITH_EXAMPLES "Compile examples." NO)
option(WITH_TESTS "Compile tests." NO)
# Build shared libs by default but allow overriding.
set(BUILD_SHARED_LIBS YES CACHE BOOL "Build shared libs.")
option(BUILD_SHARED_LIBS "Build shared libraries." YES)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
@ -46,7 +45,6 @@ else()
endif()
add_subdirectory(src)
add_subdirectory(include)
add_subdirectory(pkg-config)
add_subdirectory(cmake)

26
LICENSE Normal file
View File

@ -0,0 +1,26 @@
Copyright (c) 2019 tastytea <tastytea@tastytea.de>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,3 +1,5 @@
/* This file is part of xdgcfg. */
#include <iostream>
#include <libconfig.h++>
#include "xdgcfg.hpp"

View File

@ -1,3 +0,0 @@
include(GNUInstallDirs)
install(FILES "xdgcfg.hpp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

View File

@ -1,5 +1,7 @@
/* Public Domain / CC-0
* Author: tastytea <tastytea@tastytea.de>
/* Copyright © 2019 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the BSD-3-Clause license.
*/
#ifndef XDGCFG_HPP

View File

@ -4,11 +4,13 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(libxdg-basedir REQUIRED IMPORTED_TARGET libxdg-basedir)
pkg_check_modules(libconfig++ REQUIRED IMPORTED_TARGET libconfig++)
add_library(${PROJECT_NAME} "xdgcfg.cpp" "../include/xdgcfg.hpp")
set(${PROJECT_NAME}_public_headers "../include/xdgcfg.hpp")
add_library(${PROJECT_NAME} "xdgcfg.cpp" "${${PROJECT_NAME}_public_headers}")
set_target_properties(xdgcfg PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR})
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR}
PUBLIC_HEADER "${${PROJECT_NAME}_public_headers}")
target_include_directories(${PROJECT_NAME}
PUBLIC
@ -22,4 +24,5 @@ target_link_libraries(${PROJECT_NAME}
install(TARGETS ${PROJECT_NAME}
EXPORT "${PROJECT_NAME}Targets"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

View File

@ -1,5 +1,7 @@
/* Public Domain / CC-0
* Author: tastytea <tastytea@tastytea.de>
/* Copyright © 2019 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the BSD-3-Clause license.
*/
#include <basedir.h>