Skip to content

Commit 261e47d

Browse files
committed
add needed pkg-config changes
1 parent c13d1fe commit 261e47d

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
project(dbc)
3+
project(dbc VERSION 0.1.1 DESCRIPTION "C++ DBC Parser")
4+
5+
# package
6+
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
7+
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
8+
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
9+
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
10+
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
11+
include(CPack)
412

513
option(DEBUG "use debug flag" NO)
614

15+
# defines variables used in the dbc.pc.in
16+
include(GNUInstallDirs)
17+
718
# specify the C++ standard
819
set(CMAKE_CXX_STANDARD 11)
920
set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -40,3 +51,9 @@ add_custom_target(release
4051
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
4152
COMMAND ${CMAKE_SOURCE_DIR}/scripts/create_single_header.sh
4253
DEPENDS ${PROJECT_NAME})
54+
55+
# Generate pkg-config file
56+
configure_file(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
57+
install(
58+
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
59+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

dbc.pc.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=${prefix}
3+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
4+
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
5+
6+
Name: @PROJECT_NAME@
7+
Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
8+
Version: @CPACK_PACKAGE_VERSION@
9+
Cflags: -I${includedir}
10+
Libs: -L${libdir} -l@PROJECT_NAME@

0 commit comments

Comments
 (0)