serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1834227 - in /serf/trunk: CMakeLists.txt build/APRCommon.cmake build/FindAPR.cmake build/FindAPRUTIL.cmake build/FindApr.cmake build/FindApu.cmake build/SerfChecks.cmake build/SerfVersion.cmake build/feature.cmake build/version.cmake
Date Sat, 23 Jun 2018 22:45:31 GMT
Author: brane
Date: Sat Jun 23 22:45:31 2018
New Revision: 1834227

URL: http://svn.apache.org/viewvc?rev=1834227&view=rev
Log:
More work on the CMake build.

* CMakeLists.txt: Adjust for the changes listed below.
* build/SerfVersion.cmake: Renamed from build/version.cmake.
* build/SerfChecks.cmake: Renamed from build/feature.cmake.
* build/APRCommon.cmake: New; common code for FindAPR and FindAPRUTIL.
* build/FindAPR.cmake: Renamed from build/FindApr.cmake.
   Expose version, extract common code, fix variable names, support APR 2.x.
* build/FindAPRUTIL.cmake: Renamed from build/FindApu.cmake.
   Other changes as for FindAPR.cmake.

Added:
    serf/trunk/build/APRCommon.cmake
    serf/trunk/build/FindAPR.cmake
      - copied, changed from r1834226, serf/trunk/build/FindApr.cmake
    serf/trunk/build/FindAPRUTIL.cmake
      - copied, changed from r1834226, serf/trunk/build/FindApu.cmake
    serf/trunk/build/SerfChecks.cmake
      - copied unchanged from r1834226, serf/trunk/build/feature.cmake
    serf/trunk/build/SerfVersion.cmake
      - copied unchanged from r1834226, serf/trunk/build/version.cmake
Removed:
    serf/trunk/build/FindApr.cmake
    serf/trunk/build/FindApu.cmake
    serf/trunk/build/feature.cmake
    serf/trunk/build/version.cmake
Modified:
    serf/trunk/CMakeLists.txt

