diff options
-rw-r--r-- | CMakeLists.txt | 46 | ||||
-rw-r--r-- | README.md | 19 |
2 files changed, 18 insertions, 47 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b4f95e2..d594aa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(rabbitmq-c "C") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) @@ -23,44 +23,22 @@ endif (CHECK_PYTHON_JSON_FAILED) include(TestCInline) -option(FETCH_CODEGEN_FROM_GIT "Fetch codegen directly from the git repository" OFF) - -set(CODEGEN_GIT_TAG rabbitmq_v2_5_1 CACHE STRING "Git tag in rabbitmq-codegen to fetch with FETCH_CODEGEN_FROM_GIT") -if (FETCH_CODEGEN_FROM_GIT) - include(ExternalProject) - ExternalProject_Add( - amqp_codegen - GIT_REPOSITORY https://github.com/rabbitmq/rabbitmq-codegen.git - GIT_TAG ${CODEGEN_GIT_TAG} - CONFIGURE_COMMAND "" - UPDATE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "") - - ExternalProject_Get_Property(amqp_codegen SOURCE_DIR) - set(AMQP_CODEGEN_DIR ${SOURCE_DIR} CACHE PATH "Path to rabbitmq-codegen" FORCE) - SET(AMQP_CODEGEN_TARGET amqp_codegen) - message(STATUS "Using amqp_codegen.py in ${AMQP_CODEGEN_DIR}") -else (FETCH_CODEGEN_FROM_GIT) - find_path(RABBITMQ_CODEGEN_DIR - amqp_codegen.py - PATHS ${CMAKE_SOURCE_DIR}/rabbitmq-codegen - ${CMAKE_SOURCE_DIR}/../rabbitmq-codegen - ${CMAKE_SOURCE_DIR}/codegen +find_path(RABBITMQ_CODEGEN_DIR + amqp_codegen.py + PATHS ${CMAKE_SOURCE_DIR}/codegen + ${CMAKE_SOURCE_DIR}/rabbitmq-codegen + ${CMAKE_SOURCE_DIR}/../rabbitmq-codegen DOC "Path to directory containing amqp_codegen.py (rabbitmq-codegen)" NO_DEFAULT_PATH ) - if (RABBITMQ_CODEGEN_DIR STREQUAL "RABBITMQ_CODEGEN_DIR-NOTFOUND") - message(SEND_ERROR "Cannot find rabbitmq-codegen, set RABBITMQ_CODEGEN_DIR to a rabbitmq-codegen checkout, or set FETCH_CODEGEN_FROM_GIT to download it from git automatically") - else () - message(STATUS "Using amqp_codegen.py in ${RABBITMQ_CODEGEN_DIR}") - endif() - - set(AMQP_CODEGEN_DIR ${RABBITMQ_CODEGEN_DIR} CACHE PATH "Path to rabbitmq-codegen" FORCE) -endif (FETCH_CODEGEN_FROM_GIT) +if (RABBITMQ_CODEGEN_DIR STREQUAL "RABBITMQ_CODEGEN_DIR-NOTFOUND") + message(SEND_ERROR "Cannot find amqp_codegen.py, did you forget to:\n\ngit submodule init\ngit submodule update\n?") +else () + message(STATUS "Using amqp_codegen.py in ${RABBITMQ_CODEGEN_DIR}") +endif() +set(AMQP_CODEGEN_DIR ${RABBITMQ_CODEGEN_DIR} CACHE PATH "Path to rabbitmq-codegen" FORCE) mark_as_advanced(AMQP_CODEGEN_DIR) find_package(POPT) @@ -49,14 +49,14 @@ to build the `librabbitmq` library and the example programs. ### Using cmake -You will need CMake: http://cmake.org/ +You will need CMake (v2.6 or better): http://cmake.org/ -You will need a working python install in your path. +You will need a working python install (2.6+) with the json or simplejson +modules installed. -If you would like the build system to fetch the rabbitmq-codegen -automatically you will need to have a working git install in your -path. Otherwise you will need to checkout the rabbitmq-codegen as -stated above. +You will need to do the git submodule init/update as above. +Alternatively you can clone the rabbitmq-codegen repository and point +cmake to it using the RABBITMQ_CODEGEN_DIR cmake variable Create a binary directory in a sibling directory from the directory you cloned the rabbitmq-c repository @@ -78,13 +78,6 @@ Things you can pass to cmake to change the build: * `-DRABBITMQ_CODEGEN_DIR=/path/to/rabbitmq-codegen/checkout` - if you have your codegen directory in a different place [Default is sibiling directory to source] -* `-DFETCH_CODEGEN_FROM_GIT=ON` - if you want cmake to fetch the - rabbitmq-codegen from https://github.com/rabbitmq/rabbitmq-codegen - at build time. If this option is selected `-DRABBITMQ_CODEGEN_DIR` - will be ignored [Default is off] -* `-DCODEGEN_GIT_TAG=rabbitmq_v2_5_1` - specifies the tag to check out - if using the `-DFETCH_CODEGEN_FROM_GIT` option above. [Default is - `rabbitmq_v2_5_1`] * `-DBUILD_TOOLS=OFF` build the programs in the tools directory [Default is ON if the POPT library can be found] |