summaryrefslogtreecommitdiff
path: root/Tests/FindIntl
diff options
context:
space:
mode:
authorSibi Siddharthan <sibisiddharthan.github@gmail.com>2020-10-06 09:37:40 +0530
committerBrad King <brad.king@kitware.com>2020-10-13 15:11:40 -0400
commitc30d06b7e66c9bfe52f91f472a38cefdfc527601 (patch)
tree2534d9fac2f9ec5bb06cfc17947372cd56b041e3 /Tests/FindIntl
parent142a29b46f6e34b45354425c0da9c49aff9c362c (diff)
downloadcmake-c30d06b7e66c9bfe52f91f472a38cefdfc527601.tar.gz
FindIntl: Add imported target
Fixes: #21271 Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
Diffstat (limited to 'Tests/FindIntl')
-rw-r--r--Tests/FindIntl/CMakeLists.txt10
-rw-r--r--Tests/FindIntl/Test/CMakeLists.txt14
-rw-r--r--Tests/FindIntl/Test/main.cxx11
3 files changed, 35 insertions, 0 deletions
diff --git a/Tests/FindIntl/CMakeLists.txt b/Tests/FindIntl/CMakeLists.txt
new file mode 100644
index 0000000000..0906ede352
--- /dev/null
+++ b/Tests/FindIntl/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindIntl.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindIntl/Test"
+ "${CMake_BINARY_DIR}/Tests/FindIntl/Test"
+ ${build_generator_args}
+ --build-project TestFindIntl
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindIntl/Test/CMakeLists.txt b/Tests/FindIntl/Test/CMakeLists.txt
new file mode 100644
index 0000000000..51404061c8
--- /dev/null
+++ b/Tests/FindIntl/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.10)
+project(TestFindIntl CXX)
+include(CTest)
+
+find_package(Intl REQUIRED)
+
+add_executable(test_intl_tgt main.cxx)
+target_link_libraries(test_intl_tgt Intl::Intl)
+add_test(NAME test_intl_tgt COMMAND test_intl_tgt)
+
+add_executable(test_intl_var main.cxx)
+target_include_directories(test_intl_var PRIVATE ${Intl_INCLUDE_DIRS})
+target_link_libraries(test_intl_var PRIVATE ${Intl_LIBRARIES})
+add_test(NAME test_intl_var COMMAND test_intl_var)
diff --git a/Tests/FindIntl/Test/main.cxx b/Tests/FindIntl/Test/main.cxx
new file mode 100644
index 0000000000..d90c095414
--- /dev/null
+++ b/Tests/FindIntl/Test/main.cxx
@@ -0,0 +1,11 @@
+extern "C" {
+#include <libintl.h>
+}
+
+int main()
+{
+ // Check if we include the directory correctly and have no link errors
+ bindtextdomain("", "");
+ gettext("");
+ return 0;
+}