ruby: reorder cmake checks
@@ -23,10 +23,17 @@ if (DEPENDENCY_PHASE)
# ~~~
set (SUPPORTED_COMPILER (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5)))
- if (RUBY_FOUND
- AND SWIG_FOUND
- AND BINDING_WAS_ADDED
- AND ${SUPPORTED_COMPILER})
+ if (NOT RUBY_FOUND)
+ remove_plugin (ruby "ruby not found")
+ elseif (NOT ${SUPPORTED_COMPILER})
+ remove_plugin (ruby "gcc version too old (gcc -dumpversion < 5.0)")
+ elseif (NOT SWIG_FOUND)
+ remove_plugin (ruby "swig not found")
+ elseif (NOT BINDING_WAS_ADDED)
+ remove_plugin (ruby "ruby binding is required")
+ elseif (SWIG_VERSION VERSION_LESS "4.0.2" AND (RUBY_VERSION VERSION_GREATER "2.7.0" OR RUBY_VERSION VERSION_EQUAL "2.7.0"))
+ remove_plugin (ruby "SWIG <= 4.0.1 incompatible with Ruby >= 2.7")
+ elseif (RUBY_FOUND AND SWIG_FOUND AND BINDING_WAS_ADDED AND ${SUPPORTED_COMPILER})
include (LibAddMacros)
add_custom_command (OUTPUT runtime.h COMMAND ${SWIG_EXECUTABLE} -c++ -ruby -external-runtime runtime.h)
@@ -49,16 +56,6 @@ if (DEPENDENCY_PHASE)
set_source_files_properties ("ruby.cpp" PROPERTIES COMPILE_FLAGS "${SWIG_COMPILE_FLAGS}")
message (WARNING "swig version: ${SWIG_VERSION}")
message (WARNING "ruby version: ${RUBY_VERSION}")
- elseif (NOT RUBY_FOUND)
- remove_plugin (ruby "ruby not found")
- elseif (SWIG_VERSION VERSION_LESS "4.0.2" AND (RUBY_VERSION VERSION_GREATER "2.7.0" OR RUBY_VERSION VERSION_EQUAL "2.7.0"))
- remove_plugin (ruby "SWIG <= 4.0.1 incompatible with Ruby >= 2.7")
- elseif (NOT ${SUPPORTED_COMPILER})
- remove_plugin (ruby "gcc version too old (gcc -dumpversion < 5.0)")
- elseif (NOT SWIG_FOUND)
- remove_plugin (ruby "swig not found")
- elseif (NOT BINDING_WAS_ADDED)
- remove_plugin (ruby "ruby binding is required")
endif ()
endif ()
