git: fefa4a2944e6 - main - cad/kicad: fix clang options on 32bit platforms

From: Christoph Moench-Tegeder <cmt_at_FreeBSD.org>
Date: Tue, 21 Feb 2023 20:31:56 UTC
The branch main has been updated by cmt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fefa4a2944e6c3a0d1072291c8b1489c08dff530

commit fefa4a2944e6c3a0d1072291c8b1489c08dff530
Author:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2023-02-21 20:30:04 +0000
Commit:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2023-02-21 20:30:04 +0000

    cad/kicad: fix clang options on 32bit platforms
    
    The -ffloat-store option exists on gcc only, so do not add it
    to the clang command line.
---
 cad/kicad/files/patch-CMakeLists.txt | 40 ++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/cad/kicad/files/patch-CMakeLists.txt b/cad/kicad/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..555276a0bd83
--- /dev/null
+++ b/cad/kicad/files/patch-CMakeLists.txt
@@ -0,0 +1,40 @@
+commit 46a59aa2c3e23aa5dd5243e697eb29f8da680e03
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+Date:   Tue Feb 21 20:45:27 2023 +0100
+
+    CMakeLists.txt: do not use -ffloat-store on clang
+    
+    According to it's User Manual, clang does not know about -ffloat-store.
+    This is corrobated by the FreeBSD i386 build (using LLVM 13 and 15,
+    depending on the base system version) failing early with an error
+    message complaining about this parameter being unknown.
+    
+    See
+    https://pkg-status.freebsd.org/beefy17/data/main-i386-default/pb27279cba1ca_sed03776ca7/logs/kicad-7.0.0,2.log
+    for an example of the failure, and
+    https://clang.llvm.org/docs/UsersManual.html#controlling-floating-point-behavior
+    for the available floating point options on clang.
+
+diff --git CMakeLists.txt CMakeLists.txt
+index 47dff66be0..20239b4f09 100644
+--- CMakeLists.txt
++++ CMakeLists.txt
+@@ -365,12 +365,16 @@ endif(USE_DISTCC)
+ # Set flags for GCC, or treat llvm as GCC
+ #================================================
+ 
+-if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+-
++if( CMAKE_COMPILER_IS_GNUCXX )
+     # Set 32-bit flag for GCC to prevent excess precision
++    # clang des not know this flag, so keep this separate
+     if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
+         set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" )
+     endif()
++endif( CMAKE_COMPILER_IS_GNUCXX )
++
++
++if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+ 
+     # Link flags in Debug: -g1 and -ggdb1 or -g1 and -ggdb3 can be used.
+     # Level 1 produces minimal information, enough for making basic backtraces.