CMake: Keep build working even if lib/*.[ch] are removed.

This commit is contained in:
Lasse Collin 2024-02-17 22:18:12 +02:00
parent d753e2ce47
commit 2edd1a35b2
1 changed files with 6 additions and 1 deletions

View File

@ -1336,7 +1336,12 @@ add_library(libgnu OBJECT)
# CMake requires that even an object library must have at least once source # 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. # 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 # The Ninja Generator requires setting the linker language since it cannot
# guess the programming language of just a header file. Setting this # guess the programming language of just a header file. Setting this