cmake: Check for -Wno-bad-function-cast
authorAndreas Schneider <asn@samba.org>
Fri, 25 Jun 2021 08:52:14 +0000 (10:52 +0200)
committerAndreas Schneider <asn@samba.org>
Fri, 25 Jun 2021 09:08:08 +0000 (11:08 +0200)
Fixes the build on freebsd.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
CompilerChecks.cmake
src/python/CMakeLists.txt

index 4fa1a83d16fdf7a7468926e0bb13e07e4f1fec6f..6c74b0bb2ee3e8dc570a566560897dbb45e1ec6b 100644 (file)
@@ -95,6 +95,9 @@ if (UNIX)
         add_c_compiler_flag("-Wno-error=tautological-compare" SUPPORTED_COMPILER_FLAGS)
     endif()
 
+    # Needed by src/python/CMakeLists.txt
+    check_c_compiler_flag("-Wno-cast-function-type" WITH_WNO_CAST_FUNCTION_TYPE)
+
     # Unset CMAKE_REQUIRED_FLAGS
     unset(CMAKE_REQUIRED_FLAGS)
 endif()
index e8730d92f90673a725777f95195e9422a582b25e..faaf56914a22d7d5a2b654a1348546eeff366314 100644 (file)
@@ -3,6 +3,8 @@ project(pypamtest C)
 add_subdirectory(python2)
 add_subdirectory(python3)
 
-set_source_files_properties(pypamtest.c
-                            DIRECTORY python2 python3
-                            PROPERTIES COMPILE_OPTIONS "-Wno-cast-function-type")
+if (WITH_WNO_CAST_FUNCTION_TYPE)
+    set_source_files_properties(pypamtest.c
+                                DIRECTORY python2 python3
+                                PROPERTIES COMPILE_OPTIONS "-Wno-cast-function-type")
+endif()