Modified: serf/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/serf/trunk/CMakeLists.txt?rev=1834227&r1=1834226&r2=1834227&view=diff
==============================================================================
--- serf/trunk/CMakeLists.txt (original)
+++ serf/trunk/CMakeLists.txt Sat Jun 23 22:45:31 2018
@@ -20,8 +20,7 @@
 cmake_minimum_required(VERSION 3.0.2)
 
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build")
-include(version)
-include(feature)
+include(SerfVersion)
 
 project("Serf" VERSION ${SERF_VERSION} LANGUAGES C)
 message(WARNING
@@ -44,12 +43,13 @@ else(WINDOWS)
 endif(WINDOWS)
 
 
-find_package(openssl)
-find_package(zlib)
-find_package(apr)
-find_package(apu)
+find_package(OpenSSL)
+find_package(ZLib)
+find_package(APR)
+find_package(APRUtil)
 
 # Feature tests
+include(SerfChecks)
 CheckNotFunction("BIO_set_init" "SERF_NO_SSL_BIO_WRAPPERS" ${OPENSSL_LIBRARIES})
 CheckNotFunction("X509_STORE_get0_param" "SERF_NO_SSL_X509_STORE_WRAPPERS" ${OPENSSL_LIBRARIES})
 CheckNotFunction("X509_get0_notBefore" "SERF_NO_SSL_X509_GET0_NOTBEFORE" ${OPENSSL_LIBRARIES})
@@ -64,23 +64,23 @@ CheckFunction("SSL_set_alpn_protos" "SER
 CheckHeader("openssl/applink.c" "SERF_HAVE_OPENSSL_APPLINK_C" ${OPENSSL_INCLUDE_DIR})
 CheckType("OSSL_HANDSHAKE_STATE" "openssl/ssl.h" "SERF_HAVE_OSSL_HANDSHAKE_STATE" ${OPENSSL_INCLUDE_DIR})
 
-set(DEPENDENCY_INCLUDE_DIRS
+set(DEPENDENCY_INCLUDES
     ${OPENSSL_INCLUDE_DIR}
     ${ZLIB_INCLUDE_DIRS}
     ${APR_INCLUDES}
-    ${APU_INCLUDES}
+    ${APRUTIL_INCLUDES}
 )
-list(REMOVE_DUPLICATES DEPENDENCY_INCLUDE_DIRS)
+list(REMOVE_DUPLICATES DEPENDENCY_INCLUDES)
 
 set(DEPENDENCY_LIBRARIES
     ${OPENSSL_LIBRARIES}
     ${ZLIB_LIBRARIES}
-    ${APR_LIBS}
-    ${APU_LIBS}
+    ${APR_LIBRARIES}
+    ${APRUTIL_LIBRARIES}
 )
 list(REMOVE_DUPLICATES DEPENDENCY_LIBRARIES)
 
-include_directories(BEFORE SYSTEM ${DEPENDENCY_INCLUDE_DIRS})
+include_directories(BEFORE SYSTEM ${DEPENDENCY_INCLUDES})
 include_directories(${CMAKE_SOURCE_DIR})
 add_library(SerfStatic STATIC ${SOURCES})
 add_library(SerfShared SHARED ${SOURCES} ${SHARED_SOURCES})

Added: serf/trunk/build/APRCommon.cmake
URL: http://svn.apache.org/viewvc/serf/trunk/build/APRCommon.cmake?rev=1834227&view=auto
==============================================================================
--- serf/trunk/build/APRCommon.cmake (added)
+++ serf/trunk/build/APRCommon.cmake Sat Jun 23 22:45:31 2018
@@ -0,0 +1,48 @@
+# ===================================================================
+#   Licensed to the Apache Software Foundation (ASF) under one
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+# ===================================================================
+
+function(_apru_config _program _varname _separate _regexp)
+  execute_process(COMMAND ${_program} ${ARGN}
+                  OUTPUT_VARIABLE _apru_output
+                  RESULT_VARIABLE _apru_failed)
+
+  if(_apru_failed)
+    message(FATAL_ERROR "${_program} ${ARGN} failed")
+  else()
+
+    # Join multi-line outupt
+    string(REGEX REPLACE "[\r\n]"       ""  _apru_output "${_apru_output}")
+
+    # Optionally apply the regular expression filter
+    if(NOT ${_regexp} STREQUAL "")
+      string(REGEX REPLACE "${_regexp}" " " _apru_output "${_apru_output}")
+    endif()
+
+    # Remove leading and trailing spaces
+    string(REGEX REPLACE "^ +"          ""  _apru_output "${_apru_output}")
+    string(REGEX REPLACE " +$"          ""  _apru_output "${_apru_output}")
+
+    # Optionally split the result into an argument list
+    if(${_separate})
+      separate_arguments(_apru_output)
+    endif()
+
+    set(${_varname} "${_apru_output}" PARENT_SCOPE)
+  endif()
+endfunction(_apru_config)

Copied: serf/trunk/build/FindAPR.cmake (from r1834226, serf/trunk/build/FindApr.cmake)
URL: http://svn.apache.org/viewvc/serf/trunk/build/FindAPR.cmake?p2=serf/trunk/build/FindAPR.cmake&p1=serf/trunk/build/FindApr.cmake&r1=1834226&r2=1834227&rev=1834227&view=diff
==============================================================================
--- serf/trunk/build/FindApr.cmake (original)
+++ serf/trunk/build/FindAPR.cmake Sat Jun 23 22:45:31 2018
@@ -1,51 +1,61 @@
-# Source: http://svn.trolocsis.com/repos/projects/templates/apr/build/FindAPR.cmake
-# Locate APR include paths and libraries
+# ===================================================================
+#   Licensed to the Apache Software Foundation (ASF) under one
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+# ===================================================================
 
 # This module defines
 # APR_INCLUDES, where to find apr.h, etc.
-# APR_LIBS, linker switches to use with ld to link against APR
+# APR_LIBRARIES, linker switches to use with ld to link against APR
 # APR_EXTRALIBS, additional libraries to link against
 # APR_CFLAGS, the flags to use to compile
 # APR_FOUND, set to TRUE if found, FALSE otherwise
 # APR_VERSION, the version of APR that was found
+# APR_CONTAINS_APRUTIL, set to TRUE if the APR major version is 2 or greater.
 
 set(APR_FOUND FALSE)
 
-find_program(APR_CONFIG_EXECUTABLE apr-1-config)
+if(DEFINED APR_ROOT)
+  find_program(APR_CONFIG_EXECUTABLE NAMES apr-2-config apr-1-config
+               PATHS "${APR_ROOT}/bin" NO_DEFAULT_PATH)
+else()
+  find_program(APR_CONFIG_EXECUTABLE NAMES apr-2-config apr-1-config)
+endif()
 mark_as_advanced(APR_CONFIG_EXECUTABLE)
 
+include(APRCommon)
 macro(_apr_invoke _varname _separate _regexp)
-    execute_process(
-        COMMAND ${APR_CONFIG_EXECUTABLE} ${ARGN}
-        OUTPUT_VARIABLE _apr_output
-        RESULT_VARIABLE _apr_failed
-    )
-
-    if(_apr_failed)
-        message(FATAL_ERROR "${APR_CONFIG_EXECUTABLE} ${ARGN} failed")
-    else()
-        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")
-        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
-
-        if(NOT ${_regexp} STREQUAL "")
-            string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}")
-        endif()
-
-        # XXX: We don't want to invoke separate_arguments() for APR_CFLAGS;
-        # just leave as-is
-        if(${_separate})
-            separate_arguments(_apr_output)
-        endif()
-
-        set(${_varname} "${_apr_output}")
-    endif()
+  _apru_config("${APR_CONFIG_EXECUTABLE}" "${_varname}" "${_separate}" "${_regexp}" ${ARGN})
 endmacro(_apr_invoke)
 
-_apr_invoke(APR_CFLAGS    FALSE ""        --cppflags --cflags)
-_apr_invoke(APR_INCLUDES  TRUE  "(^| )-I" --includes)
-_apr_invoke(APR_LIBS      TRUE  ""        --link-ld)
-_apr_invoke(APR_EXTRALIBS TRUE  "(^| )-l" --libs)
-_apr_invoke(APR_VERSION   TRUE  ""        --version)
+_apr_invoke(APR_CFLAGS    FALSE "(^| )-(g|O)[^ ]*" --cppflags --cflags)
+_apr_invoke(APR_INCLUDES  TRUE  "(^| )-I"          --includes)
+_apr_invoke(APR_LIBRARIES TRUE  ""                 --link-ld)
+_apr_invoke(APR_EXTRALIBS TRUE  "(^| )-l"          --libs)
+_apr_invoke(APR_VERSION   TRUE  ""                 --version)
+
+string(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _apr_major "${APR_VERSION}")
+if(_apr_major GREATER 2)
+  set(APR_CONTAINS_APRUTIL TRUE)
+else()
+  set(APR_CONTAINS_APRUTIL FALSE)
+endif()
+unset(_apr_major)
 
 INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(APR DEFAULT_MSG APR_INCLUDES APR_LIBS APR_VERSION)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(APR
+                                  REQUIRED_VARS APR_LIBRARIES APR_INCLUDES
+                                  VERSION_VAR APR_VERSION)

Copied: serf/trunk/build/FindAPRUTIL.cmake (from r1834226, serf/trunk/build/FindApu.cmake)
URL: http://svn.apache.org/viewvc/serf/trunk/build/FindAPRUTIL.cmake?p2=serf/trunk/build/FindAPRUTIL.cmake&p1=serf/trunk/build/FindApu.cmake&r1=1834226&r2=1834227&rev=1834227&view=diff
==============================================================================
--- serf/trunk/build/FindApu.cmake (original)
+++ serf/trunk/build/FindAPRUTIL.cmake Sat Jun 23 22:45:31 2018
@@ -1,51 +1,68 @@
-# Locate apr-util include paths and libraries. Based on findapr.cmake;
-# simple modifications to apply to apr-util instead.
+# ===================================================================
+#   Licensed to the Apache Software Foundation (ASF) under one
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+# ===================================================================
 
 # This module defines
-# APU_INCLUDES, where to find apu.h, etc.
-# APU_LIBS, linker switches to use with ld to link against apr-util
-# APU_EXTRALIBS, additional libraries to link against
-# APU_LDFLAGS, additional linker flags that must be used
-# APU_FOUND, set to TRUE if found, FALSE otherwise
-# APU_VERSION, set to the version of apr-util found
-
-set(APU_FOUND FALSE)
-
-find_program(APU_CONFIG_EXECUTABLE apu-1-config)
-mark_as_advanced(APU_CONFIG_EXECUTABLE)
-
-macro(_apu_invoke _varname _separate _regexp)
-    execute_process(
-        COMMAND ${APU_CONFIG_EXECUTABLE} ${ARGN}
-        OUTPUT_VARIABLE _apu_output
-        RESULT_VARIABLE _apu_failed
-    )
-
-    if(_apu_failed)
-        message(FATAL_ERROR "${APU_CONFIG_EXECUTABLE} ${ARGN} failed")
-    else()
-        string(REGEX REPLACE "[\r\n]"  "" _apu_output "${_apu_output}")
-        string(REGEX REPLACE " +$"     "" _apu_output "${_apu_output}")
-
-        if(NOT ${_regexp} STREQUAL "")
-            string(REGEX REPLACE "${_regexp}" " " _apu_output "${_apu_output}")
-        endif()
-
-        # XXX: We don't want to invoke separate_arguments() for APU_LDFLAGS;
-        # just leave as-is
-        if(${_separate})
-            separate_arguments(_apu_output)
-        endif()
-
-        set(${_varname} "${_apu_output}")
-    endif()
-endmacro(_apu_invoke)
-
-_apu_invoke(APU_INCLUDES  TRUE  "(^| )-I" --includes)
-_apu_invoke(APU_EXTRALIBS TRUE  "(^| )-l" --libs)
-_apu_invoke(APU_LIBS      TRUE  ""        --link-ld)
-_apu_invoke(APU_LDFLAGS   FALSE ""        --ldflags)
-_apu_invoke(APU_VERSION   TRUE  ""        --version)
+# APRUTIL_INCLUDES, where to find apu.h, etc.
+# APRUTIL_LIBRARIES, linker switches to use with ld to link against apr-util
+# APRUTIL_EXTRALIBS, additional libraries to link against
+# APRUTIL_LDFLAGS, additional linker flags that must be used
+# APRUTIL_FOUND, set to TRUE if found, FALSE otherwise
+# APRUTIL_VERSION, set to the version of apr-util found
+
+if(NOT APR_FOUND)
+  find_package(APR)
+endif()
+
+if(APR_CONTAINS_APRUTIL)
+
+  set(APRUTIL_FOUND TRUE)
+  set(APRUTIL_INCLUDES ${APR_INCLUDES})
+  set(APRUTIL_LIBRARIES ${APR_LIBRARIES})
+  set(APRUTIL_EXTRALIBS ${APR_EXTRALIBS})
+  set(APRUTIL_VERSION ${APR_VERSION})
+
+else(APR_CONTAINS_APRUTIL)
+
+  set(APRUTIL_FOUND FALSE)
+
+  if(DEFINED APRUTIL_ROOT)
+    find_program(APRUTIL_CONFIG_EXECUTABLE apu-1-config
+                 PATHS "${APRUTIL_ROOT}/bin" NO_DEFAULT_PATH)
+  else()
+    find_program(APRUTIL_CONFIG_EXECUTABLE apu-1-config)
+  endif()
+  mark_as_advanced(APRUTIL_CONFIG_EXECUTABLE)
+
+  include(APRCommon)
+  macro(_apu_invoke _varname _separate _regexp)
+    _apru_config("${APRUTIL_CONFIG_EXECUTABLE}" "${_varname}" "${_separate}" "${_regexp}"
${ARGN})
+  endmacro(_apu_invoke)
+
+  _apu_invoke(APRUTIL_INCLUDES  TRUE  "(^| )-I" --includes)
+  _apu_invoke(APRUTIL_EXTRALIBS TRUE  "(^| )-l" --libs)
+  _apu_invoke(APRUTIL_LIBRARIES TRUE  ""        --link-ld)
+  _apu_invoke(APRUTIL_LDFLAGS   FALSE ""        --ldflags)
+  _apu_invoke(APRUTIL_VERSION   TRUE  ""        --version)
+
+  INCLUDE(FindPackageHandleStandardArgs)
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(APRUTIL
+                                    REQUIRED_VARS APRUTIL_LIBRARIES APRUTIL_INCLUDES
+                                    VERSION_VAR APRUTIL_VERSION)
 
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(APU DEFAULT_MSG APU_INCLUDES APU_LIBS APU_VERSION)
+endif(APR_CONTAINS_APRUTIL)



Mime
View raw message