aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
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)