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
|
|
|
|
2018-07-01 00:31:49 -04:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
2014-06-18 08:47:06 -04:00
|
|
|
|
2018-07-01 00:31:49 -04:00
|
|
|
find_package(Check)
|
2023-10-23 06:38:24 -04:00
|
|
|
find_package(PCRE2 REQUIRED)
|
2014-06-18 07:20:44 -04:00
|
|
|
|
2018-07-01 00:31:49 -04:00
|
|
|
include(CheckSymbolExists)
|
2021-10-12 04:52:44 -04:00
|
|
|
include(CheckIncludeFile)
|
2018-07-01 00:31:49 -04:00
|
|
|
check_symbol_exists(strdup string.h HAVE_STRDUP)
|
|
|
|
check_symbol_exists(strndup string.h HAVE_STRNDUP)
|
2021-10-12 04:52:44 -04:00
|
|
|
check_include_file(stdbool.h HAVE_STDBOOL_H)
|
2018-07-01 00:31:49 -04:00
|
|
|
configure_file(config.h.cmake config.h)
|
2014-06-18 07:20:44 -04:00
|
|
|
|
|
|
|
add_subdirectory(src)
|
2018-07-01 00:31:49 -04:00
|
|
|
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
include/memory.h
|
|
|
|
include/r3.h
|
|
|
|
include/r3_list.h
|
|
|
|
include/r3_slug.h
|
|
|
|
include/r3_gvc.h
|
|
|
|
include/r3_json.h
|
|
|
|
include/str_array.h
|
|
|
|
include/r3.hpp
|
|
|
|
DESTINATION include)
|
|
|
|
|
2018-07-10 09:19:26 -04:00
|
|
|
# Configure substitutions for r3.pc. The variables set here must match the
|
|
|
|
# @<values>@ in r3.pc.in.
|
2018-07-01 00:31:49 -04:00
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(exec_prefix ${prefix})
|
|
|
|
set(includedir ${prefix}/include)
|
|
|
|
set(libdir ${prefix}/lib)
|
|
|
|
set(PACKAGE_VERSION ${PROJECT_VERSION})
|
|
|
|
configure_file(r3.pc.in r3.pc @ONLY)
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${PROJECT_BINARY_DIR}/r3.pc
|
|
|
|
DESTINATION lib/pkgconfig)
|
|
|
|
|
|
|
|
if(CHECK_FOUND)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(tests)
|
|
|
|
else()
|
|
|
|
message(STATUS "Skipping unit tests, Check library not found!")
|
|
|
|
endif()
|