pineapple-src/externals/vcpkg/ports/apr-util/use-vcpkg-expat.patch

125 lines
6.1 KiB
Diff
Raw Normal View History

2022-07-23 01:01:36 +00:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ae90b1..71a50b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,16 +21,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
FIND_PACKAGE(OpenSSL)
-FIND_PACKAGE(expat)
-
OPTION(APU_HAVE_CRYPTO "Crypto support" OFF)
OPTION(APU_HAVE_ODBC "Build ODBC DBD driver" ON)
OPTION(APR_HAS_LDAP "LDAP support" ON)
OPTION(INSTALL_PDB "Install .pdb files (if generated)" ON)
OPTION(APR_BUILD_TESTAPR "Build the test suite" OFF)
OPTION(TEST_STATIC_LIBS "Test programs use APR static libraries instead of shared libraries?" OFF)
-SET(APR_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with APR include files")
-SET(APR_LIBRARIES "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib" CACHE STRING "APR library to link with")
+find_path(APR_INCLUDE_DIR apr.h)
+find_library(APR_LIBRARIES NAMES libapr-1 apr-1)
IF(NOT EXISTS "${APR_INCLUDE_DIR}/apr.h")
MESSAGE(FATAL_ERROR "APR include directory ${APR_INCLUDE_DIR} is not correct.")
@@ -61,13 +59,13 @@ IF(APR_HAS_LDAP)
SET(apr_has_ldap_10 1)
ENDIF()
-IF(NOT EXPAT_FOUND)
+find_package(expat)
+set(XMLLIB_INCLUDE_DIR ${EXPAT_INCLUDE_DIRS})
+set(XMLLIB_LIBRARIES ${EXPAT_LIBRARIES})
+IF(NOT XMLLIB_LIBRARIES)
MESSAGE(FATAL_ERROR "Expat is required, and it wasn't found!")
ENDIF()
-SET(XMLLIB_INCLUDE_DIR ${EXPAT_INCLUDE_DIRS})
-SET(XMLLIB_LIBRARIES ${EXPAT_LIBRARIES})
-
SET(LDAP_LIBRARIES)
IF(APR_HAS_LDAP)
SET(LDAP_LIBRARIES wldap32)
@@ -229,17 +227,21 @@ SET(dbd_drivers)
# Note: The WINNT definition on some targets is used only by libaprutil.rc.
# libaprutil-1 is shared, aprutil-1 is static
+if(BUILD_SHARED_LIBS)
ADD_LIBRARY(libaprutil-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libaprutil.rc)
SET(install_targets ${install_targets} libaprutil-1)
SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libaprutil-1.pdb)
TARGET_LINK_LIBRARIES(libaprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES})
-SET_TARGET_PROPERTIES(libaprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_EXPORT;APR_DECLARE_EXPORT;XML_STATIC;WINNT")
+SET_TARGET_PROPERTIES(libaprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_EXPORT;APR_DECLARE_IMPORT;XML_STATIC;WINNT")
+else(BUILD_SHARED_LIBS)
ADD_LIBRARY(aprutil-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED})
SET(install_targets ${install_targets} aprutil-1)
TARGET_LINK_LIBRARIES(aprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES})
SET_TARGET_PROPERTIES(aprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_STATIC;APR_DECLARE_STATIC;APU_DSO_MODULE_BUILD;XML_STATIC")
+endif(BUILD_SHARED_LIBS)
+if(BUILD_SHARED_LIBS)
IF(APU_HAVE_CRYPTO)
IF(NOT OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "Only OpenSSL-based crypto is currently implemented in the cmake build")
@@ -249,7 +251,7 @@ IF(APU_HAVE_CRYPTO)
SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_crypto_openssl-1.pdb)
SET_TARGET_PROPERTIES(apr_crypto_openssl-1 PROPERTIES INCLUDE_DIRECTORIES "${APR_INCLUDE_DIRECTORIES};${OPENSSL_INCLUDE_DIR}")
SET_TARGET_PROPERTIES(apr_crypto_openssl-1 PROPERTIES COMPILE_DEFINITIONS "WINNT")
- SET_TARGET_PROPERTIES(apr_crypto_openssl-1 PROPERTIES COMPILE_FLAGS "-DAPR_DECLARE_EXPORT=1 -DAPU_DECLARE_EXPORT=1 -DDLL_NAME=apr_crypto_openssl")
+ SET_TARGET_PROPERTIES(apr_crypto_openssl-1 PROPERTIES COMPILE_FLAGS "-DAPR_DECLARE_IMPORT -DAPU_DECLARE_IMPORT -DDLL_NAME=apr_crypto_openssl")
TARGET_LINK_LIBRARIES(apr_crypto_openssl-1 libaprutil-1 ${APR_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF()
@@ -260,8 +262,8 @@ IF(APU_HAVE_ODBC)
SET(dbd_drivers ${dbd_drivers} odbc)
TARGET_LINK_LIBRARIES(apr_dbd_odbc-1 libaprutil-1 ${APR_LIBRARIES} odbc32 odbccp32)
SET_PROPERTY(TARGET apr_dbd_odbc-1 APPEND PROPERTY LINK_FLAGS /export:apr_dbd_odbc_driver)
- SET_TARGET_PROPERTIES(apr_dbd_odbc-1 PROPERTIES COMPILE_DEFINITIONS "APU_HAVE_ODBC;HAVE_SQL_H;APU_DECLARE_EXPORT;APR_DECLARE_EXPORT;APU_DSO_MODULE_BUILD;WINNT")
- SET_TARGET_PROPERTIES(apr_dbd_odbc-1 PROPERTIES COMPILE_FLAGS "-DAPR_DECLARE_EXPORT=1 -DAPU_DECLARE_EXPORT=1 -DDLL_NAME=apr_dbd_odbc")
+ SET_TARGET_PROPERTIES(apr_dbd_odbc-1 PROPERTIES COMPILE_DEFINITIONS "APU_HAVE_ODBC;HAVE_SQL_H;APU_DECLARE_IMPORT;APR_DECLARE_IMPORT;APU_DSO_MODULE_BUILD;WINNT")
+ SET_TARGET_PROPERTIES(apr_dbd_odbc-1 PROPERTIES COMPILE_FLAGS "-DAPR_DECLARE_IMPORT -DAPU_DECLARE_IMPORT -DDLL_NAME=apr_dbd_odbc")
ENDIF()
IF(APR_HAS_LDAP)
@@ -271,11 +273,12 @@ IF(APR_HAS_LDAP)
SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_ldap-1.pdb)
TARGET_LINK_LIBRARIES(apr_ldap-1 libaprutil-1 ${APR_LIBRARIES} ${LDAP_LIBRARIES})
SET_TARGET_PROPERTIES(apr_ldap-1 PROPERTIES COMPILE_DEFINITIONS "WINNT")
- SET_TARGET_PROPERTIES(apr_ldap-1 PROPERTIES COMPILE_FLAGS "-DAPR_DECLARE_EXPORT=1 -DAPU_DECLARE_EXPORT=1 -DDLL_NAME=apr_ldap")
+ SET_TARGET_PROPERTIES(apr_ldap-1 PROPERTIES COMPILE_FLAGS "-DAPR_DECLARE_IMPORT -DAPU_DECLARE_IMPORT -DDLL_NAME=apr_ldap")
SET(apr_ldap_libraries apr_ldap-1)
ELSE()
SET(apr_ldap_libraries)
ENDIF()
+endif(BUILD_SHARED_LIBS)
IF(APR_BUILD_TESTAPR)
ENABLE_TESTING()
@@ -289,7 +292,7 @@ IF(APR_BUILD_TESTAPR)
${PROJECT_SOURCE_DIR}/test/data/billion-laughs.xml
${PROJECT_BINARY_DIR}/data/billion-laughs.xml)
- IF(TEST_STATIC_LIBS)
+ IF(NOT BUILD_SHARED_LIBS)
SET(whichapr aprutil-1)
SET(apiflag "-DAPR_DECLARE_STATIC -DAPU_DECLARE_STATIC")
ELSE()
@@ -325,13 +328,9 @@ INSTALL(TARGETS ${install_targets}
ARCHIVE DESTINATION lib
)
-IF(INSTALL_PDB)
- INSTALL(FILES ${install_bin_pdb}
- DESTINATION bin
- CONFIGURATIONS RelWithDebInfo Debug)
-ENDIF()
-
-INSTALL(FILES ${APR_PUBLIC_HEADERS_STATIC} ${APR_PUBLIC_HEADERS_GENERATED} DESTINATION include)
+if(NOT DISABLE_INSTALL_HEADERS)
+ INSTALL(FILES ${APR_PUBLIC_HEADERS_STATIC} ${APR_PUBLIC_HEADERS_GENERATED} DESTINATION include)
+endif()
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
MESSAGE(STATUS "")