Add option to disable building the bindings.

If you want to disable them, even if SWIG and Python were both found, set
WITH_BINDINGS to NO with -DWITH_BINDINGS=NO or in the CMake GUI.
This commit is contained in:
Matt Williams
2012-06-21 20:31:04 +01:00
parent 11f91fbbc4
commit c681fac66a
2 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,8 @@
find_package(SWIG)
find_package(PythonLibs)
if(SWIG_FOUND AND PYTHONLIBS_FOUND)
option(WITH_BINDINGS "Build Python bindings" ON)
if(SWIG_FOUND AND PYTHONLIBS_FOUND AND WITH_BINDINGS)
set(BUILD_BINDINGS YES CACHE BOOL "Will the bindings be built" FORCE)
include(${SWIG_USE_FILE})
include_directories(${PYTHON_INCLUDE_PATH})
@ -10,7 +12,10 @@ if(SWIG_FOUND AND PYTHONLIBS_FOUND)
set(CMAKE_SWIG_FLAGS "")
set_source_files_properties(PolyVoxCore.i PROPERTIES CPLUSPLUS ON)
#set_source_files_properties(PolyVoxCore.i PROPERTIES SWIG_FLAGS "-builtin")
swig_add_module(PolyVoxCore python PolyVoxCore.i)
swig_link_libraries(PolyVoxCore ${PYTHON_LIBRARIES} PolyVoxCore)
#set_target_properties(${SWIG_MODULE_PolyVoxCore_REAL_NAME} PROPERTIES SUFFIX ".pyd")
else()
set(BUILD_BINDINGS NO CACHE BOOL "Will the bindings be built" FORCE)
endif()