diff options
author | Brad King <brad.king@kitware.com> | 2017-09-07 15:22:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-07 15:22:26 (GMT) |
commit | 14ea80ab0cbdd98551403b62a34540e1031dff31 (patch) | |
tree | 7a9655025c00d0ef36b0ce50c8e723176983d83e /Modules | |
parent | 67a840b3c8ab768d924d8b9fa978599f915c4528 (diff) | |
parent | 3a4f82e9f2edc9cf30c45019685d26658906e48e (diff) | |
download | CMake-14ea80ab0cbdd98551403b62a34540e1031dff31.zip CMake-14ea80ab0cbdd98551403b62a34540e1031dff31.tar.gz CMake-14ea80ab0cbdd98551403b62a34540e1031dff31.tar.bz2 |
Merge topic 'findexpat-importedtargets'
3a4f82e9 Help: Add notes for topic 'FindEXPAT-importedtargets'
bfe51369 FindEXPAT: Add unit test of target and variables
78f166f8 FindEXPAT: Add imported target and documentation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1207
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindEXPAT.cmake | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 09963fc..39086e4 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -5,15 +5,28 @@ # FindEXPAT # --------- # -# Find expat +# Find the native Expat headers and library. # -# Find the native EXPAT headers and libraries. +# Imported Targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: +# +# ``EXPAT::EXPAT`` +# The Expat ``expat`` library, if found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# ``EXPAT_INCLUDE_DIRS`` +# where to find expat.h, etc. +# ``EXPAT_LIBRARIES`` +# the libraries to link against to use Expat. +# ``EXPAT_FOUND`` +# true if the Expat headers and libraries were found. # -# EXPAT_INCLUDE_DIRS - where to find expat.h, etc. -# EXPAT_LIBRARIES - List of libraries when using expat. -# EXPAT_FOUND - True if expat found. find_package(PkgConfig QUIET) @@ -49,10 +62,18 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR VERSION_VAR EXPAT_VERSION_STRING) -# Copy the results to the output variables. +# Copy the results to the output variables and target. if(EXPAT_FOUND) set(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) + + if(NOT TARGET EXPAT::EXPAT) + add_library(EXPAT::EXPAT UNKNOWN IMPORTED) + set_target_properties(EXPAT::EXPAT PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${EXPAT_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${EXPAT_INCLUDE_DIRS}") + endif() endif() mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY) |