Core/Build: Force minimum ACE (5.8.3) and OpenSSL (1.0.0) version detection

Core/Build: Do not ignore command line cmake options: ACE_INCLUDE_DIR, ACE_LIBRARY and OPENSSL_INCLUDE_DIR
This commit is contained in:
Spp
2013-08-28 15:44:06 +02:00
parent 7135abf3a0
commit 3e2e210890
3 changed files with 112 additions and 43 deletions

View File

@@ -48,6 +48,9 @@ endif()
include(CheckPlatform)
# basic packagesearching and setup (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0)
set(ACE_EXPECTED_VERSION 5.8.3)
find_package(PCHSupport)
find_package(ACE REQUIRED)
find_package(OpenSSL REQUIRED)

View File

@@ -1,6 +1,6 @@
#
# Find the ACE client includes and library
#
#
# This module defines
# ACE_INCLUDE_DIR, where to find ace.h
@@ -13,47 +13,66 @@
set( ACE_FOUND 0 )
if ( UNIX )
FIND_PATH( ACE_INCLUDE_DIR
NAMES
ace/ACE.h
PATHS
/usr/include
/usr/include/ace
/usr/local/include
/usr/local/include/ace
$ENV{ACE_ROOT}
$ENV{ACE_ROOT}/include
${CMAKE_SOURCE_DIR}/externals/ace
DOC
"Specify include-directories that might contain ace.h here."
)
FIND_LIBRARY( ACE_LIBRARY
NAMES
ace ACE
PATHS
/usr/lib
/usr/lib/ace
/usr/local/lib
/usr/local/lib/ace
/usr/local/ace/lib
$ENV{ACE_ROOT}/lib
$ENV{ACE_ROOT}
DOC "Specify library-locations that might contain the ACE library here."
)
if (NOT ACE_INCLUDE_DIR)
FIND_PATH( ACE_INCLUDE_DIR
NAMES
ace/ACE.h
PATHS
/usr/include
/usr/include/ace
/usr/local/include
/usr/local/include/ace
$ENV{ACE_ROOT}
$ENV{ACE_ROOT}/ace
$ENV{ACE_ROOT}/include
${CMAKE_SOURCE_DIR}/externals/ace
DOC
"Specify include-directories that might contain ace.h here."
)
endif()
# FIND_LIBRARY( ACE_EXTRA_LIBRARIES
# NAMES
# z zlib
# PATHS
# /usr/lib
# /usr/local/lib
# DOC
# "if more libraries are necessary to link into ACE, specify them here."
# )
if (NOT ACE_LIBRARY)
FIND_LIBRARY( ACE_LIBRARY
NAMES
ace ACE
PATHS
/usr/lib
/usr/lib/ace
/usr/local/lib
/usr/local/lib/ace
/usr/local/ace/lib
$ENV{ACE_ROOT}/lib
$ENV{ACE_ROOT}
DOC "Specify library-locations that might contain the ACE library here."
)
# FIND_LIBRARY( ACE_EXTRA_LIBRARIES
# NAMES
# z zlib
# PATHS
# /usr/lib
# /usr/local/lib
# DOC
# "if more libraries are necessary to link into ACE, specify them here."
# )
endif()
if ( ACE_LIBRARY )
if ( ACE_INCLUDE_DIR )
set( ACE_FOUND 1 )
if (_ACE_VERSION)
set(ACE_VERSION "${_ACE_VERSION}")
else (_ACE_VERSION)
file(STRINGS "${ACE_INCLUDE_DIR}/ace/Version.h" ACE_VERSION_STR REGEX "^#define ACE_VERSION \".*\"")
string(REGEX REPLACE "^.*ACE_VERSION \"([0-9].[0-9].[0-9a-z]).*$"
"\\1" ACE_VERSION "${ACE_VERSION_STR}")
endif (_ACE_VERSION)
include(EnsureVersion)
ENSURE_VERSION( "${ACE_EXPECTED_VERSION}" "${ACE_VERSION}" ACE_FOUND)
if (NOT ACE_FOUND)
message(FATAL_ERROR "TrinityCore needs ACE version ${ACE_EXPECTED_VERSION} but found version ${ACE_VERSION}")
endif()
message( STATUS "Found ACE library: ${ACE_LIBRARY}")
message( STATUS "Found ACE headers: ${ACE_INCLUDE_DIR}")
else ( ACE_INCLUDE_DIR )

View File

@@ -171,10 +171,57 @@ ELSE(WIN32 AND NOT CYGWIN)
ENDIF(WIN32 AND NOT CYGWIN)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenSSL DEFAULT_MSG
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
)
if (NOT OPENSSL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenSSL DEFAULT_MSG
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
)
endif()
if (OPENSSL_INCLUDE_DIR)
message( STATUS "Found OpenSSL library: ${OPENSSL_LIBRARIES}")
message( STATUS "Found OpenSSL headers: ${OPENSSL_INCLUDE_DIR}")
if (_OPENSSL_VERSION)
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
else (_OPENSSL_VERSION)
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
# Major, minor, and fix directly translate into the version numbers shown in
# the string. The patch field translates to the single character suffix that
# indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
# on.
string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]).*$"
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_MINOR "${OPENSSL_VERSION_MINOR}")
string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_FIX "${OPENSSL_VERSION_FIX}")
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
# 96 is the ASCII code of 'a' minus 1
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${OPENSSL_VERSION_PATCH} + 96")
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
# this should be updated to handle that, too. This has not happened yet
# so it is simply ignored here for now.
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
endif (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
endif (_OPENSSL_VERSION)
include(EnsureVersion)
ENSURE_VERSION( "${OPENSSL_EXPECTED_VERSION}" "${OPENSSL_VERSION}" OPENSSL_VERSION_OK)
if (NOT OPENSSL_VERSION_OK)
message(FATAL_ERROR "TrinityCore needs OpenSSL version ${OPENSSL_EXPECTED_VERSION} but found version ${OPENSSL_VERSION}")
endif()
endif (OPENSSL_INCLUDE_DIR)
MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)