You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Merge pull request #348 from ferdnyc/zmq-targets
ZeroMQ: Use IMPORTED targets
This commit is contained in:
39
cmake/Modules/FindZeroMQ.cmake
Normal file
39
cmake/Modules/FindZeroMQ.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
||||
|
||||
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
||||
find_path(ZeroMQ_INCLUDE_DIR zmq.h PATHS ${PC_LIBZMQ_INCLUDE_DIRS} $ENV{ZMQDIR})
|
||||
|
||||
find_library(ZeroMQ_LIBRARY NAMES libzmq.so libzmq.dylib libzmq.dll
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS} $ENV{ZMQDIR})
|
||||
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq-static.a libzmq.a libzmq.dll.a
|
||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS} $ENV{ZMQDIR})
|
||||
|
||||
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
|
||||
set(ZeroMQ_FOUND ON)
|
||||
endif()
|
||||
|
||||
if (TARGET libzmq)
|
||||
# avoid errors defining targets twice
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR})
|
||||
list(APPEND ZeroMQ_INCLUDE_DIRS ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||
list(REMOVE_DUPLICATES ZeroMQ_INCLUDE_DIRS)
|
||||
|
||||
add_library(libzmq SHARED IMPORTED)
|
||||
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
|
||||
|
||||
add_library(libzmq-static STATIC IMPORTED ${ZeroMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
|
||||
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZeroMQ
|
||||
REQUIRED_VARS
|
||||
ZeroMQ_LIBRARY ZeroMQ_INCLUDE_DIRS
|
||||
VERSION_VAR
|
||||
ZeroMQ_VERSION)
|
||||
@@ -123,19 +123,6 @@ IF (ENABLE_BLACKMAGIC)
|
||||
ENDIF (BLACKMAGIC_FOUND)
|
||||
ENDIF (ENABLE_BLACKMAGIC)
|
||||
|
||||
################### ZEROMQ #####################
|
||||
# Find ZeroMQ library (used for socket communication & logging)
|
||||
|
||||
# Some platforms package the header-only cppzmq C++ bindings separately,
|
||||
# others (Ubuntu) bundle them in with libzmq itself
|
||||
find_package(cppzmq QUIET)
|
||||
find_package(ZMQ REQUIRED)
|
||||
|
||||
# Include ZeroMQ headers (needed for compile)
|
||||
include_directories(${ZMQ_INCLUDE_DIRS})
|
||||
if (cppzmq_FOUND)
|
||||
include_directories(${cppzmq_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
################### RESVG #####################
|
||||
# Find resvg library (used for rendering svg files)
|
||||
@@ -330,13 +317,26 @@ endif()
|
||||
|
||||
target_link_libraries(openshot PUBLIC OpenMP::OpenMP_CXX)
|
||||
|
||||
################### ZEROMQ #####################
|
||||
# Find ZeroMQ library (used for socket communication & logging)
|
||||
find_package(ZeroMQ REQUIRED) # Creates libzmq target
|
||||
|
||||
# Some platforms package the header-only cppzmq C++ bindings separately,
|
||||
# others (Ubuntu) bundle them in with libzmq itself
|
||||
find_package(cppzmq QUIET) # Creates cppzmq target
|
||||
|
||||
# Include ZeroMQ headers (needed for compile)
|
||||
target_link_libraries(openshot PUBLIC libzmq)
|
||||
if (TARGET cppzmq)
|
||||
target_link_libraries(openshot PUBLIC cppzmq)
|
||||
endif()
|
||||
|
||||
|
||||
############### LINK LIBRARY #################
|
||||
SET ( REQUIRED_LIBRARIES
|
||||
${LIBOPENSHOT_AUDIO_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
${PROFILER}
|
||||
${ZMQ_LIBRARIES}
|
||||
)
|
||||
|
||||
IF (RESVG_FOUND)
|
||||
|
||||
@@ -114,20 +114,6 @@ IF (ENABLE_BLACKMAGIC)
|
||||
ENDIF (ENABLE_BLACKMAGIC)
|
||||
|
||||
|
||||
################### ZEROMQ #####################
|
||||
# Find ZeroMQ library (used for socket communication & logging)
|
||||
|
||||
# Some platforms package the header-only cppzmq C++ bindings separately,
|
||||
# others (Ubuntu) bundle them in with libzmq itself
|
||||
find_package(cppzmq QUIET)
|
||||
FIND_PACKAGE(ZMQ REQUIRED)
|
||||
|
||||
# Include ZeroMQ headers (needed for compile)
|
||||
include_directories(${ZMQ_INCLUDE_DIRS})
|
||||
if (cppzmq_FOUND)
|
||||
include_directories(${cppzmq_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
################### RESVG #####################
|
||||
# Find resvg library (used for rendering svg files)
|
||||
FIND_PACKAGE(RESVG)
|
||||
|
||||
Reference in New Issue
Block a user