Skip to content

Instantly share code, notes, and snippets.

@rpgoldman
Created July 24, 2023 18:43
Show Gist options
  • Save rpgoldman/17ae27603ad5c730ce744e7b4b18f067 to your computer and use it in GitHub Desktop.
Save rpgoldman/17ae27603ad5c730ce744e7b4b18f067 to your computer and use it in GitHub Desktop.
Patch for pandaPIpgrRepairVerify issue 2
From 4f203b6abda588d72731974ac869eb727e3c43ed Mon Sep 17 00:00:00 2001
From: "Robert P. Goldman" <rpgoldman@sift.net>
Date: Mon, 24 Jul 2023 13:37:51 -0500
Subject: [PATCH] Check for MacOS.
If the system is MacOS, then remove the flags for static linking from
`linker_flags`.
Note that this check is imperfect: we check for "Darwin", but
in *theory* there could be a Darwin system that's not MacOS. But I
think that's only a theoretical concern.
---
CMakeLists.txt | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be54fe5..a74f7c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,16 @@ IF (Boost_FOUND)
ADD_DEFINITIONS( "-DHAS_BOOST" )
ENDIF()
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(MACOSX TRUE)
+endif()
+
list(APPEND compiler_flags -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pedantic "$<$<CONFIG:DEBUG>:-Og;-ggdb3>" "$<$<CONFIG:RELEASE>:-O2>")
-list(APPEND linker_flags "$<$<CONFIG:RELEASE>:-flto;-static;-static-libgcc>")
+IF ( MACOSX )
+ list(APPEND linker_flags "$<$<CONFIG:RELEASE>:-flto>")
+ELSE
+ list(APPEND linker_flags "$<$<CONFIG:RELEASE>:-flto;-static;-static-libgcc>")
+ENDIF()
project(pandaPIpgrRepairVerify)
--
2.40.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment