X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=CMakeLists.txt;h=5ece93ee3512b85fd0697d8e2c7bf33c809484b6;hb=7d9162c5b470f5b31db9ca76e105bd7ed5de8ec8;hp=e8c532ca5b166eca8e7b649f99f9d91b9c04070c;hpb=28c8149a34cf16d7ac7fb1e7b07914200034a8d5;p=umurmur.git diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c532c..5ece93e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,44 +1,34 @@ -project(umurmurd) +cmake_minimum_required(VERSION 2.8.3) +project(umurmurd C) -cmake_minimum_required(VERSION 2.8) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true) +set(UMURMUR_BINARY_DIR "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${UMURMUR_BINARY_DIR}") -add_definitions() +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "The type of build product that should be produced." FORCE) +endif() -include(FindPkgConfig) -include(CheckFunctionExists) include(CheckLibraryExists) -include(CheckSymbolExists) - -pkg_check_modules(LIBCONFIG libconfig) -pkg_check_modules(LIBPROTOBUF libprotobuf-c) +include(CheckFunctionExists) +include(SelectTLSBackend) +include(SelectRTBackend) -if(DEFINED SSL) - pkg_check_modules(SSLIMP REQUIRED ${SSL}) -else() - pkg_check_modules(SSLIMP REQUIRED polarssl) -endif() +SelectRTBackend() +SelectTLSBackend("${SSL}") -check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) - -if(NOT HAVE_CLOCK_GETTIME) - check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT) - if(NOT HAVE_CLOCK_GETTIME_RT) - check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME) - if(NOT HAVE_CLOCK_GET_TIME) - message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time!") - endif() - else() - set(LIBRARIES ${LIBRARIES} rt) - endif() -endif() +include(Options) +include(Tools) -set(SOURCE "") +find_package(Libconfig REQUIRED) +find_package(ProtobufC REQUIRED) add_subdirectory(src) -include_directories(include) -add_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS}) -#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS}") +find_path(OLD_CONFIG_FILE NAMES "umurmur.conf" PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "etc") + +if(NOT OLD_CONFIG_FILE) + install(FILES "umurmur.conf.example" DESTINATION "etc" RENAME "umurmur.conf") +endif() -add_executable(umurmurd ${SOURCE}) -target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${LIBPROTOBUF_LIBRARIES} ${SSLIMP_LIBRARIES})