Skip to content

Commit

Permalink
Add pkgconfig file back to CMake (#225)
Browse files Browse the repository at this point in the history
Using existing lib3MF.pc.in file, add the necessary CMake rules to
have it built. This requires setting the project version and the
description is just nice. Also required a casing change to match the
generate .so and the pkconfig filename is supposed to match the Name field
  • Loading branch information
aconz2 authored Aug 27, 2020
1 parent ae4249f commit 42ca9db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ cmake_policy(SET CMP0048 NEW)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(lib3mf)


include(GNUInstallDirs)

# Define Version
Expand All @@ -16,6 +13,10 @@ set(LIB3MF_VERSION_MINOR 1) # increase on every backward compatible chang
set(LIB3MF_VERSION_MICRO 0) # increase on on every change that does not alter the API
set(LIB3MF_VERSION_PRERELEASE "beta") # denotes pre-release information of a version of lib3mf

project(lib3mf
VERSION ${LIB3MF_VERSION_MAJOR}.${LIB3MF_VERSION_MINOR}.${LIB3MF_VERSION_MICRO}
DESCRIPTION "An implementation of the 3D Manufacturing Format file standard")

set(CMAKE_INSTALL_BINDIR bin CACHE PATH "directory for installing binary files")
set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "directory for installing library files")
set(CMAKE_INSTALL_INCLUDEDIR include/lib3mf CACHE PATH "directory for installing header files")
Expand Down Expand Up @@ -190,6 +191,8 @@ else()
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:/O2;/sdl;/WX;/Oi;/Gy;/FC;/wd4996>")
endif()

configure_file(lib3mf.pc.in lib3mf.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/lib3mf.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand Down
12 changes: 12 additions & 0 deletions lib3mf.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@

Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@

Requires:
Libs: -L${libdir} -l3mf -lzip -lz
Cflags: -I${includedir}

0 comments on commit 42ca9db

Please sign in to comment.