From 82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 11 Jul 2018 16:43:34 -0400 Subject: FindXercesC: Search for version-named library files Use the version number extracted from the header file to construct versioned library names. This approach is already used by `FindXalanC`. Signed-off-by: Raul Metsma --- Modules/FindXercesC.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 51e68d5..267c164 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -59,6 +59,9 @@ function(_XercesC_GET_VERSION version_hdr) endif() set(XercesC_VERSION "${XercesC_MAJOR}.${XercesC_MINOR}.${XercesC_PATCH}" PARENT_SCOPE) + set(XercesC_VERSION_MAJOR "${XercesC_MAJOR}" PARENT_SCOPE) + set(XercesC_VERSION_MINOR "${XercesC_MINOR}" PARENT_SCOPE) + set(XercesC_VERSION_PATCH "${XercesC_PATCH}" PARENT_SCOPE) else() message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") endif() @@ -73,16 +76,20 @@ mark_as_advanced(XercesC_INCLUDE_DIR) if(NOT XercesC_LIBRARY) # Find all XercesC libraries find_library(XercesC_LIBRARY_RELEASE - NAMES "xerces-c" "xerces-c_3" + NAMES "xerces-c" "xerces-c_${XercesC_VERSION_MAJOR}" DOC "Xerces-C++ libraries (release)") find_library(XercesC_LIBRARY_DEBUG - NAMES "xerces-cd" "xerces-c_3D" "xerces-c_3_1D" + NAMES "xerces-cd" "xerces-c_${XercesC_VERSION_MAJOR}D" "xerces-c_${XercesC_VERSION_MAJOR}_${XercesC_VERSION_MINOR}D" DOC "Xerces-C++ libraries (debug)") include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(XercesC) mark_as_advanced(XercesC_LIBRARY_RELEASE XercesC_LIBRARY_DEBUG) endif() +unset(XercesC_VERSION_MAJOR) +unset(XercesC_VERSION_MINOR) +unset(XercesC_VERSION_PATCH) + if(XercesC_INCLUDE_DIR) _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") endif() -- cgit v0.12