]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Improve defines for third_party_lib
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 30 May 2021 18:20:07 +0000 (20:20 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 30 May 2021 18:39:38 +0000 (20:39 +0200)
- Don’t filter out useful warnings like warning about implicit function
  declarations.
- Apply definitions in config.h to third party source code instead of
  passing feature defines as a special case.

src/third_party/CMakeLists.txt

index d091b87b1300e5a7bd242eefddd33f727e4ae8e3..14dce921603f54d5a890b14a5522d5ca635895d9 100644 (file)
@@ -10,9 +10,14 @@ if(WIN32)
   target_sources(third_party_lib PRIVATE win32/mktemp.c)
 endif ()
 
+if(MSVC)
+  target_compile_options(third_party_lib PRIVATE /FI ${CMAKE_BINARY_DIR}/config.h)
+else()
+  target_compile_options(third_party_lib PRIVATE -include ${CMAKE_BINARY_DIR}/config.h)
+endif()
+
 if(ENABLE_TRACING)
   target_sources(third_party_lib PRIVATE minitrace.c)
-  set_source_files_properties(minitrace.c PROPERTIES COMPILE_DEFINITIONS "MTR_ENABLED;_POSIX_C_SOURCE=200809L")
 endif()
 
 set(xxhdispatchtest [=[
@@ -46,22 +51,6 @@ target_include_directories(
 target_link_libraries(third_party_lib PRIVATE standard_settings)
 target_link_libraries(third_party_lib INTERFACE blake3)
 
-# These warnings are enabled by default even without e.g. -Wall, but we don't
-# want them in third_party.
-if(CMAKE_CXX_COMPILER_ID MATCHES "^GNU|Clang$")
-  target_compile_options(
-    third_party_lib
-    PRIVATE
-      $<$<COMPILE_LANGUAGE:C>:-Wno-implicit-function-declaration
-      -Wno-int-conversion>)
-endif()
-
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
-  target_compile_options(
-    third_party_lib
-    PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-attributes>)
-endif()
-
 # Silence warning from winbase.h due to /Zc:preprocessor.
 if(MSVC)
   target_compile_options(
@@ -69,10 +58,4 @@ if(MSVC)
     PRIVATE /wd5105)
 endif()
 
-# The headers are included from the rest of the project, so turn off warnings as
-# required.
-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-  target_compile_options(third_party_lib INTERFACE -Wno-shadow)
-endif()
-
 add_subdirectory(blake3)