Skip to content

Commit

Permalink
Added missing dependencies in Package Configuration File when configu…
Browse files Browse the repository at this point in the history
…ring with OpenSSL

Changed CMake FIND_PACKAGE to FIND_DEPENDENCY according to CMake guide.
This fixes #902
  • Loading branch information
Markus Tillinger committed Nov 1, 2021
1 parent 7ac3e0c commit 8a9aa32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,26 @@ ENDIF ()
SET (Boost_USE_MULTITHREADED ON)
FIND_PACKAGE (Threads REQUIRED)

SET (MQTT_BOOST_COMPONENTS)
IF (MQTT_USE_LOG)
MESSAGE (STATUS "Logging enabled")
FIND_PACKAGE (Boost 1.67.0 REQUIRED COMPONENTS system date_time log filesystem thread)
SET (MQTT_BOOST_COMPONENTS system date_time log filesystem thread program_options)
ELSE ()
MESSAGE (STATUS "Logging disabled")
FIND_PACKAGE (Boost 1.67.0 REQUIRED COMPONENTS system date_time)
SET (MQTT_BOOST_COMPONENTS system date_time program_options)
ENDIF ()
FIND_PACKAGE (Boost 1.67.0 REQUIRED COMPONENTS ${MQTT_BOOST_COMPONENTS})

IF (MQTT_NO_TS_EXECUTORS AND ((Boost_MAJOR_VERSION LESS 1) OR (Boost_MINOR_VERSION LESS 74)))
MESSAGE(FATAL_ERROR "Boost version 1.74.0 or later is required for use with standard executors")
ENDIF ()

IF (MQTT_USE_TLS)
FIND_PACKAGE (OpenSSL REQUIRED)
SET (MQTT_DEPENDS_OPENSSL "FIND_DEPENDENCY (OpenSSL)")
IF (MQTT_USE_STATIC_OPENSSL)
FIND_PACKAGE (ZLIB REQUIRED)
SET (MQTT_DEPENDS_ZLIB "FIND_DEPENDENCY (ZLIB)")
ENDIF ()
ENDIF ()

Expand Down
7 changes: 5 additions & 2 deletions cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
SET (Boost_USE_MULTITHREADED ON)
FIND_PACKAGE (Threads REQUIRED)
FIND_PACKAGE (Boost 1.67.0 REQUIRED COMPONENTS system date_time)
include(CMakeFindDependencyMacro)
FIND_DEPENDENCY (Threads)
FIND_DEPENDENCY (Boost 1.67.0 COMPONENTS @MQTT_BOOST_COMPONENTS@)
@MQTT_DEPENDS_OPENSSL@
@MQTT_DEPENDS_ZLIB@

IF (NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@)
get_filename_component(CURRENT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
Expand Down

0 comments on commit 8a9aa32

Please sign in to comment.