diff options
author | Brad King <brad.king@kitware.com> | 2015-11-24 14:26:42 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-11-24 14:26:42 (GMT) |
commit | f66f6e2490a883ecb9a9505d87f76869980e776f (patch) | |
tree | f37d80a6e041f5b3a84a02798ef4a8ace879d8cb /Modules | |
parent | bc1136b2753e82f9d98a4870f2ff026fbefe7ace (diff) | |
parent | 5dcc833b28eecc95486852f032a54edc64f76eec (diff) | |
download | CMake-f66f6e2490a883ecb9a9505d87f76869980e776f.zip CMake-f66f6e2490a883ecb9a9505d87f76869980e776f.tar.gz CMake-f66f6e2490a883ecb9a9505d87f76869980e776f.tar.bz2 |
Merge topic 'FindXercesC-imported-targets'
5dcc833b FindXercesC: Add imported targets and unit test
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindXercesC.cmake | 67 |
1 files changed, 57 insertions, 10 deletions
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index cf84826..a4b80e5 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -4,23 +4,42 @@ # # Find the Apache Xerces-C++ validating XML parser headers and libraries. # -# This module reports information about the Xerces installation in -# several variables. General variables:: +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# XercesC_FOUND - true if the Xerces headers and libraries were found -# XercesC_VERSION - Xerces release version -# XercesC_INCLUDE_DIRS - the directory containing the Xerces headers -# XercesC_LIBRARIES - Xerces libraries to be linked +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# The following cache variables may also be set:: +# ``XercesC::XercesC`` +# The Xerces-C++ ``xerces-c`` library, if found. # -# XercesC_INCLUDE_DIR - the directory containing the Xerces headers -# XercesC_LIBRARY - the Xerces library +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# ``XercesC_FOUND`` +# true if the Xerces headers and libraries were found +# ``XercesC_VERSION`` +# Xerces release version +# ``XercesC_INCLUDE_DIRS`` +# the directory containing the Xerces headers +# ``XercesC_LIBRARIES`` +# Xerces libraries to be linked +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``XercesC_INCLUDE_DIR`` +# the directory containing the Xerces headers +# ``XercesC_LIBRARY`` +# the Xerces library # Written by Roger Leigh <rleigh@codelibre.net> #============================================================================= -# Copyright 2014 University of Dundee +# Copyright 2014-2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -90,4 +109,32 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC if(XercesC_FOUND) set(XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}") set(XercesC_LIBRARIES "${XercesC_LIBRARY}") + + # For header-only libraries + if(NOT TARGET XercesC::XercesC) + add_library(XercesC::XercesC UNKNOWN IMPORTED) + if(XercesC_INCLUDE_DIRS) + set_target_properties(XercesC::XercesC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${XercesC_INCLUDE_DIRS}") + endif() + if(EXISTS "${XercesC_LIBRARY}") + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${XercesC_LIBRARY}") + endif() + if(EXISTS "${XercesC_LIBRARY_DEBUG}") + set_property(TARGET XercesC::XercesC APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}") + endif() + if(EXISTS "${XercesC_LIBRARY_RELEASE}") + set_property(TARGET XercesC::XercesC APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${XercesC_LIBRARY_RELEASE}") + endif() + endif() endif() |