aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-30 21:26:17 +0200
committerMarvin W <git@larma.de>2017-03-30 22:38:51 +0200
commit3733d24a9066bdd3e038d642a62cf642abd0b0bf (patch)
treecd62d02094108e2449b68d3da3aa65c03c3f5883 /CMakeLists.txt
parente910b39751a90f977110190b12cdb738f6a1d132 (diff)
downloaddino-3733d24a9066bdd3e038d642a62cf642abd0b0bf.tar.gz
dino-3733d24a9066bdd3e038d642a62cf642abd0b0bf.zip
Fix -Werror=format-security issues
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 14 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e367591..bac892fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,25 +45,31 @@ set(PLUGIN_INSTALL LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} RUNTIME DESTINATION
include(CheckCCompilerFlag)
macro(AddCFlagIfSupported flag)
- CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag})
- if(${COMPILER_SUPPORTS${flag}})
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
- endif()
+ string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
+ CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag_name})
+ if(${COMPILER_SUPPORTS${flag_name}})
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
+ endif()
endmacro()
macro(AddValaCFlagIfSupported flag)
- CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag})
- if(${COMPILER_SUPPORTS${flag}})
- set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
- endif()
+ string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
+ CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag_name})
+ if(${COMPILER_SUPPORTS${flag_name}})
+ set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
+ endif()
endmacro()
if("Ninja" STREQUAL ${CMAKE_GENERATOR})
AddCFlagIfSupported(-fdiagnostics-color COMPILER_SUPPORTS_fdiagnistics-color)
endif()
+AddCFlagIfSupported(-Wall)
+AddCFlagIfSupported(-Werror=format-security)
+
AddValaCFlagIfSupported(-Wno-deprecated-declarations)
AddValaCFlagIfSupported(-Wno-incompatible-pointer-types)
+AddValaCFlagIfSupported(-Wno-pointer-sign)
AddValaCFlagIfSupported(-Wno-int-conversion)
AddValaCFlagIfSupported(-Wno-discarded-qualifiers)
AddValaCFlagIfSupported(-Wno-unused-but-set-variable)