mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
[apr-util] use find_library
This commit is contained in:
parent
ad9b4b2ee1
commit
afbe116fb7
@ -1,5 +1,4 @@
|
||||
include(vcpkg_common_functions)
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/apr-util-1.6.0)
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://archive.apache.org/dist/apr/apr-util-1.6.0-win32-src.zip"
|
||||
@ -8,36 +7,31 @@ vcpkg_download_distfile(ARCHIVE
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
set(APR_HOME ${VCPKG_ROOT_DIR}/packages/apr_${TARGET_TRIPLET})
|
||||
set(EXPAT_HOME ${VCPKG_ROOT_DIR}/packages/expat_${TARGET_TRIPLET})
|
||||
set(EXPAT_LIB ${EXPAT_HOME}/lib/expat.lib)
|
||||
set(EXPAT_LIB_DEBUG ${EXPAT_HOME}/debug/lib/expat.lib)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(BUILD_SHARED_LIBRARY ON)
|
||||
else()
|
||||
set(BUILD_SHARED_LIBRARY OFF)
|
||||
endif()
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/use-vcpkg-expat.patch"
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/use-vcpkg-expat.patch"
|
||||
)
|
||||
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
-DAPR_HOME=${APR_HOME}
|
||||
-DEXPAT_LIB=${EXPAT_LIB}
|
||||
-DEXPAT_HOME=${EXPAT_HOME}
|
||||
-DBUILD_SHARED_LIBRARY=${BUILD_SHARED_LIBRARY}
|
||||
OPTIONS_DEBUG -DEXPAT_LIB=${EXPAT_LIB_DEBUG} -DDISABLE_INSTALL_HEADERS=ON
|
||||
PREFER_NINJA
|
||||
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/include/apu.h APU_H)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
string(REPLACE "defined(APU_DECLARE_EXPORT)" "1" APU_H "${APU_H}")
|
||||
else()
|
||||
string(REPLACE "defined(APU_DECLARE_STATIC)" "1" APU_H "${APU_H}")
|
||||
endif()
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/include/apu.h "${APU_H}")
|
||||
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/apr-util RENAME copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
@ -1,35 +1,31 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 43fdf49..8040552 100644
|
||||
index 43fdf49..56424c3 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -27,8 +27,13 @@ OPTION(APR_HAS_LDAP "LDAP support" ON)
|
||||
@@ -27,8 +27,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")
|
||||
+SET(APR_INCLUDE_DIR "${APR_HOME}/include" CACHE STRING "Directory with APR include files")
|
||||
+
|
||||
+if(BUILD_SHARED_LIBRARY)
|
||||
+ SET(APR_LIBRARIES "${APR_HOME}/lib/libapr-1.lib" CACHE STRING "APR library to link with")
|
||||
+else()
|
||||
+ SET(APR_LIBRARIES "${APR_HOME}/lib/apr-1.lib" CACHE STRING "APR library to link with")
|
||||
+endif()
|
||||
+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.")
|
||||
@@ -75,8 +80,8 @@ CONFIGURE_FILE(include/apu_want.hw
|
||||
@@ -75,8 +76,8 @@ CONFIGURE_FILE(include/apu_want.hw
|
||||
COPYONLY)
|
||||
|
||||
# TBD:
|
||||
-# SET(XMLLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xml/expat/lib)
|
||||
-SET(XMLLIB_LIBRARIES libexpat)
|
||||
+SET(XMLLIB_INCLUDE_DIR ${EXPAT_HOME}/include)
|
||||
+SET(XMLLIB_LIBRARIES ${EXPAT_LIB})
|
||||
+find_path(XMLLIB_INCLUDE_DIR expat.h)
|
||||
+find_library(XMLLIB_LIBRARIES NAMES expat)
|
||||
|
||||
SET(LDAP_LIBRARIES)
|
||||
IF(APR_HAS_LDAP)
|
||||
@@ -217,11 +222,11 @@ SET(APR_TEST_SOURCES
|
||||
@@ -217,11 +218,11 @@ SET(APR_TEST_SOURCES
|
||||
test/testxml.c
|
||||
)
|
||||
|
||||
@ -46,7 +42,7 @@ index 43fdf49..8040552 100644
|
||||
|
||||
SET(install_targets)
|
||||
SET(install_bin_pdb)
|
||||
@@ -230,21 +235,25 @@ SET(dbd_drivers)
|
||||
@@ -230,21 +231,25 @@ SET(dbd_drivers)
|
||||
# Note: The WINNT definition on some targets is used only by libaprutil.rc.
|
||||
|
||||
# static expat (not installed)
|
||||
@ -56,7 +52,7 @@ index 43fdf49..8040552 100644
|
||||
+# SET_TARGET_PROPERTIES(libexpat PROPERTIES COMPILE_DEFINITIONS "XML_STATIC;COMPILED_FROM_DSP")
|
||||
|
||||
# libaprutil-1 is shared, aprutil-1 is static
|
||||
+if(BUILD_SHARED_LIBRARY)
|
||||
+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)
|
||||
@ -70,11 +66,11 @@ index 43fdf49..8040552 100644
|
||||
SET_TARGET_PROPERTIES(aprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_STATIC;APR_DECLARE_STATIC;APU_DSO_MODULE_BUILD;XML_STATIC")
|
||||
+endif()
|
||||
|
||||
+if(BUILD_SHARED_LIBRARY)
|
||||
+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")
|
||||
@@ -270,7 +279,7 @@ IF(APU_HAVE_ODBC)
|
||||
@@ -270,7 +275,7 @@ IF(APU_HAVE_ODBC)
|
||||
ENDIF()
|
||||
|
||||
IF(APR_HAS_LDAP)
|
||||
@ -83,7 +79,7 @@ index 43fdf49..8040552 100644
|
||||
ldap/apr_ldap_rebind.c libaprutil.rc)
|
||||
SET(install_targets ${install_targets} apr_ldap-1)
|
||||
SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_ldap-1.pdb)
|
||||
@@ -281,6 +290,7 @@ IF(APR_HAS_LDAP)
|
||||
@@ -281,6 +286,7 @@ IF(APR_HAS_LDAP)
|
||||
ELSE()
|
||||
SET(apr_ldap_libraries)
|
||||
ENDIF()
|
||||
@ -91,7 +87,7 @@ index 43fdf49..8040552 100644
|
||||
|
||||
IF(APR_BUILD_TESTAPR)
|
||||
ENABLE_TESTING()
|
||||
@@ -288,13 +298,13 @@ IF(APR_BUILD_TESTAPR)
|
||||
@@ -288,13 +294,13 @@ IF(APR_BUILD_TESTAPR)
|
||||
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose)
|
||||
|
||||
# copy data files to build directory so that we can run programs from there
|
||||
@ -104,11 +100,11 @@ index 43fdf49..8040552 100644
|
||||
${PROJECT_BINARY_DIR}/data/billion-laughs.xml)
|
||||
|
||||
- IF(TEST_STATIC_LIBS)
|
||||
+ IF(NOT BUILD_SHARED_LIBRARY)
|
||||
+ IF(NOT BUILD_SHARED_LIBS)
|
||||
SET(whichapr aprutil-1)
|
||||
SET(apiflag "-DAPR_DECLARE_STATIC -DAPU_DECLARE_STATIC")
|
||||
ELSE()
|
||||
@@ -330,13 +340,15 @@ INSTALL(TARGETS ${install_targets}
|
||||
@@ -330,13 +336,15 @@ INSTALL(TARGETS ${install_targets}
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user