added support for building umurmur-monitor
authorFelix Morgner <felix.morgner@gmail.com>
Wed, 11 Feb 2015 12:01:15 +0000 (13:01 +0100)
committerFelix Morgner <felix.morgner@gmail.com>
Wed, 11 Feb 2015 12:01:15 +0000 (13:01 +0100)
It is now possible (with cmake) to build umurmur-monitor as a
subproject of umumur. To do so, use the following command line to clone
umurmur:

  git clone --recursive <url-to-repo>

or simply update your current copy (fetch, rebase, merge, whatever you
prefer) and then run:

  git submodule udate --init

Afterwards, create your build directory and use either ccmake or a
command line similiar to the following:

  cmake <path-to-CMakeLists.txt-of-umurmur> -DUSE_SHAREDMEMORY_API=ON \
        -DBUILD_UMURMUR_MONITOR=ON <other-flags>

Currently, building umurmur-monitor is OFF by default, even if cmake
finds the sources for the project. This might change in the future when
demanded.

CMakeLists.txt
tools/umurmur-monitor

index c59f76dee518659bad58d260636d1ba0eed93cea..891ae938a2587d670262c5cfbfb48feed19e962b 100644 (file)
@@ -1,10 +1,13 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.3)
 
 project(umurmurd C)
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
 
+set(UMURMUR_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}")
+set(UMURMUR_BINARY_DIR ${CMAKE_BINARY_DIR})
+
 option(USE_POLARSSL_TESTCERT "Link to the PolarSSL test certificate and key." OFF)
 option(USE_POLARSSL_HAVEGE "Use the PolarSSL HAVEGE random generator key." OFF)
 
@@ -68,6 +71,19 @@ else()
   set(LIBRT rt)
 endif()
 
+if(USE_SHAREDMEMORY_API)
+  set(UMURMUR_MONITOR_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/tools/umurmur-monitor/" CACHE PATH "The path to the umurmur-monitor source directory")
+  option(BUILD_UMURMUR_MONITOR "Build the umurmur-monitor utility" OFF)
+
+  if(BUILD_UMURMUR_MONITOR)
+    if(EXISTS "${UMURMUR_MONITOR_SOURCE_DIR}/CMakeLists.txt")
+      add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/tools/umurmur-monitor")
+    else()
+      message(FATAL_ERROR "Could not find umurmur-monitor source. Please specify UMURMUR_MONITOR_SOURCE_DIR")
+    endif()
+  endif()
+endif()
+
 set(SOURCE "")
 add_subdirectory(src)
 
@@ -76,8 +92,8 @@ configure_file(src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)
 include_directories(${LIBCONFIG_INCLUDE_DIR} ${PROTOBUFC_INCLUDE_DIR} ${SSLIMP_INCLUDE_DIR})
 link_directories(${LIBCONFIG_LIB_DIR} ${PROTOBUFC_LIB_DIR} ${SSLIMP_LIB_DIR})
 
-add_executable(umurmurd ${SOURCE})
-install(TARGETS umurmurd RUNTIME DESTINATION "bin")
+add_executable(${PROJECT_NAME} ${SOURCE})
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "bin")
 
 find_path(OLD_CONFIG_FILE NAMES "umurmur.conf" PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "etc")
 if(NOT OLD_CONFIG_FILE)
@@ -86,4 +102,4 @@ endif(NOT OLD_CONFIG_FILE)
 
 add_definitions(${SSLIMP_CFLAGS})
 
-target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${PROTOBUFC_LIBRARIES} ${SSLIMP_LIBRARIES} ${LIBRT} ${CRYPTO_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} ${LIBCONFIG_LIBRARIES} ${PROTOBUFC_LIBRARIES} ${SSLIMP_LIBRARIES} ${LIBRT} ${CRYPTO_LIBRARIES})
index faf3d36caacefe2cba90eb4d9c1a880e2d4167d9..66dd2c16eaea55dee46301807ee0205dd5f9237c 160000 (submodule)
@@ -1 +1 @@
-Subproject commit faf3d36caacefe2cba90eb4d9c1a880e2d4167d9
+Subproject commit 66dd2c16eaea55dee46301807ee0205dd5f9237c