mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-30 14:39:00 +08:00
9614c6a962
* Allow the apr port to be used on non-windows systems * Allow the apr-util port to be used on non-windows systems * Allow the apr-util port to be used on non-windows systems * Allow the apr-util port to be used on non-windows systems * [log4cxx] add new port * Add aarch64 cross compilation support * Allow apr and apr-util ports to used with a cross compiling tool chain * @PhoebeHui requested changes * Remove files that leaked from 'add-log4cxx-port' branch * @PhoebeHui requested changes * Move apr-util-unix and apr-util-windows portfile.cmake content back into apr-util/portfile.cmake * Use the same released archive for unix and windows * Use the same released archive for unix and windows (1.6.1) * Update APR version to the latest * Prevent unrelated CI failures * Prevent CI failure for arm64 on x86 CI machine * Prevent CI failure for arm64 on x86 CI machine * Use vcpkg_configure_make and vcpkg_install_make instead of vcpkg_execute_required_process * Remove shared libraries if a static build * Revert "Remove shared libraries if a static build" This reverts commit 540e158e1fbfe53b889bef8b928bc8feb62775c2. * Prevent CI failures due to static build installing apr-1-config into bin * @PhoebeHui requested changes Co-authored-by: Stephen Webb <stephen.webb@sabreautonomous.com.au>
117 lines
5.8 KiB
Diff
117 lines
5.8 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 9ae90b19..b0e86e2c 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -29,8 +29,9 @@ 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.")
|
|
@@ -65,8 +66,8 @@ IF(NOT EXPAT_FOUND)
|
|
MESSAGE(FATAL_ERROR "Expat is required, and it wasn't found!")
|
|
ENDIF()
|
|
|
|
-SET(XMLLIB_INCLUDE_DIR ${EXPAT_INCLUDE_DIRS})
|
|
-SET(XMLLIB_LIBRARIES ${EXPAT_LIBRARIES})
|
|
+find_path(XMLLIB_INCLUDE_DIR expat.h)
|
|
+find_library(XMLLIB_LIBRARIES NAMES expat)
|
|
|
|
SET(LDAP_LIBRARIES)
|
|
IF(APR_HAS_LDAP)
|
|
@@ -229,17 +230,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 +254,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 +265,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 +276,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 +295,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 +331,15 @@ INSTALL(TARGETS ${install_targets}
|
|
ARCHIVE DESTINATION lib
|
|
)
|
|
|
|
-IF(INSTALL_PDB)
|
|
- INSTALL(FILES ${install_bin_pdb}
|
|
- DESTINATION bin
|
|
- CONFIGURATIONS RelWithDebInfo Debug)
|
|
-ENDIF()
|
|
+#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 "")
|