From 74a1961d1f9b87e466e76c9c5db2f85975931bdf Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Sat, 2 Jun 2012 22:25:24 +0100 Subject: [PATCH] on APPLE, allow undefined symbols (for __Dmain) when linking druntime & phobos --- runtime/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 1efd4758..2d01d430 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -29,6 +29,9 @@ set(D_FLAGS -g -w -d CACHE STRING "runtime build flags, separated by ;") if(BUILD_SHARED_LIBS) list(APPEND D_FLAGS -relocation-model=pic) + if(APPLE) + list(APPEND LD_FLAGS -Wl,-undefined,dynamic_lookup) + endif() set(D_LIBRARY_TYPE SHARED) else(BUILD_SHARED_LIBS) set(D_LIBRARY_TYPE STATIC) @@ -352,10 +355,10 @@ endmacro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix) if(PHOBOS2_DIR) add_custom_target(phobos2) endif(PHOBOS2_DIR) -build_runtime("" "" "" "" "${LIB_SUFFIX}") +build_runtime("" "" "${LD_FLAGS}" "" "${LIB_SUFFIX}") set(GENERATE_DI "") if(MULTILIB) - build_runtime("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX}" "" "${MULTILIB_SUFFIX}") + build_runtime("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "" "${MULTILIB_SUFFIX}") endif(MULTILIB) #