@@ -73,6 +73,8 @@ pub struct Config {
73
73
uses_cxx11 : bool ,
74
74
always_configure : bool ,
75
75
no_build_target : bool ,
76
+ verbose_cmake : bool ,
77
+ verbose_make : bool ,
76
78
}
77
79
78
80
/// Builds the native library rooted at `path` with the default cmake options.
@@ -117,6 +119,8 @@ impl Config {
117
119
uses_cxx11 : false ,
118
120
always_configure : true ,
119
121
no_build_target : false ,
122
+ verbose_cmake : false ,
123
+ verbose_make : false ,
120
124
}
121
125
}
122
126
@@ -253,6 +257,13 @@ impl Config {
253
257
self
254
258
}
255
259
260
+ /// Sets very verbose output.
261
+ pub fn very_verbose ( & mut self , value : bool ) -> & mut Config {
262
+ self . verbose_cmake = value;
263
+ self . verbose_make = value;
264
+ self
265
+ }
266
+
256
267
/// Run this configuration, compiling the library with all the configured
257
268
/// options.
258
269
///
@@ -319,6 +330,12 @@ impl Config {
319
330
// Build up the first cmake command to build the build system.
320
331
let executable = env:: var ( "CMAKE" ) . unwrap_or ( "cmake" . to_owned ( ) ) ;
321
332
let mut cmd = Command :: new ( executable) ;
333
+
334
+ if self . verbose_cmake {
335
+ cmd. arg ( "-Wdev" ) ;
336
+ cmd. arg ( "--debug-output" ) ;
337
+ }
338
+
322
339
cmd. arg ( & self . path )
323
340
. current_dir ( & build) ;
324
341
if target. contains ( "windows-gnu" ) {
@@ -506,6 +523,10 @@ impl Config {
506
523
cmd. arg ( & format ! ( "-DCMAKE_BUILD_TYPE={}" , profile) ) ;
507
524
}
508
525
526
+ if self . verbose_make {
527
+ cmd. arg ( "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" ) ;
528
+ }
529
+
509
530
if !self . defined ( "CMAKE_TOOLCHAIN_FILE" ) {
510
531
if let Ok ( s) = env:: var ( "CMAKE_TOOLCHAIN_FILE" ) {
511
532
cmd. arg ( & format ! ( "-DCMAKE_TOOLCHAIN_FILE={}" , s) ) ;
@@ -572,11 +593,12 @@ impl Config {
572
593
if !self . no_build_target {
573
594
cmd. arg ( "--target" ) . arg ( target) ;
574
595
}
596
+ cmd. arg ( "--config" ) . arg ( & profile)
597
+ . arg ( "--" ) . args ( & self . build_args )
598
+ . args ( & parallel_args)
599
+ . current_dir ( & build) ;
575
600
576
- run ( cmd. arg ( "--config" ) . arg ( & profile)
577
- . arg ( "--" ) . args ( & self . build_args )
578
- . args ( & parallel_args)
579
- . current_dir ( & build) , "cmake" ) ;
601
+ run ( & mut cmd, "cmake" ) ;
580
602
581
603
println ! ( "cargo:root={}" , dst. display( ) ) ;
582
604
return dst
0 commit comments