summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2021-04-19 06:57:34 +0000
committerAlan Antonuk <alan.antonuk@gmail.com>2021-04-19 00:16:12 -0700
commita7e75d403017fadee1401453deb38e342e358f25 (patch)
treeddb9087343d2c6f8856fc35154842a9e2a2622b5 /CMakeLists.txt
parent9ee0743bde1010a3c6f54765e3c137bc630ffe37 (diff)
downloadrabbitmq-c-a7e75d403017fadee1401453deb38e342e358f25.tar.gz
cmake: set default for BUILD_TOOLS to OFF
Then make BUILD_TOOLS_DOCS only usable when BUILD_TOOLS is ON and explicitly specified. This makes the project easier to add_submodule by not sometimes turning on features based on the environment. And makes it explict when things are enabled vs something that is triggered based on the environment. Signed-off-by: GitHub <noreply@github.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt26
1 files changed, 11 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a498724..e821784 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,24 +219,20 @@ if (REGENERATE_AMQP_FRAMING)
endif()
endif (REGENERATE_AMQP_FRAMING)
-find_package(POPT)
-find_package(XmlTo)
find_package(Doxygen)
-if (POPT_FOUND AND XmlTo_FOUND)
- set(DO_DOCS ON)
-endif()
-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()
+include(CMakeDependentOption)
+
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" 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_TOOLS "Build Tools (requires POPT Library)" OFF)
+cmake_dependent_option(BUILD_TOOLS_DOCS "Build man pages for tools (requires xmlto)" OFF "BUILD_TOOLS" OFF)
option(BUILD_API_DOCS "Build Doxygen API docs" ${DOXYGEN_FOUND})
option(RUN_SYSTEM_TESTS "Run system tests (i.e. tests requiring an accessible RabbitMQ server instance on localhost)" OFF)
@@ -255,13 +251,13 @@ if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
-if (BUILD_TOOLS)
- if (POPT_FOUND)
- add_subdirectory(tools)
- else ()
- message(WARNING "POpt library was not found. Tools will not be built")
- endif ()
-endif ()
+if(BUILD_TOOLS)
+ find_package(POPT REQUIRED)
+ if(BUILD_TOOL_DOCS)
+ find_package(XmlTo REQUIRED)
+ endif()
+ add_subdirectory(tools)
+endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
if (NOT BUILD_STATIC_LIBS)