File: Ruby.cmake

package info (click to toggle)
cmake 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 158,704 kB
  • sloc: ansic: 406,077; cpp: 309,512; sh: 4,233; python: 3,696; yacc: 3,109; lex: 1,279; f90: 538; asm: 471; lisp: 375; java: 310; cs: 270; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 110; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22; sed: 2
file content (50 lines) | stat: -rw-r--r-- 1,414 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
enable_language(C)

cmake_policy(SET CMP0185 NEW)

set(Ruby_RBENV_EXECUTABLE "") # Suppress rbenv code path for this test.

find_package(Ruby 1.9.9 REQUIRED)
if (NOT Ruby_FOUND)
  message (FATAL_ERROR "Failed to find Ruby >=1.9.9")
endif()

if (NOT Ruby_Interpreter_FOUND)
  message (FATAL_ERROR "Failed to find Ruby 'Interpreter' component")
endif()

if (NOT Ruby_Development_FOUND)
  message (FATAL_ERROR "Failed to find Ruby 'Development' component")
endif()

foreach(var_CMP0185
    RUBY_EXECUTABLE
    RUBY_INCLUDE_DIRS
    RUBY_LIBRARY
    RUBY_VERSION
    )
  if(DEFINED ${var_CMP0185})
    message(FATAL_ERROR "Pre-CMP0185 result variable is set: ${var_CMP0185}")
  endif()
endforeach()

if(NOT TARGET Ruby::Interpreter)
  message(SEND_ERROR "Ruby::Interpreter not found")
endif()

if (NOT TARGET Ruby::Ruby)
  message(SEND_ERROR "Ruby::Ruby not found")
endif()

if (NOT TARGET Ruby::Module)
  message(SEND_ERROR "Ruby::Module not found")
endif()

add_executable(ruby_version_var "${CMAKE_CURRENT_LIST_DIR}/ruby_version.c")
target_include_directories(ruby_version_var PRIVATE ${Ruby_INCLUDE_DIRS})
target_link_libraries(ruby_version_var PRIVATE ${Ruby_LIBRARIES})
add_test(NAME ruby_version_var COMMAND ruby_version_var)

add_executable(ruby_version_tgt "${CMAKE_CURRENT_LIST_DIR}/ruby_version.c")
target_link_libraries(ruby_version_tgt Ruby::Ruby)
add_test(NAME ruby_version_tgt COMMAND ruby_version_tgt)