Commit a107eafd84d55faf2612ccd352dd088db69fee10

Steffen Jaeckel 2022-03-22T13:49:36

include all headers in sources.cmake Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>

diff --git a/helper.pl b/helper.pl
index 3701799..e5ad27a 100755
--- a/helper.pl
+++ b/helper.pl
@@ -222,23 +222,31 @@ sub patch_file {
 }
 
 sub make_sources_cmake {
-  my @list = @_;
+  my ($src_ref, $hdr_ref) = @_;
+  my @sources = @{ $src_ref };
+  my @headers = @{ $hdr_ref };
   my $output = "# SPDX-License-Identifier: Unlicense
 # Autogenerated File! Do not edit.
 
 set(SOURCES\n";
-  foreach my $obj (sort @list) {
-    $output .= $obj . "\n";
+  foreach my $sobj (sort @sources) {
+    $output .= $sobj . "\n";
+  }
+  $output .= ")\n\nset(HEADERS\n";
+  foreach my $hobj (sort @headers) {
+    $output .= $hobj . "\n";
   }
-  $output .= ")\n\nset(HEADERS\ntommath.h\n)\n";
+  $output .= ")\n";
   return $output;
 }
 
 sub process_makefiles {
   my $write = shift;
   my $changed_count = 0;
-  my @o = map { my $x = $_; $x =~ s/\.c$/.o/; $x } bsd_glob("*.c");
-  my @all = bsd_glob("*.{c,h}");
+  my @headers = bsd_glob("*.h");
+  my @sources = bsd_glob("*.c");
+  my @o = map { my $x = $_; $x =~ s/\.c$/.o/; $x } @sources;
+  my @all = sort(@sources, @headers);
 
   my $var_o = prepare_variable("OBJECTS", @o);
   (my $var_obj = $var_o) =~ s/\.o\b/.obj/sg;
@@ -260,7 +268,7 @@ sub process_makefiles {
   for my $m (qw/ makefile makefile.shared makefile_include.mk makefile.msvc makefile.unix makefile.mingw sources.cmake /) {
     my $old = read_file($m);
     my $new = $m eq 'makefile.msvc' ? patch_file($old, $var_obj)
-            : $m eq 'sources.cmake' ? make_sources_cmake(bsd_glob("*.c"))
+            : $m eq 'sources.cmake' ? make_sources_cmake(\@sources, \@headers)
             :                         patch_file($old, $var_o);
 
     if ($old ne $new) {
diff --git a/sources.cmake b/sources.cmake
index 2bc8911..797d461 100644
--- a/sources.cmake
+++ b/sources.cmake
@@ -161,4 +161,9 @@ s_mp_zero_digs.c
 
 set(HEADERS
 tommath.h
+tommath_c89.h
+tommath_class.h
+tommath_cutoffs.h
+tommath_private.h
+tommath_superclass.h
 )