preliminary cmake support. linking still broken.
[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(BASELIBS libconfig)
13
14 check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
15
16 if(NOT HAVE_CLOCK_GETTIME)
17   check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
18   if(NOT HAVE_CLOCK_GETTIME_RT)
19     check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
20     if(NOT HAVE_CLOCK_GET_TIME)
21       message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time!")
22     endif()
23   else()
24     set(LIBRARIES ${LIBRARIES} rt)
25   endif()
26 endif()
27
28 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
29 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
30
31 set(SOURCE "")
32
33 add_subdirectory(src)
34 include_directories(include)
35
36 add_executable(umurmurd ${SOURCE})
37 target_link_libraries(umurmurd pthread)