[A] Added package-config files to build and installation

This commit is contained in:
seleznevae 2019-05-26 10:13:58 +03:00
parent d5cbf91b90
commit ff0e78eeeb
3 changed files with 22 additions and 4 deletions

View File

@ -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) include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
@ -180,6 +184,7 @@ endif()
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Set preprocessor macros for all test builds # Set preprocessor macros for all test builds
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -9,8 +9,8 @@ target_include_directories(fort
) )
set_target_properties(fort set_target_properties(fort
PROPERTIES VERSION 0.1.4 PROPERTIES VERSION ${libfort_VERSION}
SOVERSION 0.1) SOVERSION ${libfort_SOVERSION})
if(FORT_HAVE_WCHAR) if(FORT_HAVE_WCHAR)
target_compile_definitions(fort target_compile_definitions(fort
@ -30,3 +30,6 @@ install(
) )
install(FILES fort.h fort.hpp DESTINATION include) 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)

10
lib/libfort.pc.in Normal file
View File

@ -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