← Back to team overview

kicad-developers team mailing list archive

[PATCH] Make COMPILE_FLAGS property set conditional on sane value

 

If the compiler doesn't support -Wshadow, the variable is empty, leading to
a broken declaration.
---
 pcbnew/CMakeLists.txt | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 2c22916f0..4535daa1b 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -342,11 +342,13 @@ set( PCBNEW_SCRIPTING_PYTHON_HELPERS
     )
 
 
-# .cpp files are compiled with extra ${WSHADOW_FLAGS}, but not .cxx files
-set_source_files_properties(
-    ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS} ${PCBNEW_SCRIPTING_DIALOGS} ${PCBNEW_SCRIPTING_PYTHON_HELPERS}
-    PROPERTIES COMPILE_FLAGS ${WSHADOW_FLAGS}
-)
+if( COMPILER_SUPPORTS_WSHADOW )
+    # .cpp files are compiled with extra ${WSHADOW_FLAGS}, but not .cxx files
+    set_source_files_properties(
+        ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS} ${PCBNEW_SCRIPTING_DIALOGS} ${PCBNEW_SCRIPTING_PYTHON_HELPERS}
+        PROPERTIES COMPILE_FLAGS ${WSHADOW_FLAGS}
+    )
+endif()
 
 if( KICAD_SCRIPTING )
     set( PCBNEW_SCRIPTING_SRCS