diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d50497cf1..bbb910e3e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,7 +278,6 @@ endif() # SWIG find_package (SWIG 3.0.12 REQUIRED) include (${SWIG_USE_FILE}) -string(REGEX MATCH "^[0-9]+[.]" SWIG_MAJOR ${SWIG_VERSION}) # Find Guile and determine which version we are using. # Look for guile versions in this order: 3.0 > 2.2 > 2.0 diff --git a/common/cmake_modules/GncAddSwigCommand.cmake b/common/cmake_modules/GncAddSwigCommand.cmake index 05e181084b..23bbebcabf 100644 --- a/common/cmake_modules/GncAddSwigCommand.cmake +++ b/common/cmake_modules/GncAddSwigCommand.cmake @@ -69,10 +69,15 @@ macro (gnc_add_swig_python_command _target _out_var _py_out_var _output _py_outp set(${_py_out_var} ${py_outfile}) # This variable is set for convenience to use in the calling CMakeLists.txt set (DEFAULT_SWIG_PYTHON_FLAGS - -python -py3 + -python -Wall -Werror ${SWIG_ARGS} ) + if (${SWIG_VERSION} VERSION_LESS 4.1) + set (DEFAULT_SWIG_PYTHON_FLAGS + ${SWIG_ARGS} -py3 + ) + endif() set (DEFAULT_SWIG_PYTHON_C_INCLUDES ${GLIB2_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/common