Hi all,

For your consideration, three patches to trunk to fix the CMake build on Windows:

1) APR_DECLARE() the new apr_cstr API so it gets exported correctly.
2) Fix a "pmutex" variable name typo introduced in r1733775 as part of
   the apr_os_proc_mutex_* change.
3) Use CMake generator expressions to locate PDBs instead of assuming
   that they are always built in the top-level binary directory. Multi-
   configuration generators (like Visual Studio) put the PDBs into
   different subdirectories depending on the build type.

--Jacob
>From 47994dfff882c2957f8dc4b90b3f79e8649a798c Mon Sep 17 00:00:00 2001
From: Jacob Champion <champio...@gmail.com>
Date: Wed, 25 May 2016 10:47:50 -0700
Subject: [PATCH 1/3] APR_DECLARE the new apr_cstr_ API

This is required to export the new functions on (e.g.) Windows.
---
 include/apr_cstr.h | 67 +++++++++++++++++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 29 deletions(-)

diff --git a/include/apr_cstr.h b/include/apr_cstr.h
index a583ae1..a47becc 100644
--- a/include/apr_cstr.h
+++ b/include/apr_cstr.h
@@ -78,10 +78,10 @@ extern "C" {
  *
  * @since New in 1.6
  */
-apr_array_header_t * apr_cstr_split(const char *input,
-                                    const char *sep_chars,
-                                    int chop_whitespace,
-                                    apr_pool_t *pool);
+APR_DECLARE(apr_array_header_t *) apr_cstr_split(const char *input,
+                                                 const char *sep_chars,
+                                                 int chop_whitespace,
+                                                 apr_pool_t *pool);
 
 /** Like apr_cstr_split(), but append to existing @a array instead of
  * creating a new one.  Allocate the copied substrings in @a pool
@@ -89,11 +89,11 @@ apr_array_header_t * apr_cstr_split(const char *input,
  *
  * @since New in 1.6
  */
-void apr_cstr_split_append(apr_array_header_t *array,
-                           const char *input,
-                           const char *sep_chars,
-                           int chop_whitespace,
-                           apr_pool_t *pool);
+APR_DECLARE(void) apr_cstr_split_append(apr_array_header_t *array,
+                                        const char *input,
+                                        const char *sep_chars,
+                                        int chop_whitespace,
+                                        apr_pool_t *pool);
 
 
 /** Return @c TRUE iff @a str matches any of the elements of @a list, a list
@@ -101,13 +101,15 @@ void apr_cstr_split_append(apr_array_header_t *array,
  *
  * @since New in 1.6
  */
-int apr_cstr_match_glob_list(const char *str, const apr_array_header_t *list);
+APR_DECLARE(int) apr_cstr_match_glob_list(const char *str,
+                                          const apr_array_header_t *list);
 
 /** Return @c TRUE iff @a str exactly matches any of the elements of @a list.
  *
  * @since New in 1.6
  */
-int apr_cstr_match_list(const char *str, const apr_array_header_t *list);
+APR_DECLARE(int) apr_cstr_match_list(const char *str,
+                                     const apr_array_header_t *list);
 
 /**
  * Get the next token from @a *str interpreting any char from @a sep as a
@@ -120,7 +122,7 @@ int apr_cstr_match_list(const char *str, const apr_array_header_t *list);
  *
  * @since New in 1.6.
  */
-char * apr_cstr_tokenize(const char *sep, char **str);
+APR_DECLARE(char *) apr_cstr_tokenize(const char *sep, char **str);
 
 /**
  * Return the number of line breaks in @a msg, allowing any kind of newline
@@ -128,7 +130,7 @@ char * apr_cstr_tokenize(const char *sep, char **str);
  *
  * @since New in 1.6.
  */
-int apr_cstr_count_newlines(const char *msg);
+APR_DECLARE(int) apr_cstr_count_newlines(const char *msg);
 
 #if 0 /* XXX: stringbuf logic is not present in APR */
 /**
@@ -139,9 +141,9 @@ int apr_cstr_count_newlines(const char *msg);
  *
  * @since New in 1.6.
  */
-char * apr_cstr_join(const apr_array_header_t *strings,
-                     const char *separator,
-                     apr_pool_t *pool);
+APR_DECLARE(char *) apr_cstr_join(const apr_array_header_t *strings,
+                                  const char *separator,
+                                  apr_pool_t *pool);
 #endif
 
 /**
@@ -156,7 +158,7 @@ char * apr_cstr_join(const apr_array_header_t *strings,
  *
  * @since New in 1.6.
  */
-int apr_cstr_casecmp(const char *str1, const char *str2);
+APR_DECLARE(int) apr_cstr_casecmp(const char *str1, const char *str2);
 
 /**
  * Perform a case-insensitive comparison of two strings @a atr1 and @a atr2,
@@ -170,7 +172,9 @@ int apr_cstr_casecmp(const char *str1, const char *str2);
  *
  * @since New in 1.6.
  */
-int apr_cstr_casecmpn(const char *str1, const char *str2, apr_size_t n);
+APR_DECLARE(int) apr_cstr_casecmpn(const char *str1,
+                                   const char *str2,
+                                   apr_size_t n);
 
 /**
  * Parse the C string @a str into a 64 bit number, and return it in @a *n.
@@ -191,9 +195,11 @@ int apr_cstr_casecmpn(const char *str1, const char *str2, apr_size_t n);
  *
  * @since New in 1.6.
  */
-apr_status_t apr_cstr_strtoi64(apr_int64_t *n, const char *str,
-                               apr_int64_t minval, apr_int64_t maxval,
-                               int base);
+APR_DECLARE(apr_status_t) apr_cstr_strtoi64(apr_int64_t *n,
+                                            const char *str,
+                                            apr_int64_t minval,
+                                            apr_int64_t maxval,
+                                            int base);
 
 /**
  * Parse the C string @a str into a 64 bit number, and return it in @a *n.
@@ -204,7 +210,7 @@ apr_status_t apr_cstr_strtoi64(apr_int64_t *n, const char *str,
  *
  * @since New in 1.6.
  */
-apr_status_t apr_cstr_atoi64(apr_int64_t *n, const char *str);
+APR_DECLARE(apr_status_t) apr_cstr_atoi64(apr_int64_t *n, const char *str);
 
 /**
  * Parse the C string @a str into a 32 bit number, and return it in @a *n.
@@ -215,7 +221,7 @@ apr_status_t apr_cstr_atoi64(apr_int64_t *n, const char *str);
  *
  * @since New in 1.6.
  */
-apr_status_t apr_cstr_atoi(int *n, const char *str);
+APR_DECLARE(apr_status_t) apr_cstr_atoi(int *n, const char *str);
 
 /**
  * Parse the C string @a str into an unsigned 64 bit number, and return
@@ -239,9 +245,11 @@ apr_status_t apr_cstr_atoi(int *n, const char *str);
  *
  * @since New in 1.6.
  */
-apr_status_t apr_cstr_strtoui64(apr_uint64_t *n, const char *str,
-                                apr_uint64_t minval, apr_uint64_t maxval,
-                                int base);
+APR_DECLARE(apr_status_t) apr_cstr_strtoui64(apr_uint64_t *n,
+                                             const char *str,
+                                             apr_uint64_t minval,
+                                             apr_uint64_t maxval,
+                                             int base);
 
 /**
  * Parse the C string @a str into an unsigned 64 bit number, and return
@@ -253,7 +261,7 @@ apr_status_t apr_cstr_strtoui64(apr_uint64_t *n, const char *str,
  *
  * @since New in 1.6.
  */
-apr_status_t apr_cstr_atoui64(apr_uint64_t *n, const char *str);
+APR_DECLARE(apr_status_t) apr_cstr_atoui64(apr_uint64_t *n, const char *str);
 
 /**
  * Parse the C string @a str into an unsigned 32 bit number, and return
@@ -265,7 +273,7 @@ apr_status_t apr_cstr_atoui64(apr_uint64_t *n, const char *str);
  *
  * @since New in 1.6.
  */
-apr_status_t apr_cstr_atoui(unsigned int *n, const char *str);
+APR_DECLARE(apr_status_t) apr_cstr_atoui(unsigned int *n, const char *str);
 
 /**
  * Skip the common prefix @a prefix from the C string @a str, and return
@@ -274,7 +282,8 @@ apr_status_t apr_cstr_atoui(unsigned int *n, const char *str);
  *
  * @since New in 1.6.
  */
-const char * apr_cstr_skip_prefix(const char *str, const char *prefix);
+APR_DECLARE(const char *) apr_cstr_skip_prefix(const char *str,
+                                               const char *prefix);
 
 /** @} */
 
-- 
2.7.4

>From 3976c3e244d78f1f7e671c89b134d4e76ef4191b Mon Sep 17 00:00:00 2001
From: Jacob Champion <champio...@gmail.com>
Date: Wed, 25 May 2016 10:48:54 -0700
Subject: [PATCH 2/3] Fix mutex/pmutex typo for Windows

---
 locks/win32/proc_mutex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/locks/win32/proc_mutex.c b/locks/win32/proc_mutex.c
index 9e227f7..b51f856 100644
--- a/locks/win32/proc_mutex.c
+++ b/locks/win32/proc_mutex.c
@@ -249,7 +249,7 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get_ex(apr_os_proc_mutex_t *ospmutex
                                                    apr_proc_mutex_t *pmutex,
                                                    apr_lockmech_e *mech)
 {
-    *ospmutex = mutex->handle;
+    *ospmutex = pmutex->handle;
     if (mech) {
         *mech = APR_LOCK_DEFAULT_TIMED;
     }
-- 
2.7.4

>From fc1c5ccd7a5e6b7865fa60426a1fc8b8d6f0ce42 Mon Sep 17 00:00:00 2001
From: Jacob Champion <champio...@gmail.com>
Date: Wed, 25 May 2016 12:09:12 -0700
Subject: [PATCH 3/3] cmake: use generator expressions to find PDBs

PDBs are not guaranteed to be placed in the top-level binary directory.
Use the TARGET_PDB_FILE generator expression to find the correct
location.
---
 CMakeLists.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07e93ee..bb284ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -420,7 +420,7 @@ SET(dbd_drivers)
 # libapr-2 is shared, apr-2 is static
 ADD_LIBRARY(libapr-2 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libapr.rc)
 SET(install_targets ${install_targets} libapr-2)
-SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libapr-2.pdb)
+SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:libapr-2>)
 TARGET_LINK_LIBRARIES(libapr-2 ${XMLLIB_LIBRARIES} ${APR_SYSTEM_LIBS})
 SET_TARGET_PROPERTIES(libapr-2 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_EXPORT;APR_HAVE_MODULAR_DSO")
 ADD_DEPENDENCIES(libapr-2 test_char_header)
@@ -447,7 +447,7 @@ IF(APU_HAVE_CRYPTO)
   ENDIF()
   ADD_LIBRARY(apr_crypto_openssl-2 SHARED crypto/apr_crypto_openssl.c libapr.rc)
   SET(install_targets ${install_targets} apr_crypto_openssl-2)
-  SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_crypto_openssl-2.pdb)
+  SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:apr_crypto_openssl-2>)
   SET_TARGET_PROPERTIES(apr_crypto_openssl-2 PROPERTIES INCLUDE_DIRECTORIES "${APR_INCLUDE_DIRECTORIES};${OPENSSL_INCLUDE_DIR}")
   SET_TARGET_PROPERTIES(apr_crypto_openssl-2 PROPERTIES COMPILE_FLAGS "-DDLL_NAME=apr_crypto_openssl")
   TARGET_LINK_LIBRARIES(apr_crypto_openssl-2 libapr-2 ${APR_SYSTEM_LIBS} ${OPENSSL_LIBRARIES})
@@ -456,7 +456,7 @@ ENDIF()
 IF(APU_HAVE_ODBC)
   ADD_LIBRARY(apr_dbd_odbc-2 SHARED dbd/apr_dbd_odbc.c libapr.rc)
   SET(install_targets ${install_targets} apr_dbd_odbc-2)
-  SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_dbd_odbc-2.pdb)
+  SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:apr_dbd_odbc-2>)
   SET(dbd_drivers ${dbd_drivers} odbc)
   TARGET_LINK_LIBRARIES(apr_dbd_odbc-2 libapr-2 ${APR_SYSTEM_LIBS} odbc32 odbccp32)
   SET_PROPERTY(TARGET apr_dbd_odbc-2 APPEND PROPERTY LINK_FLAGS /export:apr_dbd_odbc_driver)
-- 
2.7.4

Reply via email to