X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=CMakeLists.txt;h=9a089951764995f7cefe1d8f78f28463a4896412;hb=a110f98be8239cb11b578cdec47580ef98bb545b;hp=4886e40d93d2fa0100b0394f35d454d6a59e6613;hpb=59d006faba0b4f526010c66e9d4b8d3768450a6b;p=umurmur.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 4886e40..9a08995 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,46 +1,32 @@ -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) +include(SelectTLSBackend) +include(SelectRTBackend) -if(SSL MATCHES "openssl") - pkg_check_modules(SSLIMP REQUIRED openssl) -else() - pkg_check_modules(SSLIMP REQUIRED polarssl) - set(USE_POLARSSL ON) -endif() +SelectRTBackend() +SelectTLSBackend("${SSL}") -pkg_check_modules(LIBCONFIG libconfig) -pkg_check_modules(LIBPROTOBUF libprotobuf-c) - -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 "") -add_subdirectory(src) -include_directories(include) +find_package(Libconfig REQUIRED) +find_package(ProtobufC REQUIRED) -add_executable(umurmurd ${SOURCE}) +add_subdirectory(src) +find_path(OLD_CONFIG_FILE NAMES "umurmur.conf" PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "etc") -add_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS}) -target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${LIBPROTOBUF_LIBRARIES} ${SSLIMP_LIBRARIES}) +if(NOT OLD_CONFIG_FILE) + install(FILES "umurmur.conf.example" DESTINATION "etc" RENAME "umurmur.conf") +endif() -configure_file(src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)