@@ -74,10 +74,12 @@ module fpm_command_line
7474 logical :: prune= .true.
7575 character (len= :),allocatable :: compiler
7676 character (len= :),allocatable :: c_compiler
77+ character (len= :),allocatable :: cxx_compiler
7778 character (len= :),allocatable :: archiver
7879 character (len= :),allocatable :: profile
7980 character (len= :),allocatable :: flag
8081 character (len= :),allocatable :: cflag
82+ character (len= :),allocatable :: cxxflag
8183 character (len= :),allocatable :: ldflag
8284end type
8385
@@ -128,7 +130,7 @@ module fpm_command_line
128130& ' ' , ' fpm' , ' new' , ' build' , ' run' , ' clean' , &
129131& ' test' , ' runner' , ' install' , ' update' , ' list' , ' help' , ' version' ]
130132
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, &
132134 val_profile
133135
134136! '12345678901234567890123456789012345678901234567890123456789012345678901234567890',&
@@ -197,11 +199,12 @@ subroutine get_command_line_settings(cmd_settings)
197199 logical :: unix
198200 type (fpm_install_settings), allocatable :: install_settings
199201 character (len= :), allocatable :: common_args, compiler_args, run_args, working_dir, &
200- & c_compiler, archiver
202+ & c_compiler, cxx_compiler, archiver
201203
202204 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 = " "
205208 type (error_t), allocatable :: error
206209
207210 call set_help()
@@ -245,9 +248,11 @@ subroutine get_command_line_settings(cmd_settings)
245248 ' --no-prune F' // &
246249 ' --compiler "' // get_fpm_env(fc_env, fc_default)// ' "' // &
247250 ' --c-compiler "' // get_fpm_env(cc_env, cc_default)// ' "' // &
251+ ' --cxx-compiler "' // get_fpm_env(cxx_env, cxx_default)// ' "' // &
248252 ' --archiver "' // get_fpm_env(ar_env, ar_default)// ' "' // &
249253 ' --flag:: "' // get_fpm_env(fflags_env, flags_default)// ' "' // &
250254 ' --c-flag:: "' // get_fpm_env(cflags_env, flags_default)// ' "' // &
255+ ' --cxx-flag:: "' // get_fpm_env(cxxflags_env, flags_default)// ' "' // &
251256 ' --link-flag:: "' // get_fpm_env(ldflags_env, flags_default)// ' "'
252257
253258 ! now set subcommand-specific help text and process commandline
@@ -286,6 +291,7 @@ subroutine get_command_line_settings(cmd_settings)
286291 enddo
287292
288293 c_compiler = sget(' c-compiler' )
294+ cxx_compiler = sget(' cxx-compiler' )
289295 archiver = sget(' archiver' )
290296 allocate (fpm_run_settings :: cmd_settings)
291297 val_runner= sget(' runner' )
@@ -296,9 +302,11 @@ subroutine get_command_line_settings(cmd_settings)
296302 & prune= .not. lget(' no-prune' ), &
297303 & compiler= val_compiler, &
298304 & c_compiler= c_compiler, &
305+ & cxx_compiler= cxx_compiler, &
299306 & archiver= archiver, &
300307 & flag= val_flag, &
301308 & cflag= val_cflag, &
309+ & cxxflag= val_cxxflag, &
302310 & ldflag= val_ldflag, &
303311 & example= lget(' example' ), &
304312 & list= lget(' list' ),&
@@ -317,16 +325,19 @@ subroutine get_command_line_settings(cmd_settings)
317325 call check_build_vals()
318326
319327 c_compiler = sget(' c-compiler' )
328+ cxx_compiler = sget(' cxx-compiler' )
320329 archiver = sget(' archiver' )
321330 allocate ( fpm_build_settings :: cmd_settings )
322331 cmd_settings= fpm_build_settings( &
323332 & profile= val_profile,&
324333 & prune= .not. lget(' no-prune' ), &
325334 & compiler= val_compiler, &
326335 & c_compiler= c_compiler, &
336+ & cxx_compiler= cxx_compiler, &
327337 & archiver= archiver, &
328338 & flag= val_flag, &
329339 & cflag= val_cflag, &
340+ & cxxflag= val_cxxflag, &
330341 & ldflag= val_ldflag, &
331342 & list= lget(' list' ),&
332343 & show_model= lget(' show-model' ),&
@@ -470,6 +481,7 @@ subroutine get_command_line_settings(cmd_settings)
470481 call check_build_vals()
471482
472483 c_compiler = sget(' c-compiler' )
484+ cxx_compiler = sget(' cxx-compiler' )
473485 archiver = sget(' archiver' )
474486 allocate (install_settings)
475487 install_settings = fpm_install_settings(&
@@ -478,9 +490,11 @@ subroutine get_command_line_settings(cmd_settings)
478490 prune= .not. lget(' no-prune' ), &
479491 compiler= val_compiler, &
480492 c_compiler= c_compiler, &
493+ cxx_compiler= cxx_compiler, &
481494 archiver= archiver, &
482495 flag= val_flag, &
483496 cflag= val_cflag, &
497+ cxxflag= val_cxxflag, &
484498 ldflag= val_ldflag, &
485499 no_rebuild= lget(' no-rebuild' ), &
486500 verbose= lget(' verbose' ))
@@ -523,6 +537,7 @@ subroutine get_command_line_settings(cmd_settings)
523537 enddo
524538
525539 c_compiler = sget(' c-compiler' )
540+ cxx_compiler = sget(' cxx-compiler' )
526541 archiver = sget(' archiver' )
527542 allocate (fpm_test_settings :: cmd_settings)
528543 val_runner= sget(' runner' )
@@ -533,9 +548,11 @@ subroutine get_command_line_settings(cmd_settings)
533548 & prune= .not. lget(' no-prune' ), &
534549 & compiler= val_compiler, &
535550 & c_compiler= c_compiler, &
551+ & cxx_compiler= cxx_compiler, &
536552 & archiver= archiver, &
537553 & flag= val_flag, &
538554 & cflag= val_cflag, &
555+ & cxxflag= val_cxxflag, &
539556 & ldflag= val_ldflag, &
540557 & example= .false. , &
541558 & list= lget(' list' ), &
@@ -616,6 +633,7 @@ subroutine check_build_vals()
616633
617634 val_flag = " " // sget(' flag' )
618635 val_cflag = " " // sget(' c-flag' )
636+ val_cxxflag = " " // sget(' cxx-flag' )
619637 val_ldflag = " " // sget(' link-flag' )
620638 val_profile = sget(' profile' )
621639
0 commit comments