summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlan Antonuk <aega@med.umich.edu>2012-10-02 12:03:01 -0400
committerAlan Antonuk <alan.antonuk@gmail.com>2012-11-14 22:46:33 -0500
commit433b8e00ec8842bc5520eb92614d415512b9bec5 (patch)
tree9b01ea452a68f5cb4b10412faf0cb9c3e5f36ab2 /CMakeLists.txt
parent6aa5779d74353f03e56d0c5079885ec2535011a8 (diff)
downloadrabbitmq-c-github-ask-433b8e00ec8842bc5520eb92614d415512b9bec5.tar.gz
CMake: build both static and shared libs in one build
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 20 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00efc0c..802cbe4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -194,13 +194,19 @@ if (POPT_FOUND AND XmlTo_FOUND)
endif()
option(BUILD_SHARED_LIBS "Build rabbitmq-c as a shared library" ON)
+option(BUILD_STATIC_LIBS "Build rabbitmq-c as a static library" OFF)
+
option(BUILD_EXAMPLES "Build Examples" ON)
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_TESTS "Build tests (run tests with make test)" ON)
-if (WIN32 AND NOT BUILD_SHARED_LIBS)
- message(FATAL_ERROR "The rabbitmq-c library cannot be built as a static library on Win32. Set BUILD_SHARED_LIBS=ON to get around this.")
+if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
+ message(FATAL_ERROR "One or both of BUILD_SHARED_LIBS or BUILD_STATIC_LIBS must be set to ON to build")
+endif()
+
+if (WIN32 AND BUILD_STATIC_LIBS)
+ message(FATAL_ERROR "The rabbitmq-c library cannot be built as a static library on Win32. Set BUILD_STATIC_LIBS=OFF to get around this.")
endif()
add_subdirectory(librabbitmq)
@@ -234,3 +240,15 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/librabbitmq.pc
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig
)
+
+if (BUILD_SHARED_LIBS)
+ message(STATUS "Building rabbitmq as a shared library - yes")
+else ()
+ message(STATUS "Building rabbitmq as a shared library - no")
+endif ()
+
+if (BUILD_STATIC_LIBS)
+ message(STATUS "Building rabbitmq as a static library - yes")
+else ()
+ message(STATUS "Building rabbitmq as a static library - no")
+endif ()