From 51fcd0af8a7017aea779b8516d7520df20bec454 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 7 Nov 2018 09:25:54 +0100 Subject: cmake: Only set default flags if they have been detected Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- CompilerChecks.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'CompilerChecks.cmake') diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake index 5e9d830..4fa1a83 100644 --- a/CompilerChecks.cmake +++ b/CompilerChecks.cmake @@ -106,5 +106,9 @@ if (MSVC) add_c_compiler_flag("/D _CRT_SECURE_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS) endif() -set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE) -set(DEFAULT_LINK_FLAGS ${SUPPORTED_LINKER_FLAGS} CACHE INTERNAL "Default C Linker Flags" FORCE) +if (SUPPORTED_COMPILER_FLAGS) + set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE) +endif() +if (SUPPORTED_LINKER_FLAGS) + set(DEFAULT_LINK_FLAGS ${SUPPORTED_LINKER_FLAGS} CACHE INTERNAL "Default C Linker Flags" FORCE) +endif() -- cgit