Skip to content

Commit 7ed2baf

Browse files
committed
MSVC: ignore empty compilation units (warning LNK4221)
A number of source files have their implementation #ifdef'd out (because they target another platform). MSVC warns on empty compilation units (with warning LNK4221). Ignore warning 4221 when creating the object library.
1 parent 3fba589 commit 7ed2baf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ IF (MSVC)
164164
# /O1 - Optimize for size
165165
SET(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /O1 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
166166

167+
# /IGNORE:4221 - Ignore empty compilation units
168+
SET(CMAKE_STATIC_LINKER_FLAGS "/IGNORE:4221")
169+
167170
# /DYNAMICBASE - Address space load randomization (ASLR)
168171
# /NXCOMPAT - Data execution prevention (DEP)
169172
# /LARGEADDRESSAWARE - >2GB user address space on x86

0 commit comments

Comments
 (0)