@@ -62,6 +62,7 @@ pub struct Config {
62
62
path : PathBuf ,
63
63
generator : Option < OsString > ,
64
64
cflags : OsString ,
65
+ cxxflags : OsString ,
65
66
defines : Vec < ( OsString , OsString ) > ,
66
67
deps : Vec < String > ,
67
68
target : Option < String > ,
@@ -100,6 +101,7 @@ impl Config {
100
101
path : env:: current_dir ( ) . unwrap ( ) . join ( path) ,
101
102
generator : None ,
102
103
cflags : OsString :: new ( ) ,
104
+ cxxflags : OsString :: new ( ) ,
103
105
defines : Vec :: new ( ) ,
104
106
deps : Vec :: new ( ) ,
105
107
profile : None ,
@@ -117,14 +119,22 @@ impl Config {
117
119
self
118
120
}
119
121
120
- /// Adds a custom flag to pass down to the compiler, supplementing those
122
+ /// Adds a custom flag to pass down to the C compiler, supplementing those
121
123
/// that this library already passes.
122
124
pub fn cflag < P : AsRef < OsStr > > ( & mut self , flag : P ) -> & mut Config {
123
125
self . cflags . push ( " " ) ;
124
126
self . cflags . push ( flag. as_ref ( ) ) ;
125
127
self
126
128
}
127
129
130
+ /// Adds a custom flag to pass down to the C++ compiler, supplementing those
131
+ /// that this library already passes.
132
+ pub fn cxxflag < P : AsRef < OsStr > > ( & mut self , flag : P ) -> & mut Config {
133
+ self . cxxflags . push ( " " ) ;
134
+ self . cxxflags . push ( flag. as_ref ( ) ) ;
135
+ self
136
+ }
137
+
128
138
/// Adds a new `-D` flag to pass to cmake during the generation step.
129
139
pub fn define < K , V > ( & mut self , k : K , v : V ) -> & mut Config
130
140
where K : AsRef < OsStr > , V : AsRef < OsStr >
@@ -343,7 +353,7 @@ impl Config {
343
353
} ;
344
354
345
355
set_compiler ( "C" , & c_compiler, & self . cflags ) ;
346
- set_compiler ( "CXX" , & cxx_compiler, & OsString :: new ( ) ) ;
356
+ set_compiler ( "CXX" , & cxx_compiler, & self . cxxflags ) ;
347
357
}
348
358
349
359
if !self . defined ( "CMAKE_BUILD_TYPE" ) {
0 commit comments