X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=CMakeLists.txt;h=9a089951764995f7cefe1d8f78f28463a4896412;hb=402424de9b4c7c8e0f42433061c1a1e88013218f;hp=9b2b5baf1cdae3e9c09371517b46d01d907f3ea6;hpb=c671f10c07f59b7e2dfda332c99a3182c32cb689;p=umurmur.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b2b5ba..9a08995 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,37 +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) -pkg_check_modules(BASELIBS libconfig) +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(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") +add_subdirectory(src) -set(SOURCE "") +find_path(OLD_CONFIG_FILE NAMES "umurmur.conf" PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "etc") -add_subdirectory(src) -include_directories(include) +if(NOT OLD_CONFIG_FILE) + install(FILES "umurmur.conf.example" DESTINATION "etc" RENAME "umurmur.conf") +endif() -add_executable(umurmurd ${SOURCE}) -target_link_libraries(umurmurd pthread)