From ff0e78eeeb2926d0d892b926867661168cae3432 Mon Sep 17 00:00:00 2001 From: seleznevae Date: Sun, 26 May 2019 10:13:58 +0300 Subject: [PATCH] [A] Added package-config files to build and installation --- CMakeLists.txt | 9 +++++++-- lib/CMakeLists.txt | 7 +++++-- lib/libfort.pc.in | 10 ++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 lib/libfort.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc6ccc..bc78304 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) -project(libfort) +project(libfort VERSION 0.1.5) + +string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" + "\\1.\\2" libfort_SOVERSION + ${libfort_VERSION}) include(${CMAKE_ROOT}/Modules/ExternalProject.cmake) @@ -180,6 +184,7 @@ endif() + # ------------------------------------------------------------------------------ # Set preprocessor macros for all test builds # ------------------------------------------------------------------------------ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5984d2a..0d60da1 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -9,8 +9,8 @@ target_include_directories(fort ) set_target_properties(fort - PROPERTIES VERSION 0.1.4 - SOVERSION 0.1) + PROPERTIES VERSION ${libfort_VERSION} + SOVERSION ${libfort_SOVERSION}) if(FORT_HAVE_WCHAR) target_compile_definitions(fort @@ -30,3 +30,6 @@ install( ) install(FILES fort.h fort.hpp DESTINATION include) + +configure_file(libfort.pc.in libfort.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libfort.pc DESTINATION lib/pkgconfig) diff --git a/lib/libfort.pc.in b/lib/libfort.pc.in new file mode 100644 index 0000000..2a37bb4 --- /dev/null +++ b/lib/libfort.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +includedir=${prefix}/include +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ + +Name: libfort +Description: A simple C/C++ crossplatform library to create formatted text tables. +Version: @libfort_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lfort