Skip to content

Commit b977f5a

Browse files
minusbatdavidchisnall
authored andcommitted
Update compile options to enable static linking to work
This makes the static options the same as the dynamic, which was causing the linking to fail. As this requires robin-map, and this is installed under /usr/local on BSD and similar systems, then we also add /usr/local/include to the header search path if it exists .
1 parent 811f2f4 commit b977f5a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ add_compile_definitions($<$<BOOL:${STRICT_APPLE_COMPATIBILITY}>:STRICT_APPLE_COM
155155

156156
configure_file(objc/objc-config.h.in objc/objc-config.h @ONLY)
157157
include_directories("${PROJECT_BINARY_DIR}/objc/")
158+
if (IS_DIRECTORY /usr/local/include)
159+
include_directories("/usr/local/include")
160+
endif()
158161

159162
if (EMBEDDED_BLOCKS_RUNTIME)
160163
list(APPEND libobjc_ASM_SRCS block_trampolines.S)
@@ -298,7 +301,9 @@ set_property(TARGET PROPERTY NO_SONAME true)
298301

299302
option(BUILD_STATIC_LIBOBJC "Build the static version of libobjc" OFF)
300303
if (BUILD_STATIC_LIBOBJC)
301-
add_library(objc-static STATIC ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} ${libobjc_OBJC_SRCS} ${libobjc_CXX_SRCS})
304+
add_library(objc-static STATIC ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} ${libobjc_OBJC_SRCS} ${libobjc_OBJCXX_SRCS} ${libobjc_CXX_SRCS})
305+
target_compile_options(objc-static PRIVATE "$<$<OR:$<COMPILE_LANGUAGE:OBJC>,$<COMPILE_LANGUAGE:OBJCXX>>:-Wno-gnu-folding-constant;-Wno-deprecated-objc-isa-usage;-Wno-objc-root-class;-fobjc-runtime=gnustep-2.0>$<$<COMPILE_LANGUAGE:C>:-Xclang;-fexceptions;-Wno-gnu-folding-constant>")
306+
target_compile_features(objc-static PRIVATE cxx_std_20)
302307
set_target_properties(objc-static PROPERTIES
303308
POSITION_INDEPENDENT_CODE true
304309
OUTPUT_NAME ${LIBOBJC_NAME})

0 commit comments

Comments
 (0)