You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2025/09/02 13:15:35 UTC

(mynewt-newt) branch master updated: cmake: Handle whole-archive

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a2a075e cmake: Handle whole-archive
1a2a075e is described below

commit 1a2a075e7789c1ee1c70e2eda3afd32cf2fd091c
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Aug 22 13:04:38 2025 +0200

    cmake: Handle whole-archive
    
    Whole archive flag was ignored in generated
    CMakeList.txt file.
    
    Now packages with whole archive flags are
    marked as OBJECT library and .a files are not
    created for them.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 newt/builder/cmake.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/newt/builder/cmake.go b/newt/builder/cmake.go
index 5182fc74..a6947462 100644
--- a/newt/builder/cmake.go
+++ b/newt/builder/cmake.go
@@ -194,11 +194,16 @@ func (b *Builder) CMakeBuildPackageWrite(w io.Writer, bpkg *BuildPackage,
 	}
 
 	pkgName := bpkg.rpkg.Lpkg.NameWithRepo()
+	object_library := ""
+	if bpkg.ci.WholeArch {
+		object_library = "OBJECT "
+	}
 
 	util.StatusMessage(util.VERBOSITY_DEFAULT, "Generating CMakeLists.txt for %s\n", pkgName)
 	fmt.Fprintf(w, "\n# Generating CMakeLists.txt for %s\n", pkgName)
-	fmt.Fprintf(w, "add_library(%s %s)\n",
+	fmt.Fprintf(w, "add_library(%s %s%s)\n",
 		EscapePkgName(pkgName),
+		object_library,
 		strings.Join(files, " "))
 	archivePath := trimProjectPath(filepath.Dir(b.ArchivePath(bpkg)))
 	CmakeCompilerInfoWrite(w, archivePath, bpkg, entries[0], otherIncludes)