From 5f9aea411dc2c3cc38c1d15145d1ffc13ebb2963 Mon Sep 17 00:00:00 2001 From: maxed Date: Mon, 14 May 2018 17:05:53 +0300 Subject: [PATCH 1/2] export include directory to make static library use case more convenient for the end-user --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 506b59f2c..c2a4c8d1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.11) project(Easyloggingpp CXX) @@ -33,8 +33,6 @@ set(ELPP_VERSION_STRING "${ELPP_MAJOR_VERSION}.${ELPP_MINOR_VERSION}.${ELPP_PATC set(ELPP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in") set(ELPP_PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) - install(FILES src/easylogging++.h src/easylogging++.cc @@ -54,6 +52,8 @@ if (build_static_lib) require_cpp11() add_library(easyloggingpp STATIC src/easylogging++.cc) + target_include_directories(easyloggingpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) + install(TARGETS easyloggingpp ARCHIVE DESTINATION lib) From 989c340419a035ef35a8b57319a437c99935040e Mon Sep 17 00:00:00 2001 From: maxed Date: Mon, 14 May 2018 17:19:09 +0300 Subject: [PATCH 2/2] export directories slightly more properly --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2a4c8d1d..39c9f1a96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,12 @@ if (build_static_lib) require_cpp11() add_library(easyloggingpp STATIC src/easylogging++.cc) - - target_include_directories(easyloggingpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) + + target_include_directories(easyloggingpp + PUBLIC + $ + $ + ) install(TARGETS easyloggingpp