summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-29 11:33:39 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-29 11:33:50 (GMT)
commit959acdc9e6af291b7f8c3ac530496322745385a2 (patch)
tree134980b8cd426fb8c35fdc975c45d87343a84dcc /Tests
parent505bc9c87ba6a6a2e2494986af52447228fa3918 (diff)
parent8a90ef5a4400ccb5bfe1f867e25dde2254996df7 (diff)
downloadCMake-959acdc9e6af291b7f8c3ac530496322745385a2.zip
CMake-959acdc9e6af291b7f8c3ac530496322745385a2.tar.gz
CMake-959acdc9e6af291b7f8c3ac530496322745385a2.tar.bz2
Merge topic 'FindLibXslt-targets'
8a90ef5a44 FindLibXslt: use LIBXSLT_LIBRARY as cache variable 1aa7df4114 FindLibXslt: provide imported targets dd506714f4 FindLibXslt: identify libexslt include directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4650
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/FindLibXslt/CMakeLists.txt10
-rw-r--r--Tests/FindLibXslt/Test/CMakeLists.txt45
-rw-r--r--Tests/FindLibXslt/Test/libexslt.c16
-rw-r--r--Tests/FindLibXslt/Test/libxslt.c24
5 files changed, 96 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5011863..f44a209 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1441,6 +1441,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
Libinput
LibUV
LibXml2
+ LibXslt
LTTngUST
ODBC
OpenACC
diff --git a/Tests/FindLibXslt/CMakeLists.txt b/Tests/FindLibXslt/CMakeLists.txt
new file mode 100644
index 0000000..8a550b2
--- /dev/null
+++ b/Tests/FindLibXslt/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindLibXslt.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindLibXslt/Test"
+ "${CMake_BINARY_DIR}/Tests/FindLibXslt/Test"
+ ${build_generator_args}
+ --build-project TestFindLibXslt
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+)
diff --git a/Tests/FindLibXslt/Test/CMakeLists.txt b/Tests/FindLibXslt/Test/CMakeLists.txt
new file mode 100644
index 0000000..e932661
--- /dev/null
+++ b/Tests/FindLibXslt/Test/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindLibXslt C)
+include(CTest)
+
+find_package(Iconv)
+find_package(LibXml2 REQUIRED)
+find_package(LibXslt REQUIRED)
+
+add_definitions(-DCMAKE_EXPECTED_LibXslt_VERSION="${LIBXSLT_VERSION_STRING}")
+
+add_executable(libxslt_tgt libxslt.c)
+if(Iconv_FOUND)
+ target_link_libraries(libxslt_tgt Iconv::Iconv)
+endif()
+target_link_libraries(libxslt_tgt LibXml2::LibXml2 LibXslt::LibXslt)
+add_test(NAME libxslt_tgt COMMAND libxslt_tgt)
+
+add_executable(libxslt_var libxslt.c)
+if(Iconv_FOUND)
+ target_include_directories(libxslt_var PRIVATE ${Iconv_INCLUDE_DIRS})
+ target_link_libraries(libxslt_var PRIVATE ${Iconv_LIBRARIES})
+endif()
+target_include_directories(libxslt_var PRIVATE ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIR})
+target_link_libraries(libxslt_var PRIVATE ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES})
+add_test(NAME libxslt_var COMMAND libxslt_var)
+
+add_executable(libexslt_tgt libexslt.c)
+if(Iconv_FOUND)
+ target_link_libraries(libexslt_tgt Iconv::Iconv)
+endif()
+target_link_libraries(libexslt_tgt LibXml2::LibXml2 LibXslt::LibXslt LibXslt::LibExslt)
+add_test(NAME libexslt_tgt COMMAND libexslt_tgt)
+
+add_executable(libexslt_var libexslt.c)
+if(Iconv_FOUND)
+ target_include_directories(libexslt_var PRIVATE ${Iconv_INCLUDE_DIRS})
+ target_link_libraries(libexslt_var PRIVATE ${Iconv_LIBRARIES})
+endif()
+target_include_directories(libexslt_var PRIVATE ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIR} ${LIBXSLT_EXSLT_INCLUDE_DIR})
+target_link_libraries(libexslt_var PRIVATE ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${LIBXSLT_EXSLT_LIBRARIES})
+add_test(NAME libexslt_var COMMAND libexslt_var)
+
+add_test(NAME xsltproc_tgt COMMAND LibXslt::xsltproc --version)
+
+add_test(NAME xsltproc_var COMMAND ${LIBXSLT_XSLTPROC_EXECUTABLE} --version)
diff --git a/Tests/FindLibXslt/Test/libexslt.c b/Tests/FindLibXslt/Test/libexslt.c
new file mode 100644
index 0000000..ea6eb3d
--- /dev/null
+++ b/Tests/FindLibXslt/Test/libexslt.c
@@ -0,0 +1,16 @@
+#include <libexslt/exslt.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+
+int main()
+{
+ xsltInit();
+
+ xsltStylesheet* style = xsltNewStylesheet();
+ exsltRegisterAll();
+ xsltFreeStylesheet(style);
+
+ xsltCleanupGlobals();
+
+ return 0;
+}
diff --git a/Tests/FindLibXslt/Test/libxslt.c b/Tests/FindLibXslt/Test/libxslt.c
new file mode 100644
index 0000000..5b3d766
--- /dev/null
+++ b/Tests/FindLibXslt/Test/libxslt.c
@@ -0,0 +1,24 @@
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/xsltconfig.h>
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+ xsltInit();
+
+ xsltStylesheet* style = xsltNewStylesheet();
+ xsltFreeStylesheet(style);
+
+ if (0 != strcmp(CMAKE_EXPECTED_LibXslt_VERSION, LIBXSLT_DOTTED_VERSION)) {
+ printf("CMAKE_EXPECTED_LibXslt_VERSION: '%s'\n",
+ CMAKE_EXPECTED_LibXslt_VERSION);
+ printf("LIBXSLT_DOTTED_VERSION: '%s'\n", LIBXSLT_DOTTED_VERSION);
+ return 1;
+ }
+
+ xsltCleanupGlobals();
+
+ return 0;
+}