summaryrefslogtreecommitdiffstats
path: root/Tests/FindLibArchive
diff options
context:
space:
mode:
authorT.J. Corona <tj.corona@kitware.com>2019-12-05 18:44:44 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2019-12-05 22:18:28 (GMT)
commit30488b3b9f781e614a9115d0d3dc03f164331332 (patch)
treee11710b403428e8f8e438ac7ea7c32a0cbb62f36 /Tests/FindLibArchive
parent84551652396e4e57c1833f0ef3dfe0941d14f709 (diff)
downloadCMake-30488b3b9f781e614a9115d0d3dc03f164331332.zip
CMake-30488b3b9f781e614a9115d0d3dc03f164331332.tar.gz
CMake-30488b3b9f781e614a9115d0d3dc03f164331332.tar.bz2
FindLibArchive: create a target
Diffstat (limited to 'Tests/FindLibArchive')
-rw-r--r--Tests/FindLibArchive/CMakeLists.txt10
-rw-r--r--Tests/FindLibArchive/Test/CMakeLists.txt14
-rw-r--r--Tests/FindLibArchive/Test/main.c7
3 files changed, 31 insertions, 0 deletions
diff --git a/Tests/FindLibArchive/CMakeLists.txt b/Tests/FindLibArchive/CMakeLists.txt
new file mode 100644
index 0000000..f532ef2
--- /dev/null
+++ b/Tests/FindLibArchive/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindLibArchive.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindLibArchive/Test"
+ "${CMake_BINARY_DIR}/Tests/FindLibArchive/Test"
+ ${build_generator_args}
+ --build-project TestFindLibArchive
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindLibArchive/Test/CMakeLists.txt b/Tests/FindLibArchive/Test/CMakeLists.txt
new file mode 100644
index 0000000..35843bb
--- /dev/null
+++ b/Tests/FindLibArchive/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.12)
+project(TestFindLibArchive C)
+include(CTest)
+
+find_package(LibArchive REQUIRED)
+
+add_executable(test_libarchive_tgt main.c)
+target_link_libraries(test_libarchive_tgt LibArchive::LibArchive)
+add_test(NAME test_libarchive_tgt COMMAND test_libarchive_tgt)
+
+add_executable(test_libarchive_var main.c)
+target_include_directories(test_libarchive_var PRIVATE ${LibArchive_INCLUDE_DIRS})
+target_link_libraries(test_libarchive_var PRIVATE ${LibArchive_LIBRARIES})
+add_test(NAME test_libarchive_var COMMAND test_libarchive_var)
diff --git a/Tests/FindLibArchive/Test/main.c b/Tests/FindLibArchive/Test/main.c
new file mode 100644
index 0000000..03e7ece
--- /dev/null
+++ b/Tests/FindLibArchive/Test/main.c
@@ -0,0 +1,7 @@
+#include <archive.h>
+
+int main(void)
+{
+ archive_read_free(archive_read_new());
+ return 0;
+}