Skip to content

Commit ef57aab

Browse files
committed
Windows: fix error D8016: '/O2' and '/RTC1' command-line options are incompatible
1 parent 8109fd9 commit ef57aab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,15 @@ if(NOT EXISTS "${FILECHECK_SRC_FILE}")
112112
file(DOWNLOAD "${FILECHECK_SRC_URL}" "${FILECHECK_SRC_FILE}")
113113
endif()
114114
if(NOT TARGET FileCheck)
115+
string(REGEX REPLACE "/RTC[^ ]*" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") # Remove /RTC flags, they conflict with /O2.
115116
add_executable(FileCheck ${FILECHECK_SRC_FILE})
116117
llvm_map_components_to_libnames(FILECHECK_NEEDED_LIBS filecheck support)
117118
target_link_libraries(FileCheck ${FILECHECK_NEEDED_LIBS})
118119
endif()
119120

120121
# Optimize test utilities by default.
121122
if(MSVC)
122-
set_target_properties(FileCheck PROPERTIES COMPILE_FLAGS "${LLVM_DEFINITIONS} -w /O2 /GL /MT")
123+
set_target_properties(FileCheck PROPERTIES COMPILE_FLAGS "${LLVM_DEFINITIONS} /w /O2 /GL /MT")
123124
set_target_properties(libcx PROPERTIES COMPILE_FLAGS "/MT")
124125
set_target_properties(cx PROPERTIES COMPILE_FLAGS "/MT")
125126
else()

0 commit comments

Comments
 (0)