@@ -49,7 +49,7 @@ function(EnableCompilerFlag _flag _C _CXX _LD)
4949 endif ()
5050endfunction ()
5151
52- macro (ADD_ZSTD_COMPILATION_FLAGS)
52+ macro (ADD_ZSTD_COMPILATION_FLAGS _C _CXX _LD )
5353 # We set ZSTD_HAS_NOEXECSTACK if we are certain we've set all the required
5454 # compiler flags to mark the stack as non-executable.
5555 set (ZSTD_HAS_NOEXECSTACK false )
@@ -63,26 +63,26 @@ macro(ADD_ZSTD_COMPILATION_FLAGS)
6363 # EnableCompilerFlag("-std=c99" true false) # Set C compilation to c99 standard
6464 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND MSVC )
6565 # clang-cl normally maps -Wall to -Weverything.
66- EnableCompilerFlag("/clang:-Wall" true true false )
66+ EnableCompilerFlag("/clang:-Wall" _C _CXX false )
6767 else ()
68- EnableCompilerFlag("-Wall" true true false )
68+ EnableCompilerFlag("-Wall" _C _CXX false )
6969 endif ()
70- EnableCompilerFlag("-Wextra" true true false )
71- EnableCompilerFlag("-Wundef" true true false )
72- EnableCompilerFlag("-Wshadow" true true false )
73- EnableCompilerFlag("-Wcast-align" true true false )
74- EnableCompilerFlag("-Wcast-qual" true true false )
75- EnableCompilerFlag("-Wstrict-prototypes" true false false )
70+ EnableCompilerFlag("-Wextra" _C _CXX false )
71+ EnableCompilerFlag("-Wundef" _C _CXX false )
72+ EnableCompilerFlag("-Wshadow" _C _CXX false )
73+ EnableCompilerFlag("-Wcast-align" _C _CXX false )
74+ EnableCompilerFlag("-Wcast-qual" _C _CXX false )
75+ EnableCompilerFlag("-Wstrict-prototypes" _C false false )
7676 # Enable asserts in Debug mode
7777 if (CMAKE_BUILD_TYPE MATCHES "Debug" )
78- EnableCompilerFlag("-DDEBUGLEVEL=1" true true false )
78+ EnableCompilerFlag("-DDEBUGLEVEL=1" _C _CXX false )
7979 endif ()
8080 # Add noexecstack flags
8181 # LDFLAGS
82- EnableCompilerFlag("-Wl,-z,noexecstack" false false true )
82+ EnableCompilerFlag("-Wl,-z,noexecstack" false false _LD )
8383 # CFLAGS & CXXFLAGS
84- EnableCompilerFlag("-Qunused-arguments" true true false )
85- EnableCompilerFlag("-Wa,--noexecstack" true true false )
84+ EnableCompilerFlag("-Qunused-arguments" _C _CXX false )
85+ EnableCompilerFlag("-Wa,--noexecstack" _C _CXX false )
8686 # NOTE: Using 3 nested ifs because the variables are sometimes
8787 # empty if the condition is false, and sometimes equal to false.
8888 # This implicitly converts them to truthy values. There may be
@@ -99,15 +99,15 @@ macro(ADD_ZSTD_COMPILATION_FLAGS)
9999
100100 set (ACTIVATE_MULTITHREADED_COMPILATION "ON" CACHE BOOL "activate multi-threaded compilation (/MP flag)" )
101101 if (CMAKE_GENERATOR MATCHES "Visual Studio" AND ACTIVATE_MULTITHREADED_COMPILATION)
102- EnableCompilerFlag("/MP" true true false )
102+ EnableCompilerFlag("/MP" _C _CXX false )
103103 endif ()
104104
105105 # UNICODE SUPPORT
106- EnableCompilerFlag("/D_UNICODE" true true false )
107- EnableCompilerFlag("/DUNICODE" true true false )
106+ EnableCompilerFlag("/D_UNICODE" _C _CXX false )
107+ EnableCompilerFlag("/DUNICODE" _C _CXX false )
108108 # Enable asserts in Debug mode
109109 if (CMAKE_BUILD_TYPE MATCHES "Debug" )
110- EnableCompilerFlag("/DDEBUGLEVEL=1" true true false )
110+ EnableCompilerFlag("/DDEBUGLEVEL=1" _C _CXX false )
111111 endif ()
112112 endif ()
113113
0 commit comments