From 9a2dfe455d3ccf649e2a0f78a50927580bcbbe19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 1 Jun 2020 18:51:16 +0200 Subject: New upstream version 0.9.4 --- CMakeLists.txt | 133 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 73 insertions(+), 60 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ceb79e0..70088b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,32 +3,32 @@ # Copyright (C) 2018, Sebastian Pipping # All rights reserved. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions # are met: # -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the following -# disclaimer. +# 1. Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. # -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials -# provided with the distribution. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. # -# * Neither the name of the nor the names of its -# contributors may be used to endorse or promote products -# derived from this software without specific prior written -# permission. +# 3. Neither the name of the copyright holder nor the names of +# its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED @@ -38,12 +38,14 @@ cmake_minimum_required(VERSION 3.3) project(uriparser VERSION - 0.9.3 + 0.9.4 + LANGUAGES + C ) # See https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html set(URIPARSER_SO_CURRENT 1) -set(URIPARSER_SO_REVISION 26) +set(URIPARSER_SO_REVISION 27) set(URIPARSER_SO_AGE 0) include(CheckCCompilerFlag) @@ -58,10 +60,11 @@ include(GNUInstallDirs) # option(BUILD_SHARED_LIBS "Build shared libraries (rather than static ones)" ON) option(URIPARSER_BUILD_DOCS "Build API documentation (requires Doxygen, Graphviz, and (optional) Qt's qhelpgenerator)" ON) -option(URIPARSER_BUILD_TESTS "Build test suite (requires GTest >=1.8.1)" ON) +option(URIPARSER_BUILD_TESTS "Build test suite (requires GTest >=1.8.0)" ON) option(URIPARSER_BUILD_TOOLS "Build tools (e.g. CLI \"uriparse\")" ON) option(URIPARSER_BUILD_CHAR "Build code supporting data type 'char'" ON) option(URIPARSER_BUILD_WCHAR_T "Build code supporting data type 'wchar_t'" ON) +option(URIPARSER_ENABLE_INSTALL "Enable installation of uriparser" ON) set(URIPARSER_MSVC_RUNTIME "" CACHE STRING "Use of specific runtime library (/MT /MTd /MD /MDd) with MSVC") if(NOT URIPARSER_BUILD_CHAR AND NOT URIPARSER_BUILD_WCHAR_T) @@ -74,20 +77,22 @@ if(URIPARSER_BUILD_TOOLS AND NOT URIPARSER_BUILD_CHAR) message(SEND_ERROR "URIPARSER_BUILD_TOOLS=ON requires URIPARSER_BUILD_CHAR=ON.") endif() +macro(uriparser_apply_msvc_runtime_to ref) + string(REGEX REPLACE "/M[DT]d?" ${URIPARSER_MSVC_RUNTIME} ${ref} "${${ref}}") +endmacro() + if(MSVC AND URIPARSER_MSVC_RUNTIME) - set(_refs - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_RELEASE - CMAKE_C_FLAGS - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_RELEASE - ) - foreach(_ref ${_refs}) - string(REGEX REPLACE "/M[DT]d?" ${URIPARSER_MSVC_RUNTIME} ${_ref} "${${_ref}}") - endforeach() + uriparser_apply_msvc_runtime_to(CMAKE_C_FLAGS) + uriparser_apply_msvc_runtime_to(CMAKE_C_FLAGS_DEBUG) + uriparser_apply_msvc_runtime_to(CMAKE_C_FLAGS_RELEASE) endif() +macro(uriparser_install) + if(URIPARSER_ENABLE_INSTALL) + install(${ARGN}) + endif() +endmacro() + # # Compiler checks # @@ -185,7 +190,7 @@ target_include_directories(uriparser ${CMAKE_CURRENT_BINARY_DIR} # for config.h ) -install( +uriparser_install( TARGETS uriparser EXPORT @@ -230,7 +235,7 @@ if(URIPARSER_BUILD_TOOLS) target_link_libraries(uriparse PUBLIC ws2_32) endif() - install( + uriparser_install( TARGETS uriparse DESTINATION @@ -242,9 +247,17 @@ endif() # C++ test runner # if(URIPARSER_BUILD_TESTS) + enable_language(CXX) + + if(MSVC AND URIPARSER_MSVC_RUNTIME) + uriparser_apply_msvc_runtime_to(CMAKE_CXX_FLAGS) + uriparser_apply_msvc_runtime_to(CMAKE_CXX_FLAGS_DEBUG) + uriparser_apply_msvc_runtime_to(CMAKE_CXX_FLAGS_RELEASE) + endif() + enable_testing() - find_package(GTest 1.8.1 REQUIRED) + find_package(GTest 1.8.0 REQUIRED) add_executable(testrunner test/FourSuite.cpp @@ -265,7 +278,7 @@ if(URIPARSER_BUILD_TESTS) endif() target_include_directories(testrunner SYSTEM PRIVATE - ${GTEST_INCLUDE_DIR} + ${GTEST_INCLUDE_DIRS} ) target_include_directories(testrunner PRIVATE @@ -325,14 +338,14 @@ if(URIPARSER_BUILD_DOCS) VERBATIM ) - install( + uriparser_install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ${CMAKE_INSTALL_DOCDIR} ) if(QHG_LOCATION) - install( + uriparser_install( FILES ${CMAKE_CURRENT_BINARY_DIR}/doc/uriparser-${PROJECT_VERSION}.qch DESTINATION @@ -360,14 +373,14 @@ export( FILE cmake/uriparser-targets.cmake # not going to be installed ) -install( +uriparser_install( FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/uriparser-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmake/uriparser-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/uriparser-${PROJECT_VERSION}/ ) -install( +uriparser_install( EXPORT uriparser DESTINATION @@ -381,7 +394,7 @@ install( # if(NOT MSVC) configure_file(liburiparser.pc.in liburiparser.pc @ONLY) - install( + uriparser_install( FILES ${CMAKE_CURRENT_BINARY_DIR}/liburiparser.pc DESTINATION @@ -392,22 +405,22 @@ endif() # # Summary # -message("===========================================================================") -message("") -message("Configuration") -message(" Prefix ............... ${CMAKE_INSTALL_PREFIX}") -message(" Shared libraries ..... ${BUILD_SHARED_LIBS}") -message(" Code for char * ...... ${URIPARSER_BUILD_CHAR}") -message(" Code for wchar_t * ... ${URIPARSER_BUILD_WCHAR_T}") -message(" Tools ................ ${URIPARSER_BUILD_TOOLS}") -message(" Test suite ........... ${URIPARSER_BUILD_TESTS}") -message(" Documentation ........ ${URIPARSER_BUILD_DOCS}") -message("") +message(STATUS "===========================================================================") +message(STATUS "") +message(STATUS "Configuration") +message(STATUS " Prefix ............... ${CMAKE_INSTALL_PREFIX}") +message(STATUS " Shared libraries ..... ${BUILD_SHARED_LIBS}") +message(STATUS " Code for char * ...... ${URIPARSER_BUILD_CHAR}") +message(STATUS " Code for wchar_t * ... ${URIPARSER_BUILD_WCHAR_T}") +message(STATUS " Tools ................ ${URIPARSER_BUILD_TOOLS}") +message(STATUS " Test suite ........... ${URIPARSER_BUILD_TESTS}") +message(STATUS " Documentation ........ ${URIPARSER_BUILD_DOCS}") +message(STATUS "") if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") - message("Continue with") - message(" make") - message(" make test") - message(" sudo make install") - message("") + message(STATUS "Continue with") + message(STATUS " make") + message(STATUS " make test") + message(STATUS " sudo make install") + message(STATUS "") endif() -message("===========================================================================") +message(STATUS "===========================================================================") -- cgit v1.2.3