r3/CMakeLists.txt

48 lines
1.1 KiB
Text
Raw Normal View History

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)
2014-06-18 07:20:44 -04:00
find_package(PCRE REQUIRED)
2018-07-01 00:31:49 -04:00
include(CheckSymbolExists)
check_symbol_exists(strdup string.h HAVE_STRDUP)
check_symbol_exists(strndup string.h HAVE_STRNDUP)
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)
# 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()