Skip to content

Commit 02b6aa3

Browse files
authored
Fix Undefined symbols compile error on macOS.
Added block of code defining -undefined dynamic_lookup for a LINK_FLAG to fix Undefined symbols for architecture x86_64: error when compiling. Code block was taken directly from the CMakeLists.txt file located in the mapscript/php directory.
1 parent d2e0517 commit 02b6aa3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

mapscript/phpng/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ if(WIN32)
6262
SWIG_LINK_LIBRARIES(php_mapscriptng ${PHP_LIBRARY})
6363
endif(WIN32)
6464

65+
IF(APPLE)
66+
if(XCODE)
67+
SET(CMAKE_C_LINK_FLAGS
68+
"${CMAKE_C_LINK_FLAGS} -undefined dynamic_lookup")
69+
SET(CMAKE_CXX_LINK_FLAGS
70+
"${CMAKE_CXX_LINK_FLAGS} -undefined dynamic_lookup")
71+
else(XCODE)
72+
SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
73+
"${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -undefined dynamic_lookup")
74+
SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS
75+
"${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
76+
endif(XCODE)
77+
ENDIF(APPLE)
78+
6579
# hide "defined but not used" warnings
6680
target_compile_options(php_mapscriptng PRIVATE -Wno-unused-label)
6781

0 commit comments

Comments
 (0)