Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing pkg-config file for cppzmq #492

Closed
panicgh opened this issue Jun 7, 2021 · 1 comment · Fixed by #564
Closed

Missing pkg-config file for cppzmq #492

panicgh opened this issue Jun 7, 2021 · 1 comment · Fixed by #564

Comments

@panicgh
Copy link
Contributor

panicgh commented Jun 7, 2021

It would be nice for compatibility with pkg-config-based applications, if cppzmq generated a *.pc file like libzmq already does. For someone knowledgeable in CMake (not me) this is probably a trivial task.

Maybe this does the trick:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1fdf04a..0b49b34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,6 +87,11 @@ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Conf
                                  COMPATIBILITY AnyNewerVersion)
 set(CMAKE_SIZEOF_VOID_P ${CPPZMQ_SIZEOF_VOID_P})
 
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cppzmq.pc.in
+               ${CMAKE_CURRENT_BINARY_DIR}/cppzmq.pc @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cppzmq.pc
+              DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
 install(EXPORT ${PROJECT_NAME}-targets
         FILE ${PROJECT_NAME}Targets.cmake
         DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR})
diff --git a/cppzmq.pc.in b/cppzmq.pc.in
new file mode 100644
index 0000000..3dc945d
--- /dev/null
+++ b/cppzmq.pc.in
@@ -0,0 +1,9 @@
+prefix="@CMAKE_INSTALL_PREFIX@"
+includedir="@CMAKE_INSTALL_FULL_INCLUDEDIR@"
+
+Name: @PROJECT_NAME@
+Description: C++ binding for libzmq
+URL: https://github.com/zeromq/cppzmq
+Version: @PROJECT_VERSION@
+Requires: libzmq
+Cflags: -I"${includedir}" @pkg_config_defines@
-- 
2.31.1
@panicgh
Copy link
Contributor Author

panicgh commented Jun 15, 2021

related: #477

If cppzmq provided a pc-file, it would be possible to use the libzmq pc-file too and get the correct flags from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant