[Cmake-commits] CMake branch, next, updated. v3.4.0-1486-gb62d3d1

Brad King brad.king at kitware.com
Mon Nov 23 14:31:08 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  b62d3d17ce22297278dd084ab11142899d91157f (commit)
       via  5dcc833b28eecc95486852f032a54edc64f76eec (commit)
      from  e1098e4313117275e8e39262178012c630fc7917 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b62d3d17ce22297278dd084ab11142899d91157f
commit b62d3d17ce22297278dd084ab11142899d91157f
Merge: e1098e4 5dcc833
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Nov 23 14:31:07 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Nov 23 14:31:07 2015 -0500

    Merge topic 'FindXercesC-imported-targets' into next
    
    5dcc833b FindXercesC: Add imported targets and unit test


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5dcc833b28eecc95486852f032a54edc64f76eec
commit 5dcc833b28eecc95486852f032a54edc64f76eec
Author:     Roger Leigh <r.leigh at dundee.ac.uk>
AuthorDate: Wed Nov 18 16:45:54 2015 +0000
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 23 14:28:05 2015 -0500

    FindXercesC: Add imported targets and unit test

diff --git a/Help/release/dev/FindXercesC-imported-targets.rst b/Help/release/dev/FindXercesC-imported-targets.rst
new file mode 100644
index 0000000..69cec5c
--- /dev/null
+++ b/Help/release/dev/FindXercesC-imported-targets.rst
@@ -0,0 +1,4 @@
+FindXercesC-imported-targets
+----------------------------
+
+* The :module:`FindXercesC` module now provides imported targets.
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 at 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()
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index f381758..442f23f 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1367,6 +1367,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
     add_subdirectory(FindOpenSSL)
   endif()
 
+  if(CMake_TEST_FindXercesC)
+    add_subdirectory(FindXercesC)
+  endif()
+
   add_subdirectory(FindThreads)
 
   # Matlab module
diff --git a/Tests/FindXercesC/CMakeLists.txt b/Tests/FindXercesC/CMakeLists.txt
new file mode 100644
index 0000000..633f613
--- /dev/null
+++ b/Tests/FindXercesC/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindXercesC.Test COMMAND
+  ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+  --build-and-test
+  "${CMake_SOURCE_DIR}/Tests/FindXercesC/Test"
+  "${CMake_BINARY_DIR}/Tests/FindXercesC/Test"
+  ${build_generator_args}
+  --build-project TestFindXercesC
+  --build-options ${build_options}
+  --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+  )
diff --git a/Tests/FindXercesC/Test/CMakeLists.txt b/Tests/FindXercesC/Test/CMakeLists.txt
new file mode 100644
index 0000000..8e7767c
--- /dev/null
+++ b/Tests/FindXercesC/Test/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.1)
+project(TestFindXercesC CXX)
+include(CTest)
+
+# CMake does not actually provide FindXercesC publicly.
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
+
+find_package(XercesC REQUIRED)
+
+add_executable(test_xercesc_tgt main.cxx)
+target_link_libraries(test_xercesc_tgt XercesC::XercesC)
+add_test(NAME test_xercesc_tgt COMMAND test_xercesc_tgt)
+
+add_executable(test_xercesc_var main.cxx)
+target_include_directories(test_xercesc_var PRIVATE ${XercesC_INCLUDE_DIRS})
+target_link_libraries(test_xercesc_var PRIVATE ${XercesC_LIBRARIES})
+add_test(NAME test_xercesc_var COMMAND test_xercesc_var)
diff --git a/Tests/FindXercesC/Test/main.cxx b/Tests/FindXercesC/Test/main.cxx
new file mode 100644
index 0000000..1794fa6
--- /dev/null
+++ b/Tests/FindXercesC/Test/main.cxx
@@ -0,0 +1,7 @@
+#include <xercesc/util/PlatformUtils.hpp>
+
+int main()
+{
+  xercesc::XMLPlatformUtils::Initialize();
+  xercesc::XMLPlatformUtils::Terminate();
+}

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/FindXercesC-imported-targets.rst |    4 ++
 Modules/FindXercesC.cmake                         |   67 ++++++++++++++++++---
 Tests/CMakeLists.txt                              |    4 ++
 Tests/{FindJsonCpp => FindXercesC}/CMakeLists.txt |    8 +--
 Tests/FindXercesC/Test/CMakeLists.txt             |   17 ++++++
 Tests/FindXercesC/Test/main.cxx                   |    7 +++
 6 files changed, 93 insertions(+), 14 deletions(-)
 create mode 100644 Help/release/dev/FindXercesC-imported-targets.rst
 copy Tests/{FindJsonCpp => FindXercesC}/CMakeLists.txt (53%)
 create mode 100644 Tests/FindXercesC/Test/CMakeLists.txt
 create mode 100644 Tests/FindXercesC/Test/main.cxx


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list