summaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2014-08-20 12:23:24 -0400
committerMichael Dickens <michael.dickens@ettus.com>2014-08-20 12:23:24 -0400
commit8f02178318d90fceb476a46192fa98fda5bcb0ee (patch)
tree9e1842fd5244064c6fddd8658e5d7b7c2065803c /cmake/Modules
parentb7ea151b32c28e6452c309ef19746e079285ea56 (diff)
cmake: add compiler flag only if the compiler supports it
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/UseSWIG.cmake10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmake/Modules/UseSWIG.cmake b/cmake/Modules/UseSWIG.cmake
index 008bfa0ed5..837659f704 100644
--- a/cmake/Modules/UseSWIG.cmake
+++ b/cmake/Modules/UseSWIG.cmake
@@ -146,9 +146,13 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
endif()
# Shut up some warnings from poor SWIG code generation that we
- # can do nothing about.
- set_source_files_properties( ${swig_generated_file_fullname}
- PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
+ # can do nothing about, when this flag is available
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag("-Wno-unused-but-set-variable" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
+ if(HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
+ set_source_files_properties(${swig_generated_file_fullname}
+ PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
+ endif(HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
#message("Full path to source file: ${swig_source_file_fullname}")
#message("Full path to the output file: ${swig_generated_file_fullname}")