diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 823307ad..55636cf1 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) #