Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a2a075

Browse files
committed
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 <[email protected]>
1 parent 0a8c445 commit 1a2a075

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

newt/builder/cmake.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,16 @@ func (b *Builder) CMakeBuildPackageWrite(w io.Writer, bpkg *BuildPackage,
194194
}
195195

196196
pkgName := bpkg.rpkg.Lpkg.NameWithRepo()
197+
object_library := ""
198+
if bpkg.ci.WholeArch {
199+
object_library = "OBJECT "
200+
}
197201

198202
util.StatusMessage(util.VERBOSITY_DEFAULT, "Generating CMakeLists.txt for %s\n", pkgName)
199203
fmt.Fprintf(w, "\n# Generating CMakeLists.txt for %s\n", pkgName)
200-
fmt.Fprintf(w, "add_library(%s %s)\n",
204+
fmt.Fprintf(w, "add_library(%s %s%s)\n",
201205
EscapePkgName(pkgName),
206+
object_library,
202207
strings.Join(files, " "))
203208
archivePath := trimProjectPath(filepath.Dir(b.ArchivePath(bpkg)))
204209
CmakeCompilerInfoWrite(w, archivePath, bpkg, entries[0], otherIncludes)

0 commit comments

Comments
 (0)