Skip to content

Commit 050b869

Browse files
committed
Attempt to fix setting MSVC runtime for sub-build.
1 parent ddd952e commit 050b869

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

cmake/external_rules.cmake

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,19 @@ function(build_external_dependencies)
156156
set(SUBBUILD_MSVC_RUNTIME_FLAG "/MTd")
157157
set(CMAKE_SUB_CONFIGURE_OPTIONS
158158
${CMAKE_SUB_CONFIGURE_OPTIONS}
159+
-DCMAKE_C_FLAGS_RELEASE="/MT"
160+
-DCMAKE_C_FLAGS_DEBUG="/MTd"
161+
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
162+
-DCMAKE_CXX_FLAGS_DEBUG="/MTd"
159163
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug)
160164
else()
161165
set(SUBBUILD_MSVC_RUNTIME_FLAG "/MDd")
162166
set(CMAKE_SUB_CONFIGURE_OPTIONS
163167
${CMAKE_SUB_CONFIGURE_OPTIONS}
168+
-DCMAKE_C_FLAGS_RELEASE="/MD"
169+
-DCMAKE_C_FLAGS_DEBUG="/MDd"
170+
-DCMAKE_CXX_FLAGS_RELEASE="/MD"
171+
-DCMAKE_CXX_FLAGS_DEBUG="/MDd"
164172
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL)
165173
endif()
166174
else()
@@ -169,11 +177,19 @@ function(build_external_dependencies)
169177
set(SUBBUILD_MSVC_RUNTIME_FLAG "/MT")
170178
set(CMAKE_SUB_CONFIGURE_OPTIONS
171179
${CMAKE_SUB_CONFIGURE_OPTIONS}
180+
-DCMAKE_C_FLAGS_RELEASE="/MT"
181+
-DCMAKE_C_FLAGS_DEBUG="/MTd"
182+
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
183+
-DCMAKE_CXX_FLAGS_DEBUG="/MTd"
172184
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded)
173185
else()
174186
set(SUBBUILD_MSVC_RUNTIME_FLAG "/MD")
175187
set(CMAKE_SUB_CONFIGURE_OPTIONS
176-
${CMAKE_SUB_CONFIGURE_OPTIONS}
188+
${CMAKE_SUB_CONFIGURE_OPTIONS}
189+
-DCMAKE_C_FLAGS_RELEASE="/MD"
190+
-DCMAKE_C_FLAGS_DEBUG="/MDd"
191+
-DCMAKE_CXX_FLAGS_RELEASE="/MD"
192+
-DCMAKE_CXX_FLAGS_DEBUG="/MDd"
177193
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL)
178194
endif()
179195
endif()

0 commit comments

Comments
 (0)