summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaul Metsma <raul@metsma.ee>2018-07-11 20:43:34 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-13 13:01:47 (GMT)
commit82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2 (patch)
tree027c7c99c48f679beb338f82962d74013c1eada8 /Modules
parentf2c651aec9782e5913db7ad21b88d2dcde5c359d (diff)
downloadCMake-82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2.zip
CMake-82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2.tar.gz
CMake-82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2.tar.bz2
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 <raul@metsma.ee>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindXercesC.cmake11
1 files 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()