Skip to content

Commit

Permalink
Fix reading msvs version on Windows (#2644)
Browse files Browse the repository at this point in the history
* fix: fix reading msvs version on windows
  • Loading branch information
jgcook935 committed Jun 25, 2023
1 parent b030555 commit 53c99ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function configure (gyp, argv, callback) {
'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No'
)
if (win) {
findVisualStudio(release.semver, gyp.opts.msvs_version,
findVisualStudio(release.semver, gyp.opts['msvs-version'],
createConfigFile)
} else {
createPythonSymlink()
Expand Down
2 changes: 1 addition & 1 deletion lib/node-gyp.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ proto.configDefs = {
debug: Boolean, // 'build'
directory: String, // bin
make: String, // 'build'
msvs_version: String, // 'configure'
'msvs-version': String, // 'configure'
ensure: Boolean, // 'install'
solution: String, // 'build' (windows only)
proxy: String, // 'install'
Expand Down
9 changes: 9 additions & 0 deletions test/test-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,13 @@ describe('options', function () {

assert.strictEqual(g.opts['force-process-config'], 'true')
})

it('options with msvs_version', () => {
process.env.npm_config_msvs_version = '2017'

const g = gyp()
g.parseArgv(['rebuild']) // Also sets opts.argv.

assert.strictEqual(g.opts['msvs-version'], '2017')
})
})

0 comments on commit 53c99ae

Please sign in to comment.