Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config flag #251

Merged
merged 4 commits into from Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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