3 cmake_minimum_required(VERSION 2.8)
8 include(CheckFunctionExists)
9 include(CheckLibraryExists)
10 include(CheckSymbolExists)
12 if(SSL MATCHES "openssl")
13 pkg_check_modules(SSLIMP REQUIRED openssl)
15 pkg_check_modules(SSLIMP REQUIRED polarssl)
19 pkg_check_modules(LIBCONFIG REQUIRED libconfig)
20 pkg_check_modules(LIBPROTOBUF REQUIRED libprotobuf-c)
22 link_directories(${LIBCONFIG_LIBDIR} ${LIBPROTOBUF_LIBDIR})
24 check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
26 if(NOT HAVE_CLOCK_GETTIME)
27 check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
28 if(NOT HAVE_CLOCK_GETTIME_RT)
29 check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
30 if(NOT HAVE_CLOCK_GET_TIME)
31 message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time!")
34 set(LIBRARIES ${LIBRARIES} rt)
40 include_directories(include)
42 add_executable(umurmurd ${SOURCE})
45 add_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS})
46 target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${LIBPROTOBUF_LIBRARIES} ${SSLIMP_LIBRARIES})
48 configure_file(src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)