Skip to content

Commit a107eaf

Browse files
committed
include all headers in sources.cmake
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent ab9ba06 commit a107eaf

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

helper.pl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,23 +222,31 @@ sub patch_file {
222222
}
223223

224224
sub make_sources_cmake {
225-
my @list = @_;
225+
my ($src_ref, $hdr_ref) = @_;
226+
my @sources = @{ $src_ref };
227+
my @headers = @{ $hdr_ref };
226228
my $output = "# SPDX-License-Identifier: Unlicense
227229
# Autogenerated File! Do not edit.
228230
229231
set(SOURCES\n";
230-
foreach my $obj (sort @list) {
231-
$output .= $obj . "\n";
232+
foreach my $sobj (sort @sources) {
233+
$output .= $sobj . "\n";
234+
}
235+
$output .= ")\n\nset(HEADERS\n";
236+
foreach my $hobj (sort @headers) {
237+
$output .= $hobj . "\n";
232238
}
233-
$output .= ")\n\nset(HEADERS\ntommath.h\n)\n";
239+
$output .= ")\n";
234240
return $output;
235241
}
236242

237243
sub process_makefiles {
238244
my $write = shift;
239245
my $changed_count = 0;
240-
my @o = map { my $x = $_; $x =~ s/\.c$/.o/; $x } bsd_glob("*.c");
241-
my @all = bsd_glob("*.{c,h}");
246+
my @headers = bsd_glob("*.h");
247+
my @sources = bsd_glob("*.c");
248+
my @o = map { my $x = $_; $x =~ s/\.c$/.o/; $x } @sources;
249+
my @all = sort(@sources, @headers);
242250

243251
my $var_o = prepare_variable("OBJECTS", @o);
244252
(my $var_obj = $var_o) =~ s/\.o\b/.obj/sg;
@@ -260,7 +268,7 @@ sub process_makefiles {
260268
for my $m (qw/ makefile makefile.shared makefile_include.mk makefile.msvc makefile.unix makefile.mingw sources.cmake /) {
261269
my $old = read_file($m);
262270
my $new = $m eq 'makefile.msvc' ? patch_file($old, $var_obj)
263-
: $m eq 'sources.cmake' ? make_sources_cmake(bsd_glob("*.c"))
271+
: $m eq 'sources.cmake' ? make_sources_cmake(\@sources, \@headers)
264272
: patch_file($old, $var_o);
265273

266274
if ($old ne $new) {

sources.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,9 @@ s_mp_zero_digs.c
161161

162162
set(HEADERS
163163
tommath.h
164+
tommath_c89.h
165+
tommath_class.h
166+
tommath_cutoffs.h
167+
tommath_private.h
168+
tommath_superclass.h
164169
)

0 commit comments

Comments
 (0)