@@ -63,7 +63,12 @@ elemental logical function shared(self)
63
63
! > Instance of the library configuration
64
64
class(library_config_t), intent (in ) :: self
65
65
66
- shared = self% lib_type == " shared"
66
+ if (allocated (self% lib_type)) then
67
+ shared = self% lib_type == " shared"
68
+ else
69
+ shared = .false.
70
+ endif
71
+
67
72
end function shared
68
73
69
74
@@ -73,7 +78,11 @@ elemental logical function static(self)
73
78
! > Instance of the library configuration
74
79
class(library_config_t), intent (in ) :: self
75
80
76
- static = self% lib_type == " static"
81
+ if (allocated (self% lib_type)) then
82
+ static = self% lib_type == " static"
83
+ else
84
+ static = .false.
85
+ endif
77
86
end function static
78
87
79
88
@@ -109,18 +118,18 @@ subroutine new_library(self, table, error)
109
118
return
110
119
end if
111
120
121
+ if (has_list(table, " type" )) then
122
+ call syntax_error(error, " Manifest key [library.type] does not allow list input" )
123
+ return
124
+ end if
125
+
112
126
call get_value(table, " source-dir" , self% source_dir, " src" )
113
127
call get_value(table, " build-script" , self% build_script)
114
128
115
129
call get_list(table, " include-dir" , self% include_dir, error)
116
130
if (allocated (error)) return
117
131
118
- call get_value(table, " type" , self% lib_type, " monolithic" , stat= stat)
119
-
120
- if (stat /= toml_stat% success) then
121
- call fatal_error(error," Error while reading value for 'source-form' in fpm.toml, expecting logical" )
122
- return
123
- end if
132
+ call get_value(table, " type" , self% lib_type, " monolithic" )
124
133
125
134
select case (self% lib_type)
126
135
case (" shared" ," static" ," monolithic" )
@@ -135,6 +144,10 @@ subroutine new_library(self, table, error)
135
144
if (.not. allocated (self% include_dir)) then
136
145
self% include_dir = [string_t(" include" )]
137
146
end if
147
+
148
+ if (.not. allocated (self% lib_type)) then
149
+ self% lib_type = " monolithic"
150
+ end if
138
151
139
152
end subroutine new_library
140
153
0 commit comments