Skip to content

Commit

Permalink
fix(build): Add the dependency libraries to the open62541.pc
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfr committed May 13, 2024
1 parent f1c8bb3 commit b3c7a60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,6 @@ file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated")
# Generate the config.h
configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated/open62541/config.h)

# Generate a .pc file for pkg-config
if(UA_ENABLE_AMALGAMATION)
set(PC_EXTRA_CFLAGS "-DUA_ENABLE_AMALGAMATION")
endif()
configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY)

if(UA_ENABLE_DISCOVERY_MULTICAST)
include(GenerateExportHeader)
set(MDNSD_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported" FORCE)
Expand Down Expand Up @@ -1520,7 +1514,16 @@ export(TARGETS open62541
NAMESPACE open62541::
FILE ${CMAKE_CURRENT_BINARY_DIR}/open62541Targets.cmake)

# Install open62541.pc
# Generate and install open62541.pc
if(UA_ENABLE_AMALGAMATION)
set(PC_EXTRA_CFLAGS "-DUA_ENABLE_AMALGAMATION")
endif()
set(pclibtargets "-lopen62541")
foreach(lib ${open62541_LIBRARIES})
set(pclibtargets "${pclibtargets} -l${lib}")
endforeach()
configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
install(FILES "${PROJECT_BINARY_DIR}/src_generated/open62541.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
Expand Down
6 changes: 1 addition & 5 deletions tools/open62541.pc.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

libdir=@CMAKE_INSTALL_FULL_LIBDIR@
sharedlibdir=${libdir}
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Name: open62541
Description: open62541 is an open source C (C99) implementation of OPC UA
Version: @OPEN62541_VER_MAJOR@.@OPEN62541_VER_MINOR@.@OPEN62541_VER_PATCH@@OPEN62541_VER_LABEL@
Libs: -L${libdir} -lopen62541
Libs: -L${libdir} @pkgcfglibs@
Cflags: -I${includedir} @PC_EXTRA_CFLAGS@

0 comments on commit b3c7a60

Please sign in to comment.