diff options
author | Jia Tan <jiat0218@gmail.com> | 2023-09-29 19:58:44 +0800 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-09-29 19:58:44 +0800 |
commit | 506d03127a8565442b028ec991e1578124fd3025 (patch) | |
tree | 58dedaf79bcd07a39622e63d2f8a803ca296e4f7 /CMakeLists.txt | |
parent | CMake: Fix Windows build with Clang/LLVM 17. (diff) | |
download | xz-506d03127a8565442b028ec991e1578124fd3025.tar.xz |
CMake: Specify LINKER_LANGUAGE for libgnu target to fix Ninja Generator.
CMake is unable to guess the linker language for just a header file so
it must be explicitly set.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ffb381b4..3e536a87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1008,6 +1008,12 @@ add_library(libgnu OBJECT) # file. So we give it a header file that results in no output files. target_sources(libgnu PRIVATE lib/getopt.in.h) +# The Ninja Generator requires setting the linker language since it cannot +# guess the programming language of just a header file. Setting this +# property avoids needing an empty .c file or an non-empty unnecessary .c +# file. +set_target_properties(libgnu PROPERTIES LINKER_LANGUAGE C) + # Create /lib directory in the build directory and add it to the include path. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") target_include_directories(libgnu PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/lib") |