Only link CURL when building Phobos as shared library.

This commit is contained in:
David Nadlinger
2012-07-24 19:17:24 +02:00
parent 61e4d9044a
commit 1c1c6894e0

View File

@@ -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)