summaryrefslogtreecommitdiffstats
path: root/Tests/FindRuby/Test
diff options
context:
space:
mode:
authorJulien Marrec <julien.marrec@gmail.com>2020-02-21 15:46:24 (GMT)
committerBrad King <brad.king@kitware.com>2020-03-16 17:33:27 (GMT)
commitb00d736a0b47fee296e136fcd3511e51cb63468c (patch)
tree57cfbae9bf93d2f218a81da859679fc8d55afdb1 /Tests/FindRuby/Test
parentffa08d256fa0aaa52afcb05b50f4d4a485d84171 (diff)
downloadCMake-b00d736a0b47fee296e136fcd3511e51cb63468c.zip
CMake-b00d736a0b47fee296e136fcd3511e51cb63468c.tar.gz
CMake-b00d736a0b47fee296e136fcd3511e51cb63468c.tar.bz2
FindRuby: Add dedicated tests
Issue: #20370
Diffstat (limited to 'Tests/FindRuby/Test')
-rw-r--r--Tests/FindRuby/Test/CMakeLists.txt14
-rw-r--r--Tests/FindRuby/Test/ruby_version.c7
2 files changed, 21 insertions, 0 deletions
diff --git a/Tests/FindRuby/Test/CMakeLists.txt b/Tests/FindRuby/Test/CMakeLists.txt
new file mode 100644
index 0000000..be8c67f
--- /dev/null
+++ b/Tests/FindRuby/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.17)
+project(TestRuby LANGUAGES C)
+include(CTest)
+
+find_package(Ruby 1.9.9 REQUIRED)
+if (NOT Ruby_FOUND)
+ message (FATAL_ERROR "Failed to find Ruby >=1.9.9")
+endif()
+
+add_executable(ruby_version ruby_version.c)
+target_include_directories(ruby_version PRIVATE ${Ruby_INCLUDE_DIRS})
+target_link_libraries(ruby_version PRIVATE ${Ruby_LIBRARY})
+
+add_test(NAME ruby_version COMMAND ruby_version)
diff --git a/Tests/FindRuby/Test/ruby_version.c b/Tests/FindRuby/Test/ruby_version.c
new file mode 100644
index 0000000..8800436
--- /dev/null
+++ b/Tests/FindRuby/Test/ruby_version.c
@@ -0,0 +1,7 @@
+#include "ruby.h"
+
+int main(void)
+{
+ ruby_show_version();
+ return 0;
+}