@@ -74,10 +74,12 @@ module fpm_command_line
74
74
logical :: prune= .true.
75
75
character (len= :),allocatable :: compiler
76
76
character (len= :),allocatable :: c_compiler
77
+ character (len= :),allocatable :: cxx_compiler
77
78
character (len= :),allocatable :: archiver
78
79
character (len= :),allocatable :: profile
79
80
character (len= :),allocatable :: flag
80
81
character (len= :),allocatable :: cflag
82
+ character (len= :),allocatable :: cxxflag
81
83
character (len= :),allocatable :: ldflag
82
84
end type
83
85
@@ -128,7 +130,7 @@ module fpm_command_line
128
130
& ' ' , ' fpm' , ' new' , ' build' , ' run' , ' clean' , &
129
131
& ' test' , ' runner' , ' install' , ' update' , ' list' , ' help' , ' version' ]
130
132
131
- character (len= :), allocatable :: val_runner, val_compiler, val_flag, val_cflag, val_ldflag, &
133
+ character (len= :), allocatable :: val_runner, val_compiler, val_flag, val_cflag, val_cxxflag, val_ldflag, &
132
134
val_profile
133
135
134
136
! '12345678901234567890123456789012345678901234567890123456789012345678901234567890',&
@@ -197,11 +199,12 @@ subroutine get_command_line_settings(cmd_settings)
197
199
logical :: unix
198
200
type (fpm_install_settings), allocatable :: install_settings
199
201
character (len= :), allocatable :: common_args, compiler_args, run_args, working_dir, &
200
- & c_compiler, archiver
202
+ & c_compiler, cxx_compiler, archiver
201
203
202
204
character (len=* ), parameter :: fc_env = " FC" , cc_env = " CC" , ar_env = " AR" , &
203
- & fflags_env = " FFLAGS" , cflags_env = " CFLAGS" , ldflags_env = " LDFLAGS" , &
204
- & fc_default = " gfortran" , cc_default = " " , ar_default = " " , flags_default = " "
205
+ & fflags_env = " FFLAGS" , cflags_env = " CFLAGS" , cxxflags_env = " CXXFLAGS" , ldflags_env = " LDFLAGS" , &
206
+ & fc_default = " gfortran" , cc_default = " " , ar_default = " " , flags_default = " " , &
207
+ & cxx_env = " CXX" , cxx_default = " "
205
208
type (error_t), allocatable :: error
206
209
207
210
call set_help()
@@ -245,9 +248,11 @@ subroutine get_command_line_settings(cmd_settings)
245
248
' --no-prune F' // &
246
249
' --compiler "' // get_fpm_env(fc_env, fc_default)// ' "' // &
247
250
' --c-compiler "' // get_fpm_env(cc_env, cc_default)// ' "' // &
251
+ ' --cxx-compiler "' // get_fpm_env(cxx_env, cxx_default)// ' "' // &
248
252
' --archiver "' // get_fpm_env(ar_env, ar_default)// ' "' // &
249
253
' --flag:: "' // get_fpm_env(fflags_env, flags_default)// ' "' // &
250
254
' --c-flag:: "' // get_fpm_env(cflags_env, flags_default)// ' "' // &
255
+ ' --cxx-flag:: "' // get_fpm_env(cxxflags_env, flags_default)// ' "' // &
251
256
' --link-flag:: "' // get_fpm_env(ldflags_env, flags_default)// ' "'
252
257
253
258
! now set subcommand-specific help text and process commandline
@@ -286,6 +291,7 @@ subroutine get_command_line_settings(cmd_settings)
286
291
enddo
287
292
288
293
c_compiler = sget(' c-compiler' )
294
+ cxx_compiler = sget(' cxx-compiler' )
289
295
archiver = sget(' archiver' )
290
296
allocate (fpm_run_settings :: cmd_settings)
291
297
val_runner= sget(' runner' )
@@ -296,9 +302,11 @@ subroutine get_command_line_settings(cmd_settings)
296
302
& prune= .not. lget(' no-prune' ), &
297
303
& compiler= val_compiler, &
298
304
& c_compiler= c_compiler, &
305
+ & cxx_compiler= cxx_compiler, &
299
306
& archiver= archiver, &
300
307
& flag= val_flag, &
301
308
& cflag= val_cflag, &
309
+ & cxxflag= val_cxxflag, &
302
310
& ldflag= val_ldflag, &
303
311
& example= lget(' example' ), &
304
312
& list= lget(' list' ),&
@@ -317,16 +325,19 @@ subroutine get_command_line_settings(cmd_settings)
317
325
call check_build_vals()
318
326
319
327
c_compiler = sget(' c-compiler' )
328
+ cxx_compiler = sget(' cxx-compiler' )
320
329
archiver = sget(' archiver' )
321
330
allocate ( fpm_build_settings :: cmd_settings )
322
331
cmd_settings= fpm_build_settings( &
323
332
& profile= val_profile,&
324
333
& prune= .not. lget(' no-prune' ), &
325
334
& compiler= val_compiler, &
326
335
& c_compiler= c_compiler, &
336
+ & cxx_compiler= cxx_compiler, &
327
337
& archiver= archiver, &
328
338
& flag= val_flag, &
329
339
& cflag= val_cflag, &
340
+ & cxxflag= val_cxxflag, &
330
341
& ldflag= val_ldflag, &
331
342
& list= lget(' list' ),&
332
343
& show_model= lget(' show-model' ),&
@@ -470,6 +481,7 @@ subroutine get_command_line_settings(cmd_settings)
470
481
call check_build_vals()
471
482
472
483
c_compiler = sget(' c-compiler' )
484
+ cxx_compiler = sget(' cxx-compiler' )
473
485
archiver = sget(' archiver' )
474
486
allocate (install_settings)
475
487
install_settings = fpm_install_settings(&
@@ -478,9 +490,11 @@ subroutine get_command_line_settings(cmd_settings)
478
490
prune= .not. lget(' no-prune' ), &
479
491
compiler= val_compiler, &
480
492
c_compiler= c_compiler, &
493
+ cxx_compiler= cxx_compiler, &
481
494
archiver= archiver, &
482
495
flag= val_flag, &
483
496
cflag= val_cflag, &
497
+ cxxflag= val_cxxflag, &
484
498
ldflag= val_ldflag, &
485
499
no_rebuild= lget(' no-rebuild' ), &
486
500
verbose= lget(' verbose' ))
@@ -523,6 +537,7 @@ subroutine get_command_line_settings(cmd_settings)
523
537
enddo
524
538
525
539
c_compiler = sget(' c-compiler' )
540
+ cxx_compiler = sget(' cxx-compiler' )
526
541
archiver = sget(' archiver' )
527
542
allocate (fpm_test_settings :: cmd_settings)
528
543
val_runner= sget(' runner' )
@@ -533,9 +548,11 @@ subroutine get_command_line_settings(cmd_settings)
533
548
& prune= .not. lget(' no-prune' ), &
534
549
& compiler= val_compiler, &
535
550
& c_compiler= c_compiler, &
551
+ & cxx_compiler= cxx_compiler, &
536
552
& archiver= archiver, &
537
553
& flag= val_flag, &
538
554
& cflag= val_cflag, &
555
+ & cxxflag= val_cxxflag, &
539
556
& ldflag= val_ldflag, &
540
557
& example= .false. , &
541
558
& list= lget(' list' ), &
@@ -616,6 +633,7 @@ subroutine check_build_vals()
616
633
617
634
val_flag = " " // sget(' flag' )
618
635
val_cflag = " " // sget(' c-flag' )
636
+ val_cxxflag = " " // sget(' cxx-flag' )
619
637
val_ldflag = " " // sget(' link-flag' )
620
638
val_profile = sget(' profile' )
621
639
0 commit comments