cmake: Only set default flags if they have been detected
authorAndreas Schneider <asn@samba.org>
Wed, 7 Nov 2018 08:25:54 +0000 (09:25 +0100)
committerAndreas Schneider <asn@samba.org>
Wed, 7 Nov 2018 14:29:44 +0000 (15:29 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
CompilerChecks.cmake

index 5e9d8301ece9ed8b77b960cffe1a56776745c771..4fa1a83d16fdf7a7468926e0bb13e07e4f1fec6f 100644 (file)
@@ -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()