Author: brane
Date: Thu Jun 28 09:01:14 2018
New Revision: 1834584

URL: http://svn.apache.org/viewvc?rev=1834584&view=rev
Log:
CMake build: Find APR/Util runtime libraries (DLLs) on Windows and prepare
to do the same with other dependencies.

* CMakeLists.txt: Prepare for post-processing OpenSSL and ZLIB on Windows.
* build/FindAPR.cmake, build/FindAPRUtil.cmake: Find the DLLs if they are
   present in the APR/Util root directories.
* build/APRCommon.cmake (_apru_find_dll): New utility function.
* build/SerfWindowsToolkit.cmake: New file.

Added:
    serf/trunk/build/SerfWindowsToolkit.cmake   (with props)
Modified:
    serf/trunk/CMakeLists.txt
    serf/trunk/build/APRCommon.cmake
    serf/trunk/build/FindAPR.cmake
    serf/trunk/build/FindAPRUtil.cmake

Modified: serf/trunk/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/serf/trunk/CMakeLists.txt?rev=1834584&r1=1834583&r2=1834584&view=diff
==============================================================================
--- serf/trunk/CMakeLists.txt (original)
+++ serf/trunk/CMakeLists.txt Thu Jun 28 09:01:14 2018
@@ -26,9 +26,11 @@ message(WARNING
         "Serf's CMake build is considered EXPERIMENTAL. "
         "Some features are not supported and the build "
         "has not been tested on many supported platforms.")
-include(SerfPlatform)
 enable_testing()
 
+include(SerfPlatform)
+include(SerfWindowsToolkit)
+
 
 # Build options
 option(LIBDIR "Indstall directory for architecture-dependent libraries" OFF)
@@ -148,6 +150,13 @@ find_package(ZLIB)
 find_package(APR)
 find_package(APRUtil)
 
