#To make a solution file to navigate the APR-UTIL source code from the Visual Studio GUI: #copy d:\work\prep\apr-util\1.4.1\patch\*.* d:\work\apr-util-1.4.1 #cmake -G "Visual Studio 9 2008" -DCMAKE_INSTALL_PREFIX=d:\work\local d:\work\apr-util-1.4.1 project (apr-util) cmake_minimum_required(VERSION 2.8) #Find EXPAT find_package (EXPAT) #Find APR find_path (APR_INCLUDE_DIR apr/apr.h) if (NOT APR_INCLUDE_DIR) MESSAGE (FATAL_ERROR "Could not find Apache Portable Runtime (APR) header files") else () set (APR_INCLUDE_DIR ${APR_INCLUDE_DIR}/apr) MESSAGE (STATUS "Found Apache Portable Runtime in " ${APR_INCLUDE_DIR}) endif (NOT APR_INCLUDE_DIR) find_library (APR_LIBRARY apr-1) if (NOT APR_LIBRARY) MESSAGE (FATAL_ERROR "Could not find APR library") else () MESSAGE (STATUS "Found APR library " ${APR_LIBRARY}) endif (NOT APR_LIBRARY) #Find APR-ICONV find_library (APR_ICONV_LIBRARY apriconv-1) if (NOT APR_ICONV_LIBRARY) MESSAGE (FATAL_ERROR "Could not find APR_ICONV library") else () MESSAGE (STATUS "Found APR_ICONV library " ${APR_ICONV_LIBRARY}) endif (NOT APR_ICONV_LIBRARY) include_directories ( include include/private ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include/private ${EXPAT_INCLUDE_DIR} ${APR_INCLUDE_DIR} ) #Header files which form the public interface to the library. #They will be installed by "make install". set (PUBLIC_HEADER_FILES include/apr_anylock.h include/apr_base64.h include/apr_buckets.h include/apr_date.h include/apr_dbm.h include/apr_hooks.h include/apr_ldap_url.h include/apr_md4.h include/apr_md5.h include/apr_memcache.h include/apr_optional.h include/apr_optional_hooks.h include/apr_queue.h include/apr_reslist.h include/apr_rmm.h include/apr_sdbm.h include/apr_sha1.h include/apr_strmatch.h include/apr_thread_pool.h include/apr_uri.h include/apr_uuid.h include/apr_xlate.h include/apr_xml.h include/apu_version.h ) set (HEADER_FILES ${PUBLIC_HEADER_FILES} include/private/apr_crypto_internal.h include/private/apr_dbd_internal.h include/private/apr_dbd_odbc_v2.h include/private/apr_dbm_private.h include/private/apu_internal.h dbm/sdbm/sdbm_pair.h dbm/sdbm/sdbm_private.h dbm/sdbm/sdbm_tune.h ) set (SOURCE_FILES buckets/apr_brigade.c buckets/apr_buckets.c buckets/apr_buckets_alloc.c buckets/apr_buckets_eos.c buckets/apr_buckets_file.c buckets/apr_buckets_flush.c buckets/apr_buckets_heap.c buckets/apr_buckets_mmap.c buckets/apr_buckets_pipe.c buckets/apr_buckets_pool.c buckets/apr_buckets_refcount.c buckets/apr_buckets_simple.c buckets/apr_buckets_socket.c crypto/apr_crypto.c crypto/apr_md4.c crypto/apr_md5.c crypto/apr_sha1.c crypto/getuuid.c crypto/uuid.c dbd/apr_dbd.c dbd/apr_dbd_freetds.c dbd/apr_dbd_mysql.c dbd/apr_dbd_odbc.c dbd/apr_dbd_oracle.c dbd/apr_dbd_pgsql.c dbd/apr_dbd_sqlite2.c dbd/apr_dbd_sqlite3.c dbm/apr_dbm.c dbm/apr_dbm_berkeleydb.c dbm/apr_dbm_gdbm.c dbm/apr_dbm_sdbm.c encoding/apr_base64.c hooks/apr_hooks.c ldap/apr_ldap_init.c ldap/apr_ldap_option.c ldap/apr_ldap_rebind.c ldap/apr_ldap_stub.c ldap/apr_ldap_url.c memcache/apr_memcache.c misc/apr_date.c misc/apu_dso.c misc/apr_queue.c misc/apr_reslist.c misc/apr_rmm.c misc/apr_thread_pool.c misc/apu_version.c dbm/sdbm/sdbm.c dbm/sdbm/sdbm_hash.c dbm/sdbm/sdbm_lock.c dbm/sdbm/sdbm_pair.c strmatch/apr_strmatch.c uri/apr_uri.c xlate/xlate.c xml/apr_xml.c ) if (WIN32) add_definitions (-DHAVE_SQL_H) add_definitions (-DAPU_USE_SDBM) if (BUILD_SHARED_LIBS) add_definitions (-DAPU_DECLARE_EXPORT) else () add_definitions (-DAPU_DECLARE_STATIC) endif (BUILD_SHARED_LIBS) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/apr_ldap.hw ${CMAKE_CURRENT_BINARY_DIR}/include/apr_ldap.h COPYONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/apu.hw ${CMAKE_CURRENT_BINARY_DIR}/include/apu.h COPYONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/private/apu_config.hw ${CMAKE_CURRENT_BINARY_DIR}/include/private/apu_config.h COPYONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/private/apu_select_dbm.hw ${CMAKE_CURRENT_BINARY_DIR}/include/private/apu_select_dbm.h COPYONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/apu_want.hw ${CMAKE_CURRENT_BINARY_DIR}/include/apu_want.h COPYONLY) #Append the source files that are used only on Windows set (SOURCE_FILES ${SOURCE_FILES} libaprutil.rc ) endif (WIN32) add_library (aprutil-1 ${SOURCE_FILES} ${HEADER_FILES} ) if (WIN32) target_link_libraries (aprutil-1 ws2_32 mswsock odbc32 wldap32) endif (WIN32) target_link_libraries (aprutil-1 ${EXPAT_LIBRARY} ${APR_LIBRARY} ${APR_ICONV_LIBRARY} ) install (TARGETS aprutil-1 ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) install (FILES ${PUBLIC_HEADER_FILES} ${CMAKE_CURRENT_BINARY_DIR}/include/apu.h DESTINATION include/apr)