3333! >
3434! > Each of the subtables currently supports the following fields:
3535! >```toml
36- ! >[profile .debug.gfortran.linux]
36+ ! >[profiles .debug.gfortran.linux]
3737! > flags="-Wall -g -Og"
3838! > c-flags="-g O1"
39+ ! > cxx-flags="-g O1"
3940! > link-time-flags="-xlinkopt"
4041! > files={"hello_world.f90"="-Wall -O3"}
4142! >```
@@ -84,6 +85,9 @@ module fpm_manifest_profile
8485 ! > C compiler flags
8586 character (len= :), allocatable :: c_flags
8687
88+ ! > C++ compiler flags
89+ character (len= :), allocatable :: cxx_flags
90+
8791 ! > Link time compiler flags
8892 character (len= :), allocatable :: link_time_flags
8993
@@ -103,7 +107,8 @@ module fpm_manifest_profile
103107 contains
104108
105109 ! > Construct a new profile configuration from a TOML data structure
106- function new_profile (profile_name , compiler , os_type , flags , c_flags , link_time_flags , file_scope_flags , is_built_in ) &
110+ function new_profile (profile_name , compiler , os_type , flags , c_flags , cxx_flags , &
111+ link_time_flags , file_scope_flags , is_built_in ) &
107112 & result(profile)
108113
109114 ! > Name of the profile
@@ -121,6 +126,9 @@ function new_profile(profile_name, compiler, os_type, flags, c_flags, link_time_
121126 ! > C compiler flags
122127 character (len=* ), optional , intent (in ) :: c_flags
123128
129+ ! > C++ compiler flags
130+ character (len=* ), optional , intent (in ) :: cxx_flags
131+
124132 ! > Link time compiler flags
125133 character (len=* ), optional , intent (in ) :: link_time_flags
126134
@@ -145,6 +153,11 @@ function new_profile(profile_name, compiler, os_type, flags, c_flags, link_time_
145153 else
146154 profile% c_flags = " "
147155 end if
156+ if (present (cxx_flags)) then
157+ profile% cxx_flags = cxx_flags
158+ else
159+ profile% cxx_flags = " "
160+ end if
148161 if (present (link_time_flags)) then
149162 profile% link_time_flags = link_time_flags
150163 else
@@ -239,7 +252,7 @@ subroutine validate_profile_table(profile_name, compiler_name, key_list, table,
239252 ! > Was called with valid operating system
240253 logical , intent (in ) :: os_valid
241254
242- character (len= :), allocatable :: flags, c_flags, link_time_flags, key_name, file_name, file_flags, err_message
255+ character (len= :), allocatable :: flags, c_flags, cxx_flags, link_time_flags, key_name, file_name, file_flags, err_message
243256 type (toml_table), pointer :: files
244257 type (toml_key), allocatable :: file_list(:)
245258 integer :: ikey, ifile, stat
@@ -260,6 +273,12 @@ subroutine validate_profile_table(profile_name, compiler_name, key_list, table,
260273 call syntax_error(error, " c-flags has to be a key-value pair" )
261274 return
262275 end if
276+ else if (key_name.eq. ' cxx-flags' ) then
277+ call get_value(table, ' cxx-flags' , cxx_flags, stat= stat)
278+ if (stat /= toml_stat% success) then
279+ call syntax_error(error, " cxx-flags has to be a key-value pair" )
280+ return
281+ end if
263282 else if (key_name.eq. ' link-time-flags' ) then
264283 call get_value(table, ' link-time-flags' , link_time_flags, stat= stat)
265284 if (stat /= toml_stat% success) then
@@ -324,7 +343,7 @@ subroutine get_flags(profile_name, compiler_name, os_type, key_list, table, prof
324343 ! > Was called with valid operating system
325344 logical , intent (in ) :: os_valid
326345
327- character (len= :), allocatable :: flags, c_flags, link_time_flags, key_name, file_name, file_flags, err_message
346+ character (len= :), allocatable :: flags, c_flags, cxx_flags, link_time_flags, key_name, file_name, file_flags, err_message
328347 type (toml_table), pointer :: files
329348 type (toml_key), allocatable :: file_list(:)
330349 type (file_scope_flag), allocatable :: file_scope_flags(:)
@@ -333,6 +352,7 @@ subroutine get_flags(profile_name, compiler_name, os_type, key_list, table, prof
333352
334353 call get_value(table, ' flags' , flags)
335354 call get_value(table, ' c-flags' , c_flags)
355+ call get_value(table, ' cxx-flags' , cxx_flags)
336356 call get_value(table, ' link-time-flags' , link_time_flags)
337357 call get_value(table, ' files' , files)
338358 if (associated (files)) then
@@ -350,7 +370,7 @@ subroutine get_flags(profile_name, compiler_name, os_type, key_list, table, prof
350370 end if
351371
352372 profiles(profindex) = new_profile(profile_name, compiler_name, os_type, &
353- & flags, c_flags, link_time_flags, file_scope_flags)
373+ & flags, c_flags, cxx_flags, link_time_flags, file_scope_flags)
354374 profindex = profindex + 1
355375 end subroutine get_flags
356376
@@ -656,6 +676,8 @@ subroutine new_profiles(profiles, table, error)
656676 & " " // profiles(iprof)% flags
657677 profiles(profindex)% c_flags= profiles(profindex)% c_flags// &
658678 & " " // profiles(iprof)% c_flags
679+ profiles(profindex)% cxx_flags= profiles(profindex)% cxx_flags// &
680+ & " " // profiles(iprof)% cxx_flags
659681 profiles(profindex)% link_time_flags= profiles(profindex)% link_time_flags// &
660682 & " " // profiles(iprof)% link_time_flags
661683 end if
@@ -861,6 +883,7 @@ function info_profile(profile) result(s)
861883 end select
862884 if (allocated (profile% flags)) s = s // ' , flags="' // profile% flags // ' "'
863885 if (allocated (profile% c_flags)) s = s // ' , c_flags="' // profile% c_flags // ' "'
886+ if (allocated (profile% cxx_flags)) s = s // ' , cxx_flags="' // profile% cxx_flags // ' "'
864887 if (allocated (profile% link_time_flags)) s = s // ' , link_time_flags="' // profile% link_time_flags // ' "'
865888 if (allocated (profile% file_scope_flags)) then
866889 do i= 1 ,size (profile% file_scope_flags)
0 commit comments