+if(SERF_WINDOWS)
+  # Find ZLIB and OpenSSL runtime libraries etc.
+  SerfWindowsProcessOpenSSL()
+  SerfWindowsProcessZLIB()
+endif()
+
+
 set(DEPENDENCY_INCLUDES
     ${OPENSSL_INCLUDE_DIR}
     ${ZLIB_INCLUDE_DIRS}

Modified: serf/trunk/build/APRCommon.cmake
URL: 
http://svn.apache.org/viewvc/serf/trunk/build/APRCommon.cmake?rev=1834584&r1=1834583&r2=1834584&view=diff
==============================================================================
--- serf/trunk/build/APRCommon.cmake (original)
+++ serf/trunk/build/APRCommon.cmake Thu Jun 28 09:01:14 2018
@@ -59,4 +59,10 @@ function(_apru_version _version_varname
   string(REGEX REPLACE "^[^0-9]+([0-9]+).*$" "\\1" _apru_patch ${_apru_patch})
   set(${_version_varname} "${_apru_major}.${_apru_minor}.${_apru_patch}" 
PARENT_SCOPE)
   set(${_major_varname} ${_apru_major} PARENT_SCOPE)
-endfunction()
+endfunction(_apru_version)
+
+function(_apru_find_dll _varname _dllname)
+  set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
+  find_library(${_varname} NAMES ${_dllname}
+               PATHS ${ARGN} NO_DEFAULT_PATH PATH_SUFFIXES "bin" "lib")
+endfunction(_apru_find_dll)

Modified: serf/trunk/build/FindAPR.cmake
URL: 
http://svn.apache.org/viewvc/serf/trunk/build/FindAPR.cmake?rev=1834584&r1=1834583&r2=1834584&view=diff
==============================================================================
--- serf/trunk/build/FindAPR.cmake (original)
+++ serf/trunk/build/FindAPR.cmake Thu Jun 28 09:01:14 2018
@@ -25,8 +25,8 @@
 # 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_DLLS, on Windows: list of DLLs that will be loaded at runtime.
-# APR_STATICLIBS, on Windows: list of static libraries.
+# APR_STATIC_LIBS, on Windows: list of static libraries.
+# APR_RUNTIME_LIBS, on Windows: list of DLLs that will be loaded at runtime.
 
 
 set(APR_FOUND FALSE)
@@ -49,13 +49,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows
   endif()
 
   _apru_version(APR_VERSION _apr_major "${APR_INCLUDES}/apr_version.h" "APR")
+  set(_apr_name "apr-${_apr_major}")
 
-  find_library(APR_LIBRARIES NAMES "libapr-${_apr_major}.lib"
+  find_library(APR_LIBRARIES NAMES "lib${_apr_name}.lib"
                PATHS ${APR_ROOT} NO_DEFAULT_PATH PATH_SUFFIXES "lib")
-  find_library(APR_STATICLIBS NAMES "apr-${_apr_major}.lib"
+  find_library(APR_STATIC_LIBS NAMES "${_apr_name}.lib"
                PATHS ${APR_ROOT} NO_DEFAULT_PATH PATH_SUFFIXES "lib")
-  find_library(APR_DLLS NAMES "libapr-${_apr_major}.dll"
-               PATHS ${APR_ROOT} NO_DEFAULT_PATH PATH_SUFFIXES "bin")
+  _apru_find_dll(APR_RUNTIME_LIBS "lib${_apr_name}.dll" ${APR_ROOT})
 
 else()    #NOT Windows
 

Modified: serf/trunk/build/FindAPRUtil.cmake
URL: 
http://svn.apache.org/viewvc/serf/trunk/build/FindAPRUtil.cmake?rev=1834584&r1=1834583&r2=1834584&view=diff
==============================================================================
--- serf/trunk/build/FindAPRUtil.cmake (original)
+++ serf/trunk/build/FindAPRUtil.cmake Thu Jun 28 09:01:14 2018
@@ -23,8 +23,8 @@
 # APRUTIL_INCLUDES, where to find apr.h, etc.
 # APRUTIL_LIBRARIES, linker switches to use with ld to link against APR
 # APRUTIL_EXTRALIBS, additional libraries to link against.
-# APRUTIL_DLLS, on Windows: list of DLLs that will be loaded at runtime.
-# APRUTIL_STATICLIBS, on Windows: list of static libraries.
+# APRUTIL_STATIC_LIBS, on Windows: list of static libraries.
+# APRUTIL_RUNTIME_LIBS, on Windows: list of DLLs that will be loaded at 
runtime.
 
 
 if(NOT APR_FOUND)
@@ -36,6 +36,11 @@ if(APR_CONTAINS_APRUTIL)
   set(APRUTIL_FOUND TRUE)
   set(APRUTIL_VERSION ${APR_VERSION})
 
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(APRUTIL
+                                    REQUIRED_VARS APRUTIL_VERSION
+                                    VERSION_VAR APRUTIL_VERSION)
+
 else(APR_CONTAINS_APRUTIL)
 
   set(APRUTIL_FOUND FALSE)
@@ -58,13 +63,13 @@ else(APR_CONTAINS_APRUTIL)
     endif()
 
     _apru_version(APRUTIL_VERSION _apu_major 
"${APRUTIL_INCLUDES}/apu_version.h" "APU")
+    set(_apu_name "aprutil-${_apu_major}")
 
-    find_library(APRUTIL_LIBRARIES NAMES "libaprutil-${_apu_major}.lib"
+    find_library(APRUTIL_LIBRARIES NAMES "lib${_apu_name}.lib"
                  PATHS ${APRUTIL_ROOT} NO_DEFAULT_PATH PATH_SUFFIXES "lib")
-    find_library(APRUTIL_STATICLIBS NAMES "aprutil-${_apu_major}.lib"
+    find_library(APRUTIL_STATIC_LIBS NAMES "${_apu_name}.lib"
                  PATHS ${APRUTIL_ROOT} NO_DEFAULT_PATH PATH_SUFFIXES "lib")
-    find_library(APRUTIL_DLLS NAMES "libaprutil-${_apu_major}.dll"
-                 PATHS ${APRUTIL_ROOT} NO_DEFAULT_PATH PATH_SUFFIXES "bin")
+    _apru_find_dll(APRUTIL_RUNTIME_LIBS "lib${_apu_name}.dll" ${APRUTIL_ROOT})
 
   else()    # NOT Windows
 

Added: serf/trunk/build/SerfWindowsToolkit.cmake
URL: 
http://svn.apache.org/viewvc/serf/trunk/build/SerfWindowsToolkit.cmake?rev=1834584&view=auto
==============================================================================
--- serf/trunk/build/SerfWindowsToolkit.cmake (added)
+++ serf/trunk/build/SerfWindowsToolkit.cmake Thu Jun 28 09:01:14 2018
@@ -0,0 +1,35 @@
+#   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 function defines:
+# SERF_OPENSSL_STATIC, if we're linking with a static libraries.
+# SERF_OPENSSL_EXTRA_LIBS, if we need additional libraries to link.
+# SERF_OPENSSL_RUNTIME_LIBS, when it finds OpenSSL DLL libraries.
+function(SerfWindowsProcessOpenSSL)
+  if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+  endif()
+endfunction(SerfWindowsProcessOpenSSL)
+
+# This function defines:
+# SERF_ZLIB_STATIC, if we're linking with a static libraries.
+# SERF_ZLIB_EXTRA_LIBS, if we need additional libraries to link.
+# SERF_ZLIB_RUNTIME_LIBS, when it finds OpenSSL DLL libraries.
+function(SerfWindowsProcessZLIB)
+  if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+  endif()
+endfunction(SerfWindowsProcessZLIB)

Propchange: serf/trunk/build/SerfWindowsToolkit.cmake
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to