fix for non-standartd lib paths
[umurmur.git] / CMakeLists.txt
1 project(umurmurd)
2
3 cmake_minimum_required(VERSION 2.8)
4
5 add_definitions()
6
7 include(FindPkgConfig)
8 include(CheckFunctionExists)
9 include(CheckLibraryExists)
10 include(CheckSymbolExists)
11
12 if(SSL MATCHES "openssl")
13   pkg_check_modules(SSLIMP REQUIRED openssl)
14 else()
15   pkg_check_modules(SSLIMP REQUIRED polarssl)
16   set(USE_POLARSSL ON)
17 endif()
18
19 pkg_check_modules(LIBCONFIG libconfig)
20 pkg_check_modules(LIBPROTOBUF libprotobuf-c)
21
22 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBCONFIG_LIDIR})
23 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBPROTOBUF_LIDIR})
24
25 check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
26
27 if(NOT HAVE_CLOCK_GETTIME)
28   check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
29   if(NOT HAVE_CLOCK_GETTIME_RT)
30     check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
31     if(NOT HAVE_CLOCK_GET_TIME)
32       message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time!")
33     endif()
34   else()
35     set(LIBRARIES ${LIBRARIES} rt)
36   endif()
37 endif()
38
39 set(SOURCE "")
40 add_subdirectory(src)
41 include_directories(include)
42
43 add_executable(umurmurd ${SOURCE})
44
45
46 add_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS})
47 target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${LIBPROTOBUF_LIBRARIES} ${SSLIMP_LIBRARIES})
48
49 configure_file(src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)