From 1c1c6894e010bb6174dcd1e795ccc01a81c66552 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Tue, 24 Jul 2012 19:17:24 +0200 Subject: [PATCH] Only link CURL when building Phobos as shared library. --- runtime/CMakeLists.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 98e08f44..3c36a1f8 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -97,10 +97,11 @@ list(APPEND CORE_D ${LDC_D} ${RUNTIME_DIR}/src/object_.d) file(GLOB CORE_C ${RUNTIME_DIR}/src/core/stdc/*.c) if(PHOBOS2_DIR) - # - # Locate curl. - # - find_package(CURL REQUIRED) + if(BUILD_SHARED_LIBS) + # std.net.curl depends on libcurl – when building a shared library, we + # need to take care of that. + find_package(CURL REQUIRED) + endif() file(GLOB PHOBOS2_D ${PHOBOS2_DIR}/std/*.d) file(GLOB PHOBOS2_D_NET ${PHOBOS2_DIR}/std/net/*.d) @@ -352,7 +353,9 @@ macro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix) LINK_FLAGS "${ld_flags}" ) # Phobos now uses curl - target_link_libraries(phobos-ldc${target_suffix} "curl") + if(BUILD_SHARED_LIBS) + target_link_libraries(phobos-ldc${target_suffix} "curl") + endif() install(TARGETS phobos-ldc${target_suffix} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${path_suffix}) add_dependencies(phobos2 DEPENDS phobos-ldc${target_suffix}) endif(PHOBOS2_DIR)