D18547: Don't enable -Wzero-as-null-pointer-constant on apple clang

René J.V. Bertin noreply at phabricator.kde.org
Sat Jan 26 13:13:06 GMT 2019


rjvbb requested changes to this revision.
rjvbb added a comment.
This revision now requires changes to proceed.


  See also https://phabricator.kde.org/D16894 which (initially) aimed to tackle this in a more general fashion.
  
  IMHO the way forward (if my proposal is not acceptable) is to replace the existing clang version check with an actual test if the compiler supports the flac (CXXCompilerCheckFlag IIRC):
  
    if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 
      if (CXXCompilerCheckFlag("-foo")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} foo")
      endif()
    endif()
  
  That avoids the overhead when GCC is used but also won't give false positives or negatives when clang is used because the compiler/version detection was just off.

INLINE COMMENTS

> KDEFrameworkCompilerSettings.cmake:75
> +# don't enable with apple clang
> +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
>     if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")

I'm amazed that this works because CMake *may* detect Apple's clang as AppleClang depending on version and how policy 25 (IIRC) is set. Annoyingly that policy can only be set before the toplevel project statement, i.e. not in the ECM.

In addition, Apple's versioning is very hard if not impossible to match with upstream versioning.

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D18547

To: vonreth, aacid, apol, dfaure, rjvbb, bcooksley
Cc: aacid, kde-frameworks-devel, kde-buildsystem, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-buildsystem/attachments/20190126/786fc8f7/attachment.html>


More information about the Kde-buildsystem mailing list