From 2963a66ade6d8961dc1cf965eb74a1132b0396e2 Mon Sep 17 00:00:00 2001 From: Daniel Engberg Date: Sat, 3 Oct 2026 09:26:30 +0200 Subject: [PATCH] Prevent overlinking on FreeBSD Apply similar compile options to FreeBSD to prevent over-linking (based on Darwin's) --- src/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4194e25a..ae820adb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -137,6 +137,19 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") endif() endif() +if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set_target_properties(graphite2 PROPERTIES + COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" + LINK_FLAGS "-nodefaultlibs" + LINKER_LANGUAGE C) + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + add_definitions(-Wimplicit-fallthrough -Wshorten-64-to-32) + endif() + target_link_libraries(graphite2 c) + include(Graphite) + set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") +endif() + if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set_target_properties(graphite2 PROPERTIES COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;UNICODE;GRAPHITE2_EXPORTING")