--- swig/ruby/CMakeLists.txt.orig	2012-06-21 09:59:38.000000000 +0200
+++ swig/ruby/CMakeLists.txt	2012-06-21 10:00:14.000000000 +0200
@@ -11,6 +11,9 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
+IF (WITH_RUBY)
+
 IF(APPLE)
 CMAKE_FIND_FRAMEWORKS ( Ruby )
 ENDIF(APPLE)
@@ -44,9 +47,9 @@
 
   # The following fix was added because of the changes in CMake 2.8, which have the
   # result of naming the java binding library "liblibzorba_api.so" instead of "libzorba_api.so"
-  IF ( LINUX OR CYGWIN OR APPLE )
+  IF ( LINUX OR CYGWIN OR APPLE OR FREEBSD )
     SET_TARGET_PROPERTIES( ${SWIG_MODULE_zorba_api_REAL_NAME} PROPERTIES PREFIX "" )
-  ENDIF ( LINUX OR CYGWIN OR APPLE )
+  ENDIF ( LINUX OR CYGWIN OR APPLE OR FREEBSD )
 
   EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']"
     OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
@@ -85,3 +88,5 @@
 ELSE (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
   MESSAGE(STATUS "SWIG: Ruby binding not generated because library and include files are not installed.")
 ENDIF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+
+ENDIF (WITH_RUBY)
