summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2021-04-19 07:02:20 +0000
committerAlan Antonuk <alan.antonuk@gmail.com>2021-04-19 00:16:12 -0700
commit7605238ef80edb586d80d30ad2f5c1fcdd6de6d3 (patch)
tree9846b27499f67d3a9c7ada5a5e365396a8adf6ec /CMakeLists.txt
parent45fbf2577decfeec6020e4897887dd213588332b (diff)
downloadrabbitmq-c-7605238ef80edb586d80d30ad2f5c1fcdd6de6d3.tar.gz
cmake: change BUILD_EXAMPLES to default to OFF
This makes the project easier to use as an add_subdirectory in a larger project without needing to explicitly disable this feature. As a minor side-effect: BUILD_EXAMPLES now requires BUILD_SHARED_LIBS=ON. While there isn't a technical limitation, it makes the CMake code easier to reason about, and is believed this will not impact a lot of users. If this ends up being a problem, it can be reconsidered.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4658638..a498724 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,7 +234,7 @@ endif()
option(BUILD_SHARED_LIBS "Build rabbitmq-c as a shared library" ON)
option(BUILD_STATIC_LIBS "Build rabbitmq-c as a static library" ON)
-option(BUILD_EXAMPLES "Build Examples" ON)
+option(BUILD_EXAMPLES "Build Examples" OFF)
option(BUILD_TOOLS "Build Tools (requires POPT Library)" ${POPT_FOUND})
option(BUILD_TOOLS_DOCS "Build man pages for Tools (requires xmlto)" ${DO_DOCS})
option(BUILD_API_DOCS "Build Doxygen API docs" ${DOXYGEN_FOUND})
@@ -248,9 +248,12 @@ set(targets_export_name rabbitmq-targets)
add_subdirectory(librabbitmq)
-if (BUILD_EXAMPLES)
+if(BUILD_EXAMPLES)
+ if(NOT BUILD_SHARED_LIBS)
+ message(FATAL_ERROR "Examples require -DBUILD_SHARED_LIBS=ON")
+ endif()
add_subdirectory(examples)
-endif ()
+endif()
if (BUILD_TOOLS)
if (POPT_FOUND)
@@ -302,7 +305,6 @@ set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
configure_file(cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/librabbitmq/config.h)
configure_file(librabbitmq.pc.in ${CMAKE_CURRENT_BINARY_DIR}/librabbitmq.pc @ONLY)
-
include(CMakePackageConfigHelpers)
set(RMQ_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/rabbitmq-c)
set(project_config "${CMAKE_CURRENT_BINARY_DIR}/rabbitmq-c-config.cmake")