Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron D. Marasco <github-keepassxc@marascos.net>2020-06-09 18:45:13 +0300
committerJonathan White <support@dmapps.us>2020-06-09 21:48:51 +0300
commit639a7f91a4a2adc935c298548cf9cb31f4c9bdec (patch)
tree5f422d4a4fa1cb190ac730fc83019c0cf294803e /CMakeLists.txt
parente5b0219e3f09338db0e7c4ece0da3148233e43ea (diff)
Reduce compiler flag warnings depending on language
Adds ability to list what languages a compiler flag should be used for; defaults to "C CXX". Bumps required cmake to 3.3 for IN_LIST (July 2015)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 17 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b2cbde92..b22222ff5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-cmake_minimum_required(VERSION 3.1.0)
+cmake_minimum_required(VERSION 3.3.0)
project(KeePassXC)
@@ -225,10 +225,22 @@ macro(check_add_gcc_compiler_cflag FLAG FLAGNAME)
endif()
endmacro(check_add_gcc_compiler_cflag)
+# This is the "front-end" for the above macros
+# Optionally takes additional parameter(s) with language to check (currently "C" or "CXX")
macro(check_add_gcc_compiler_flag FLAG)
string(REGEX REPLACE "[-=]" "_" FLAGNAME "${FLAG}")
- check_add_gcc_compiler_cxxflag("${FLAG}" "${FLAGNAME}")
- check_add_gcc_compiler_cflag("${FLAG}" "${FLAGNAME}")
+ set(check_lang_spec ${ARGN})
+ list(LENGTH check_lang_spec num_extra_args)
+ set(langs C CXX)
+ if(num_extra_args GREATER 0)
+ set(langs "${check_lang_spec}")
+ endif()
+ if("C" IN_LIST langs)
+ check_add_gcc_compiler_cflag("${FLAG}" "${FLAGNAME}")
+ endif()
+ if("CXX" IN_LIST langs)
+ check_add_gcc_compiler_cxxflag("${FLAG}" "${FLAGNAME}")
+ endif()
endmacro(check_add_gcc_compiler_flag)
add_definitions(-DQT_NO_EXCEPTIONS -DQT_STRICT_ITERATORS -DQT_NO_CAST_TO_ASCII)
@@ -281,7 +293,7 @@ if(CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)")
endif()
check_add_gcc_compiler_flag("-Werror=format-security")
-check_add_gcc_compiler_flag("-Werror=implicit-function-declaration")
+check_add_gcc_compiler_flag("-Werror=implicit-function-declaration" C)
check_add_gcc_compiler_flag("-Wcast-align")
if(WITH_COVERAGE AND CMAKE_COMPILER_IS_CLANGXX)
@@ -305,7 +317,7 @@ endif()
add_gcc_compiler_cflags("-std=c99")
add_gcc_compiler_cxxflags("-std=c++11")
-check_add_gcc_compiler_flag("-fsized-deallocation")
+check_add_gcc_compiler_flag("-fsized-deallocation" CXX)
if(APPLE AND CMAKE_COMPILER_IS_CLANGXX)
add_gcc_compiler_cxxflags("-stdlib=libc++")