Mruby integration

Hi, i’m new to CMake. I don’t know how to integrate mruby source into urho3d make system.
mruby source is unzipped into Urho3D/Source/ThirdParty/MRuby/mruby-1.2.0
And CMakeLists.txt is as following, which is copied from Lua folder
But i don’t know what is going on under the hood
Can anybody help me ?

set (MRUBY_VERSION mruby-1.2.0)
#set (MRUBY_LIBRARY ${MRUBY_DIR}/build/host/lib/libmruby.a)
#set (MRUBY_CORE_LIBRARY ${MRUBY_DIR}/build/host/lib/libmruby_core.a)

# define_source_files ()
setup_library ()

# Install headers for building and using the Urho3D library (no direct dependencies but library user may need them)
install_header_files (DIRECTORY ${MRUBY_DIR}/include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/MRuby FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant

Welcome to our forum.

Have you tried to build mruby using its own build system before trying to integrate it with Urho3D build system? If the mruby own build system is also CMake based then it should be easier to do this integration, or otherwise you will have to adapt whatever build configuration file used by mruby into a new CMakeList.txt. Simply copying and replacing the stuff out from existing CMakeLists.txt from Lua and hope for the best, would probably not work. At the very least you need to first learn the CMake basic and then move on to study how to use our Urho3D own convenient macros. The macros that you posted below would only work as expected when you have also initialized the necessary CMake variables. If what you posted is the complete CMakeLists.txt then obviously you have missed out the initialization for the SOURCE_FILES CMake variable. But, I think we have already getting ahead of ourselves.

Thanks for replying.
mruby’s make system is based on Rakefile, i can build mruby using its own make system.
I’ve searched all URHO3D_ANGELSCRIPT in CMakeLists.txt and add similar URHO3D_MRUBY there.
I am trying to write a CMake version of Rakefile. I also have another idea whether i can directly use the prebuilt version of libmruby.a
Well, I will try.