@@ -166,6 +166,9 @@ impl CmakeBuilder {
166
166
// Allow environment to specify CMake toolchain.
167
167
if let Some ( toolchain) = optional_env_optional_crate_target ( "CMAKE_TOOLCHAIN_FILE" ) {
168
168
set_env_for_target ( "CMAKE_TOOLCHAIN_FILE" , toolchain) ;
169
+ if use_prebuilt_nasm ( ) {
170
+ self . configure_prebuilt_nasm ( & mut cmake_cfg) ;
171
+ }
169
172
return cmake_cfg;
170
173
}
171
174
// We only consider compiler CFLAGS when no cmake toolchain is set
@@ -244,7 +247,7 @@ impl CmakeBuilder {
244
247
} ;
245
248
emit_warning (
246
249
& format ! (
247
- "Neither script could be tested for execution, falling back to target-based selection: {}" ,
250
+ "Neither script could be tested for execution, falling back to target-based selection: {}" ,
248
251
fallback_script. file_name( ) . unwrap( ) . to_str( ) . unwrap( ) ) ) ;
249
252
fallback_script
250
253
}
@@ -304,42 +307,46 @@ impl CmakeBuilder {
304
307
}
305
308
}
306
309
if use_prebuilt_nasm ( ) {
307
- emit_warning ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ) ;
308
- emit_warning ( "!!! Using pre-built NASM binaries !!!" ) ;
309
- emit_warning ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ) ;
310
-
311
- let script_path = self . select_prebuilt_nasm_script ( ) ;
312
- let script_path = script_path. display ( ) . to_string ( ) ;
313
- let script_path = script_path. replace ( '\\' , "/" ) ;
314
-
315
- cmake_cfg. define ( "CMAKE_ASM_NASM_COMPILER" , script_path. as_str ( ) ) ;
316
- // Without the following definition, the build fails with a message similar to the one
317
- // reported here: https://gitlab.kitware.com/cmake/cmake/-/issues/19453
318
- // The variables below were found in the associated fix:
319
- // https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4257/diffs
320
- cmake_cfg. define (
321
- "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded" ,
322
- "" ,
323
- ) ;
324
- cmake_cfg. define (
325
- "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL" ,
326
- "" ,
327
- ) ;
328
- cmake_cfg. define (
329
- "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug" ,
330
- "" ,
331
- ) ;
332
- cmake_cfg. define (
333
- "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL" ,
334
- "" ,
335
- ) ;
336
- cmake_cfg. define (
337
- "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase" ,
338
- "" ,
339
- ) ;
310
+ self . configure_prebuilt_nasm ( cmake_cfg) ;
340
311
}
341
312
}
342
313
314
+ fn configure_prebuilt_nasm ( & self , cmake_cfg : & mut cmake:: Config ) {
315
+ emit_warning ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ) ;
316
+ emit_warning ( "!!! Using pre-built NASM binaries !!!" ) ;
317
+ emit_warning ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ) ;
318
+
319
+ let script_path = self . select_prebuilt_nasm_script ( ) ;
320
+ let script_path = script_path. display ( ) . to_string ( ) ;
321
+ let script_path = script_path. replace ( '\\' , "/" ) ;
322
+
323
+ cmake_cfg. define ( "CMAKE_ASM_NASM_COMPILER" , script_path. as_str ( ) ) ;
324
+ // Without the following definition, the build fails with a message similar to the one
325
+ // reported here: https://gitlab.kitware.com/cmake/cmake/-/issues/19453
326
+ // The variables below were found in the associated fix:
327
+ // https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4257/diffs
328
+ cmake_cfg. define (
329
+ "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded" ,
330
+ "" ,
331
+ ) ;
332
+ cmake_cfg. define (
333
+ "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL" ,
334
+ "" ,
335
+ ) ;
336
+ cmake_cfg. define (
337
+ "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug" ,
338
+ "" ,
339
+ ) ;
340
+ cmake_cfg. define (
341
+ "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL" ,
342
+ "" ,
343
+ ) ;
344
+ cmake_cfg. define (
345
+ "CMAKE_ASM_NASM_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase" ,
346
+ "" ,
347
+ ) ;
348
+ }
349
+
343
350
fn configure_open_harmony ( cmake_cfg : & mut cmake:: Config ) {
344
351
let mut cflags = vec ! [ "-Wno-unused-command-line-argument" ] ;
345
352
let mut asmflags = vec ! [ ] ;
0 commit comments