summaryrefslogtreecommitdiff
path: root/lib/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r--lib/CMakeLists.txt21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 6b90f011f..306ba1a6e 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,5 +1,13 @@
set(LIB_NAME libcurl)
+if(BUILD_SHARED_LIBS)
+ set(CURL_STATICLIB NO)
+else()
+ set(CURL_STATICLIB YES)
+endif()
+
+# Use:
+# * CURL_STATICLIB
configure_file(curl_config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/curl_config.h)
@@ -59,21 +67,12 @@ if(USE_ARES)
include_directories(${CARES_INCLUDE_DIR})
endif()
-if(CURL_STATICLIB)
- # Static lib
- set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC STATIC)
-else()
- # DLL / so dynamic lib
- set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC SHARED)
-endif()
-
add_library(
${LIB_NAME}
- ${CURL_USER_DEFINED_DYNAMIC_OR_STATIC}
${HHEADERS} ${CSOURCES}
)
-if(MSVC AND CURL_STATICLIB)
+if(MSVC AND NOT BUILD_SHARED_LIBS)
set_target_properties(${LIB_NAME} PROPERTIES STATIC_LIBRARY_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
endif()
@@ -95,7 +94,7 @@ set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "")
if(WIN32)
- if(NOT CURL_STATICLIB)
+ if(BUILD_SHARED_LIBS)
# Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib"
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
endif()