X-Git-Url: http://git.code-monkey.de/?p=umurmur.git;a=blobdiff_plain;f=CMakeLists.txt;h=9a089951764995f7cefe1d8f78f28463a4896412;hp=1fc4f93429bd7b9198bb4e0d8b2bd3459912c2e7;hb=d017730cd2eb7eeb219e7fb975cce7c7c377b195;hpb=ce8405ded684cdcecffee29236ee1efdcd149626 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fc4f93..9a08995 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,48 +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() - -include(FindPkgConfig) -include(CheckFunctionExists) -include(CheckLibraryExists) -include(CheckSymbolExists) - -if(SSL MATCHES "openssl") - pkg_check_modules(SSLIMP REQUIRED openssl) -else() - pkg_check_modules(SSLIMP REQUIRED polarssl) - set(USE_POLARSSL ON) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "The type of build product that should be produced." FORCE) endif() -pkg_check_modules(LIBCONFIG REQUIRED libconfig) -pkg_check_modules(LIBPROTOBUF REQUIRED libprotobuf-c) +include(SelectTLSBackend) +include(SelectRTBackend) -link_directories(${LIBCONFIG_LIBDIR} ${LIBPROTOBUF_LIBDIR}) +SelectRTBackend() +SelectTLSBackend("${SSL}") -check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) +include(Options) +include(Tools) -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() +find_package(Libconfig REQUIRED) +find_package(ProtobufC REQUIRED) -set(SOURCE "") add_subdirectory(src) -include_directories(include) -add_executable(umurmurd ${SOURCE}) +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_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS}) -target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${LIBPROTOBUF_LIBRARIES} ${SSLIMP_LIBRARIES}) - -configure_file(src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)