]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
CMake: Keep build working even if lib/*.[ch] are removed.
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 17 Feb 2024 20:18:12 +0000 (22:18 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Mon, 19 Feb 2024 10:21:37 +0000 (12:21 +0200)
CMakeLists.txt

index 323533a49eb61768fde43ff1d34edcfea180cd75..79b6f95a468c7271821fec9d1709192be4f26a1e 100644 (file)
@@ -1336,7 +1336,12 @@ add_library(libgnu OBJECT)
 
 # CMake requires that even an object library must have at least once source
 # file. So we give it a header file that results in no output files.
-target_sources(libgnu PRIVATE lib/getopt.in.h)
+#
+# NOTE: Using a file outside the lib directory makes it possible to
+# delete lib/*.h and lib/*.c and still keep the build working if
+# getopt_long replacement isn't needed. It's convenient if one wishes
+# to be certain that no GNU LGPL code gets included in the binaries.
+target_sources(libgnu PRIVATE src/common/sysdefs.h)
 
 # The Ninja Generator requires setting the linker language since it cannot
 # guess the programming language of just a header file. Setting this