summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorXiaoGuang Zeng <xgzeng@gmail.com>2011-03-03 15:50:06 +0800
committerXiaoGuang Zeng <xgzeng@gmail.com>2011-03-03 15:50:06 +0800
commit1336e40d43905c1934d3b4717e8f03a4c341588f (patch)
tree8a6130cec42bd6f469ff9dad5e819c8d9486c7d8 /CMakeLists.txt
parent2edff50c851c1dff603b5add904d56436b1dcd4e (diff)
downloadrabbitmq-c-1336e40d43905c1934d3b4717e8f03a4c341588f.tar.gz
add cmake build support.
librabbitmq and example/amqp_sendstring can be build under linux now.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..cb1646d
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 2.6)
+
+#detect amqp_codegen directory
+find_path(AMQP_CODEGEN_DIR "amqp-rabbitmq-0.9.1.json"
+ PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../rabbitmq-codegen" "${CMAKE_CURRENT_SOURCE_DIR}/../codegen"
+ NO_DEFAULT_PATH)
+
+if(NOT AMQP_CODEGEN_DIR)
+ message(FATAL_ERROR "rabbitmq-codegen not found")
+else()
+ message("rabbitmq-codegen found at ${AMQP_CODEGEN_DIR}")
+ set(AMQP_SPEC_JSON_PATH "${AMQP_CODEGEN_DIR}/amqp-rabbitmq-0.9.1.json")
+endif()
+
+#find python
+find_package(PythonInterp REQUIRED)
+
+#check simplejson
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import json"
+ RESULT_VARIABLE CHECK_PYTHON_JSON_FAILED
+)
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import simplejson"
+ RESULT_VARIABLE CHECK_PYTHON_SIMPLEJSON_FAILED
+)
+if(CHECK_PYTHON_JSON_FAILED AND CHECK_PYTHON_SIMPLEJSON_FAILED)
+ message(FATAL_ERROR "could not find a python that can 'import simplejson")
+endif()
+
+add_subdirectory(librabbitmq)
+add_subdirectory(examples)