mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-13 10:52:57 +01:00
Pkg-Config Fallback: File
move the new logic to a simple file so we do not add code duplication
This commit is contained in:
parent
217985adf0
commit
2008da35e6
@ -5,26 +5,7 @@ find_package(ZeroMQ)
|
||||
|
||||
# libzmq autotools install: fallback to pkg-config
|
||||
if(NOT ZeroMQ_FOUND)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
||||
|
||||
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
||||
find_library(ZeroMQ_LIBRARY NAMES libzmq.so
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq.a
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||
|
||||
add_library(libzmq SHARED IMPORTED)
|
||||
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
|
||||
|
||||
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})
|
||||
|
||||
if(ZeroMQ_LIBRARY AND ZeroMQ_STATIC_LIBRARY)
|
||||
set(ZeroMQ_FOUND ON)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/libzmqPkgConfigFallback.cmake)
|
||||
endif()
|
||||
|
||||
if(NOT ZeroMQ_FOUND)
|
||||
@ -79,4 +60,5 @@ install(EXPORT ${PROJECT_NAME}-targets
|
||||
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
||||
${CMAKE_SOURCE_DIR}/libzmqPkgConfigFallback.cmake
|
||||
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR})
|
||||
|
@ -21,26 +21,7 @@ find_package(ZeroMQ)
|
||||
|
||||
# libzmq autotools install: fallback to pkg-config
|
||||
if(NOT ZeroMQ_FOUND)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
||||
|
||||
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
||||
find_library(ZeroMQ_LIBRARY NAMES libzmq.so
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq.a
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||
|
||||
add_library(libzmq SHARED IMPORTED)
|
||||
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
|
||||
|
||||
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})
|
||||
|
||||
if(ZeroMQ_LIBRARY AND ZeroMQ_STATIC_LIBRARY)
|
||||
set(ZeroMQ_FOUND ON)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/libzmqPkgConfigFallback.cmake)
|
||||
endif()
|
||||
|
||||
if(NOT ZeroMQ_FOUND)
|
||||
|
20
libzmqPkgConfigFallback.cmake
Normal file
20
libzmqPkgConfigFallback.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
||||
|
||||
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
||||
find_library(ZeroMQ_LIBRARY NAMES libzmq.so
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq.a
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||
|
||||
add_library(libzmq SHARED IMPORTED)
|
||||
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
|
||||
|
||||
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})
|
||||
|
||||
if(ZeroMQ_LIBRARY AND ZeroMQ_STATIC_LIBRARY)
|
||||
set(ZeroMQ_FOUND ON)
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user