linking seems fine now (at least on osx)
[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 pkg_check_modules(LIBCONFIG libconfig)
13 pkg_check_modules(LIBPROTOBUF libprotobuf-c)
14
15 if(DEFINED SSL)
16   pkg_check_modules(SSLIMP REQUIRED ${SSL})
17 else()
18   pkg_check_modules(SSLIMP REQUIRED polarssl)
19 endif()
20
21 check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
22
23 if(NOT HAVE_CLOCK_GETTIME)
24   check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
25   if(NOT HAVE_CLOCK_GETTIME_RT)
26     check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
27     if(NOT HAVE_CLOCK_GET_TIME)
28       message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time!")
29     endif()
30   else()
31     set(LIBRARIES ${LIBRARIES} rt)
32   endif()
33 endif()
34
35 set(SOURCE "")
36
37 add_subdirectory(src)
38 include_directories(include)
39
40 add_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS})
41 #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS}")
42
43 add_executable(umurmurd ${SOURCE})
44 target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${LIBPROTOBUF_LIBRARIES} ${SSLIMP_LIBRARIES})