diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a6d2885eb..192fbddc7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,6 +15,13 @@ add_subdirectory(graph) ################################################# # Setup swig if (SWIG_FOUND) + if (POLICY CMP0078) + cmake_policy(SET CMP0078 NEW) + endif() + if (POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) + endif() + include(${SWIG_USE_FILE}) set(CMAKE_SWIG_FLAGS "") @@ -36,18 +43,12 @@ endif() # $ export RUBYLIB=/usr/local/lib/ruby # $ ruby -e "require 'ignition/math'; a = Ignition::Math::Angle.new(20); puts a.Degree()" if (RUBY_FOUND) - include_directories(${RUBY_INCLUDE_DIRS}) - foreach (swig_file ${swig_files}) # Assuming that each swig file has a test list(APPEND ruby_tests ${swig_file}_TEST) # Generate the list if .i files list(APPEND swig_i_files ${swig_file}.i) - - # Removing warning from auto-generated files. - set_source_files_properties(${swig_file}RUBY_wrap.cxx - PROPERTIES COMPILE_FLAGS "-w") endforeach() # Turn on c++ @@ -61,6 +62,14 @@ if (RUBY_FOUND) SWIG_ADD_MODULE(math ruby ruby.i ${swig_i_files} ${sources}) endif() + # Suppress warnings on SWIG-generated files + target_compile_options(math PRIVATE + $<$:-Wno-pedantic -Wno-shadow -Wno-maybe-uninitialized -Wno-unused-parameter> + $<$:-Wno-shadow -Wno-maybe-uninitialized -Wno-unused-parameter> + $<$:-Wno-shadow -Wno-maybe-uninitialized -Wno-unused-parameter> + ) + target_include_directories(math SYSTEM PUBLIC ${RUBY_INCLUDE_DIRS}) + SWIG_LINK_LIBRARIES(math ${RUBY_LIBRARY}) target_compile_features(math PUBLIC ${IGN_CXX_${c++standard}_FEATURES}) install(TARGETS math DESTINATION ${IGN_LIB_INSTALL_DIR}/ruby/ignition)