Skip to content

Commit

Permalink
Add config flag (#251)
Browse files Browse the repository at this point in the history
* add flag 'config'

* add config to options object

* Update README.md

* add paren to fix logic

Co-authored-by: Yulong Wang <yulongw@microsoft.com>
Co-authored-by: Nate Brake <nbrake@mmm.com>
  • Loading branch information
3 people committed Aug 11, 2021
1 parent 272c7ef commit c2f228b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -42,6 +42,8 @@ Options:
-d, --directory specify CMake project's directory (where CMakeLists.txt
located) [string]
-D, --debug build debug configuration [boolean]
-B, --config specify build configuration (Debug, RelWithDebInfo,
Release), will ignore '--debug' if specified [string]
-c, --cmake-path path of CMake executable [string]
-m, --prefer-make use Unix Makefiles even if Ninja is available (Posix)
[boolean]
Expand Down
9 changes: 8 additions & 1 deletion bin/cmake-js
Expand Up @@ -66,6 +66,12 @@ var yargs = require("yargs")
describe: "build debug configuration",
type: "boolean"
},
B: {
alias: "config",
demand: false,
describe: "specify build configuration (Debug, RelWithDebInfo, Release), will ignore '--debug' if specified",
type: "string"
},
c: {
alias: "cmake-path",
demand: false,
Expand Down Expand Up @@ -212,7 +218,8 @@ var options = {
arch: argv.a,
cMakeOptions: customOptions,
silent: argv.i,
out: argv.O
out: argv.O,
config: argv.B
};

log.verbose("CON", "options:");
Expand Down
2 changes: 1 addition & 1 deletion lib/cMake.js
Expand Up @@ -20,7 +20,7 @@ function CMake(options) {
this.dist = new Dist(this.options);
this.projectRoot = path.resolve(this.options.directory || process.cwd());
this.workDir = path.resolve(this.options.out || path.join(this.projectRoot, "build"));
this.config = this.options.debug ? "Debug" : "Release";
this.config = this.options.config || (this.options.debug ? "Debug" : "Release");
this.buildDir = path.join(this.workDir, this.config);
this._isAvailable = null;
this.targetOptions = new TargetOptions(this.options);
Expand Down

0 comments on commit c2f228b

Please sign in to comment.