Disable Clang's return-type-c-linkage warning (#3227)

* Disable return-type-c-linkage warning on Clang.

This is emitted by the compiler when it can't tell if the incomplete
type being returned is a C++ type, which might not have a C-compatible
layout. In `taskchampion.h`, the types are not C++ types so this is not
an issue and the warning is unnecessary.

* Use an if instead

Fancy generator expressions appear to not work.

* Try some different CMake syntax
This commit is contained in:
Dustin J. Mitchell 2024-01-20 16:41:38 -05:00 committed by GitHub
parent b515f876ca
commit 80047ad5e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -125,6 +125,11 @@ if (SOLARIS)
endif (NSL_LIBRARY)
endif (SOLARIS)
# Disable the Clang return-type-c-linkage warning globally. See #3225.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
endif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
message ("-- Configuring cmake.h")
configure_file (
${CMAKE_SOURCE_DIR}/cmake.h.in