@@ -19,7 +19,7 @@ import {
1919 findPlatformForTriplet ,
2020 platformHasTriplet ,
2121} from "./platforms.js" ;
22- import { BaseOpts , Platform } from "./platforms/types.js" ;
22+ import { Platform } from "./platforms/types.js" ;
2323
2424// We're attaching a lot of listeners when spawning in parallel
2525EventEmitter . defaultMaxListeners = 100 ;
@@ -70,7 +70,7 @@ const buildPathOption = new Option(
7070 "Specify the build directory to store the configured CMake project" ,
7171)
7272 . argParser ( ( input ) => path . resolve ( process . cwd ( ) , input ) )
73- . default ( path . resolve ( process . cwd ( ) , "build" ) , ". /build") ;
73+ . default ( "{source} /build") ;
7474
7575const cleanOption = new Option (
7676 "--clean" ,
@@ -158,12 +158,15 @@ function expandTemplate(
158158
159159program = program . action (
160160 wrapAction ( async ( { triplet : requestedTriplets , ...baseOptions } ) => {
161- const buildPath = getBuildPath ( baseOptions ) ;
161+ baseOptions . build = path . resolve (
162+ process . cwd ( ) ,
163+ expandTemplate ( baseOptions . build , baseOptions ) ,
164+ ) ;
162165 baseOptions . out = path . resolve (
163166 process . cwd ( ) ,
164167 expandTemplate ( baseOptions . out , baseOptions ) ,
165168 ) ;
166- const { verbose, clean, source, out } = baseOptions ;
169+ const { verbose, clean, source, out, build : buildPath } = baseOptions ;
167170
168171 assertFixable (
169172 fs . existsSync ( path . join ( source , "CMakeLists.txt" ) ) ,
@@ -313,9 +316,4 @@ function getTripletsSummary(
313316 . join ( " / " ) ;
314317}
315318
316- function getBuildPath ( { build, source } : BaseOpts ) {
317- // TODO: Add configuration (debug vs release)
318- return path . resolve ( process . cwd ( ) , build || path . join ( source , "build" ) ) ;
319- }
320-
321319export { program } ;
0 commit comments