2014-06-18 07:20:44 -04:00
|
|
|
# cmake file examples
|
|
|
|
# https://code.google.com/p/opencv-feature-tracker/source/browse/CMakeLists.txt?r=f804b03e704147e65183c19a50f57abedb22f45c
|
|
|
|
|
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# cmake clean... orz
|
|
|
|
# http://stackoverflow.com/questions/9680420/looking-for-a-cmake-clean-command-to-clear-up-cmake-output
|
|
|
|
|
2018-02-23 03:39:39 -05:00
|
|
|
# load required modules
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
include(CheckTypeSize)
|
2014-06-18 07:20:44 -04:00
|
|
|
|
2018-02-23 03:39:39 -05:00
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(r3 VERSION 2.0.0)
|
2014-06-18 07:20:44 -04:00
|
|
|
|
|
|
|
SET(CMAKE_MODULE_PATH
|
2018-02-23 03:39:39 -05:00
|
|
|
${PROJECT_SOURCE_DIR}/cmake/Modules
|
2014-06-18 07:20:44 -04:00
|
|
|
${CMAKE_MODULE_PATH}
|
2018-02-23 03:39:39 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
# check for availability of certain headers
|
|
|
|
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
|
|
|
|
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
|
|
|
|
CHECK_INCLUDE_FILE(jemalloc/jemalloc.h HAVE_JEMALLOC_JEMALLOC_H)
|
|
|
|
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
|
|
|
|
CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
|
|
|
|
CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
|
|
|
|
CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
|
|
|
|
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
|
|
|
|
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
|
|
|
|
CHECK_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H)
|
|
|
|
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
|
|
|
|
|
|
|
|
# check availability of certain system functions
|
|
|
|
CHECK_SYMBOL_EXISTS("gettimeofday" "sys/time.h" HAVE_GETTIMEOFDAY)
|
|
|
|
CHECK_SYMBOL_EXISTS("memset" "string.h" HAVE_MEMSET)
|
|
|
|
CHECK_SYMBOL_EXISTS("strchr" "string.h" HAVE_STRCHR)
|
|
|
|
CHECK_SYMBOL_EXISTS("strdup" "string.h" HAVE_STRDUP)
|
|
|
|
CHECK_SYMBOL_EXISTS("strndup" "string.h" HAVE_STRNDUP)
|
|
|
|
CHECK_SYMBOL_EXISTS("strnstr" "string.h" HAVE_STRNSTR)
|
|
|
|
CHECK_SYMBOL_EXISTS("strstr" "string.h" HAVE_STRSTR)
|
|
|
|
|
|
|
|
# check availability of certain types
|
|
|
|
CHECK_TYPE_SIZE(_Bool _BOOL)
|
|
|
|
|
|
|
|
# generate the configuration file
|
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/config.h.cmake" "${PROJECT_BINARY_DIR}/config.h")
|
2014-06-18 07:20:44 -04:00
|
|
|
|
2018-02-24 11:45:15 -05:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_BINARY_DIR})
|
2014-06-18 08:47:06 -04:00
|
|
|
|
2014-06-18 07:20:44 -04:00
|
|
|
find_package(PCRE REQUIRED)
|
|
|
|
|
2018-02-24 11:53:02 -05:00
|
|
|
set(LIBS ${PCRE_LIBRARIES} r3 lib3rdparty)
|
2014-06-18 07:20:44 -04:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
2014-06-18 08:54:46 -04:00
|
|
|
add_subdirectory(3rdparty)
|
2014-06-18 07:20:44 -04:00
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(tests)
|
2014-06-18 08:27:35 -04:00
|
|
|
# add_test(test_tree ${CMAKE_CURRENT_BINARY_DIR}/check_tree)
|