Link against the system library or the local build
continuous-integration/drone/push Build is passing Details

pull/1/head
Clément FRÉVILLE 2 years ago
parent 3bc8f547f6
commit c8408620c0

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.14)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
project(planificador)
@ -15,10 +15,11 @@ FetchContent_MakeAvailable(tomlplusplus)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
find_package(ZeroMQ QUIET)
add_executable(planificador src/host.cpp src/runner.cpp src/config.cpp src/main.cpp)
if (NOT ZeroMQ_FOUND)
message(STATUS "ZeroMQ not found, using bundled version")
FetchContent_Declare(
zeromq
zmq
GIT_REPOSITORY https://github.com/zeromq/libzmq.git
GIT_TAG v4.3.5
)
@ -32,16 +33,19 @@ if (NOT ZeroMQ_FOUND)
set(ZMQ_BUILD_TESTS OFF)
set(WITH_TLS OFF)
set(WITH_DOC OFF)
set(BUILD_STATIC OFF)
set(BUILD_SHARED ON)
set(ZMQ_BUILD_TESTS OFF)
set(CPPZMQ_BUILD_TESTS OFF)
FetchContent_MakeAvailable(zeromq cppzmq)
include_directories(${zeromq_SOURCE_DIR}/include)
FetchContent_MakeAvailable(zmq cppzmq)
include_directories(${zmq_SOURCE_DIR}/include)
include_directories(${cppzmq_SOURCE_DIR})
target_link_libraries(planificador PRIVATE libzmq)
else ()
target_link_libraries(planificador PRIVATE zmq)
endif ()
add_executable(planificador src/host.cpp src/runner.cpp src/config.cpp src/main.cpp)
target_compile_options(planificador PUBLIC -Wall -Wextra -pedantic)
target_compile_features(planificador PUBLIC cxx_std_17)
include_directories(${tomlplusplus_SOURCE_DIR}/include)
include_directories(${cppzmq_SOURCE_DIR})
target_link_libraries(planificador PRIVATE zmq)

Loading…
Cancel
Save