From 80047ad5e72fb3d85a1c4be3b2d12637c6891b62 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sat, 20 Jan 2024 16:41:38 -0500 Subject: [PATCH] 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 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1533d1de7..117bc9dc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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