Skip to content

Commit cc70c82

Browse files
authored
Merge pull request #2183 from a4z/opmg_cmake
Problem: CMake build rejects to build with openpgm enabled
2 parents 50a6c11 + 6f597d0 commit cc70c82

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,31 @@ if (MSVC)
375375
endif ()
376376
else ()
377377
if (WITH_OPENPGM)
378-
message (FATAL_ERROR "WITH_OPENPGM not implemented")
378+
# message (FATAL_ERROR "WITH_OPENPGM not implemented")
379+
380+
if (NOT OPENPGM_PKGCONFIG_NAME)
381+
SET (OPENPGM_PKGCONFIG_NAME "openpgm-5.2")
382+
endif(NOT OPENPGM_PKGCONFIG_NAME)
383+
384+
SET (OPENPGM_PKGCONFIG_NAME ${OPENPGM_PKGCONFIG_NAME} CACHE STRING
385+
"Name pkg-config shall use to find openpgm libraries and include paths"
386+
FORCE )
387+
388+
find_package(PkgConfig)
389+
pkg_check_modules (OPENPGM ${OPENPGM_PKGCONFIG_NAME})
390+
391+
if (OPENPGM_FOUND)
392+
message (STATUS ${OPENPGM_PKGCONFIG_NAME}" found")
393+
else ()
394+
message (FATAL_ERROR
395+
${OPENPGM_PKGCONFIG_NAME}" not found. openpgm is searchd via `pkg-config ${OPENPGM_PKGCONFIG_NAME}`. Consider providing a valid OPENPGM_PKGCONFIG_NAME")
396+
endif ()
397+
379398
# DSO symbol visibility for openpgm
380399
if (HAVE_FLAG_VISIBILITY_HIDDEN)
381400

382401
elseif (HAVE_FLAG_LDSCOPE_HIDDEN)
402+
383403
endif ()
384404
endif ()
385405
endif ()
@@ -780,7 +800,7 @@ endif ()
780800
if (WITH_PERF_TOOL)
781801
foreach (perf-tool ${perf-tools})
782802
add_executable (${perf-tool} perf/${perf-tool}.cpp)
783-
target_link_libraries (${perf-tool} libzmq)
803+
target_link_libraries (${perf-tool} libzmq ${OPTIONAL_LIBRARIES})
784804

785805
if (RT_LIBRARY)
786806
target_link_libraries (${perf-tool} ${RT_LIBRARY})

tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ if(WIN32)
138138
endif()
139139

140140
# add library and include dirs for all targets
141-
link_libraries(libzmq)
141+
link_libraries(libzmq ${OPTIONAL_LIBRARIES})
142142
include_directories("${CMAKE_SOURCE_DIR}/../include")
143143

144144
foreach(test ${tests})
@@ -157,6 +157,7 @@ foreach(test ${tests})
157157
endif()
158158
endif()
159159

160+
160161
if(RT_LIBRARY)
161162
target_link_libraries(${test} ${RT_LIBRARY} )
162163
endif()

0 commit comments

Comments
 (0)