From 83ea1be016fd5fc27ee721cf62a18716675815dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 2 May 2018 17:28:55 +0200 Subject: New upstream version 6.8.2 --- CMakeLists.txt | 120 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 100 insertions(+), 20 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d4d3a7..1a9871d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ - -cmake_minimum_required(VERSION 2.8) -# required for exports? cmake_minimum_required (VERSION 2.8.6) -project(oniguruma C) +cmake_minimum_required(VERSION 3.1) +project(oniguruma VERSION 6.8.2) set(PACKAGE onig) -set(PACKAGE_VERSION "6.8.1") +set(PACKAGE_VERSION ${PROJECT_VERSION}) + +option(BUILD_SHARED_LIBS "Build shared libraries" ON) set(USE_CRNL_AS_LINE_TERMINATOR 0) set(VERSION ${PACKAGE_VERSION}) @@ -23,7 +23,6 @@ elseif(CMAKE_COMPILER_IS_GNUCC) endif() -include(cmake/dist.cmake) include(CheckCSourceCompiles) include(CheckIncludeFiles) include(CheckFunctionExists) @@ -54,10 +53,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake.in ${CMAKE_CURRENT configure_file(${CMAKE_CURRENT_SOURCE_DIR}/oniguruma.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/oniguruma.pc @ONLY) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - set(_SRCS src/regint.h src/regparse.h src/regenc.h src/st.h src/regerror.c src/regparse.c src/regext.c src/regcomp.c src/regexec.c src/reggnu.c src/regenc.c src/regsyntax.c src/regtrav.c src/regversion.c @@ -73,15 +68,100 @@ set(_SRCS src/regint.h src/regparse.h src/regenc.h src/st.h src/unicode_unfold_key.c src/unicode_fold1_key.c src/unicode_fold2_key.c src/unicode_fold3_key.c) - add_library(onig ${_SRCS}) - -install_library(onig) - -install_header(src/oniguruma.h src/onigposix.h src/oniggnu.h) - -install_doc(doc/API doc/API.ja doc/RE doc/RE.ja doc/FAQ doc/FAQ.ja doc/CALLOUTS.BUILTIN doc/CALLOUTS.BUILTIN.ja doc/UNICODE_PROPERTIES) -install_data(AUTHORS COPYING HISTORY README.md) - +target_include_directories(onig PUBLIC + $ + $) + +# Installation (https://github.com/forexample/package-example) + +# Introduce variables: +# * CMAKE_INSTALL_LIBDIR +# * CMAKE_INSTALL_BINDIR +# * CMAKE_INSTALL_INCLUDEDIR +include(GNUInstallDirs) + +# Layout. This works for all platforms: +# * /lib*/cmake/ +# * /lib*/ +# * /include/ +set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + +set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") + +# Configuration +set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") +set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") +set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") +set(namespace "${PROJECT_NAME}::") + +# Include module with fuction 'write_basic_package_version_file' +include(CMakePackageConfigHelpers) + +# Configure 'ConfigVersion.cmake' +# Use: +# * PROJECT_VERSION +write_basic_package_version_file( + "${version_config}" COMPATIBILITY SameMajorVersion +) + +# Configure 'Config.cmake' +# Use variables: +# * TARGETS_EXPORT_NAME +# * PROJECT_NAME +configure_package_config_file( + "cmake/Config.cmake.in" + "${project_config}" + INSTALL_DESTINATION "${config_install_dir}" +) + +# Targets: +# * /lib/libonig.a +# * header location after install: /include/ +# * headers can be included by C code `#include ` +install( + TARGETS onig + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) + +# Headers: +# * src/oniguruma.h -> /include/oniguruma +install( + FILES src/oniguruma.h src/onigposix.h src/oniggnu.h + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) + +# Config +# * /lib/cmake/oniguruma/onigurumaConfig.cmake +# * /lib/cmake/oniguruma/onigurumaConfigVersion.cmake +install( + FILES "${project_config}" "${version_config}" + DESTINATION "${config_install_dir}" +) + +# Config +# * /lib/cmake/oniguruma/onigurumaTargets.cmake +install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" + DESTINATION "${config_install_dir}" +) + +# Documentation (uses onig not oniguruma for directory) +install(FILES doc/API doc/API.ja doc/RE doc/RE.ja doc/FAQ doc/FAQ.ja + doc/CALLOUTS.BUILTIN doc/CALLOUTS.BUILTIN.ja + doc/CALLOUTS.API doc/CALLOUTS.API.ja + doc/UNICODE_PROPERTIES + DESTINATION "${CMAKE_INSTALL_DATADIR}/${PACKAGE_NAME}") + +# Other files (uses onig not oniguruma for directory) +install(FILES AUTHORS COPYING HISTORY README.md + DESTINATION "${CMAKE_INSTALL_DATADIR}/${PACKAGE_NAME}") + +# pkg-config install(FILES ${CMAKE_CURRENT_BINARY_DIR}/oniguruma.pc - DESTINATION lib/pkgconfig) + DESTINATION lib/pkgconfig) -- cgit v1.2.3