mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 19:49:51 +00:00
parent
ffa08d256f
commit
b00d736a0b
@ -1478,6 +1478,10 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
|
||||
add_subdirectory(UseSWIG)
|
||||
endif()
|
||||
|
||||
if(CMake_TEST_FindRuby)
|
||||
add_subdirectory(FindRuby)
|
||||
endif()
|
||||
|
||||
add_subdirectory(FindThreads)
|
||||
|
||||
# Matlab module
|
||||
|
44
Tests/FindRuby/CMakeLists.txt
Normal file
44
Tests/FindRuby/CMakeLists.txt
Normal file
@ -0,0 +1,44 @@
|
||||
if(CMake_TEST_FindRuby)
|
||||
|
||||
# Looks for ruby >=1.9.9, which is true on any Ubuntu (that installs it) or macOS (> 10.9)
|
||||
add_test(NAME FindRuby.Test COMMAND
|
||||
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/FindRuby/Test"
|
||||
"${CMake_BINARY_DIR}/Tests/FindRuby/Test"
|
||||
${build_generator_args}
|
||||
--build-project TestRuby
|
||||
--build-options ${build_options}
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
|
||||
)
|
||||
|
||||
# Looks for ruby >= 50.1.0, which should logically fail
|
||||
add_test(NAME FindRuby.Fail COMMAND
|
||||
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/FindRuby/Fail"
|
||||
"${CMake_BINARY_DIR}/Tests/FindRuby/Fail"
|
||||
${build_generator_args}
|
||||
--build-project TestRubyFail
|
||||
--build-options ${build_options}
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
|
||||
)
|
||||
set_tests_properties(FindRuby.Fail PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "Could NOT find Ruby: Found unsuitable version \".*\", but required is.*least \"[0-9]+\\.[0-9]+\\.[0-9]+\" \\(found .*\\)")
|
||||
|
||||
# Looks for 1.9.9 EXACTLY, which unlike the "FindRuby" test above will fail on every machine
|
||||
# since this version doesn't exist (ruby goes from 1.9.3 to 2.0.0)
|
||||
add_test(NAME FindRuby.FailExact COMMAND
|
||||
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/FindRuby/FailExact"
|
||||
"${CMake_BINARY_DIR}/Tests/FindRuby/FailExact"
|
||||
${build_generator_args}
|
||||
--build-project TestRubyFailExact
|
||||
--build-options ${build_options}
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
|
||||
)
|
||||
set_tests_properties(FindRuby.FailExact PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "Could NOT find Ruby: Found unsuitable version \".*\", but required is.*exact version \"[0-9]+\\.[0-9]+\\.[0-9]+\" \\(found .*\\)")
|
||||
|
||||
endif()
|
5
Tests/FindRuby/Fail/CMakeLists.txt
Normal file
5
Tests/FindRuby/Fail/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
project(TestRubyFail LANGUAGES NONE)
|
||||
|
||||
# Should always fail since there is NO ruby 50.1.0 yet.
|
||||
find_package(Ruby 50.1.0 REQUIRED)
|
8
Tests/FindRuby/FailExact/CMakeLists.txt
Normal file
8
Tests/FindRuby/FailExact/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
project(TestRubyFailExact LANGUAGES NONE)
|
||||
|
||||
# Should always fail since there is NO ruby 1.9.9 (goes from 1.9.3 to 2.0.0)
|
||||
find_package(Ruby 1.9.9 EXACT REQUIRED)
|
||||
if (NOT Ruby_FOUND)
|
||||
message (FATAL_ERROR "Failed to find Ruby 1.9.9")
|
||||
endif()
|
14
Tests/FindRuby/Test/CMakeLists.txt
Normal file
14
Tests/FindRuby/Test/CMakeLists.txt
Normal file
@ -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)
|
7
Tests/FindRuby/Test/ruby_version.c
Normal file
7
Tests/FindRuby/Test/ruby_version.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "ruby.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
ruby_show_version();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user