1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Made the windows .lib addition cleaner.

This commit is contained in:
Benoit Neil 2009-04-08 23:20:04 +00:00
parent 7037e4a4b1
commit 3733fa02ee

View File

@ -21,6 +21,25 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2 FATAL_ERROR)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
FUNCTION(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR)
SET(NEW_LIST_SPACE)
FOREACH(ITEM ${${_LIST_NAME}})
SET(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}")
ENDFOREACH()
STRING(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE)
SET(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE)
ENDFUNCTION()
# Appends a lis of item to a string which is a space-separated list, if they don't already exist.
FUNCTION(LIST_SPACES_APPEND_ONCE LIST_NAME)
STRING(REPLACE " " ";" _LIST ${${LIST_NAME}})
LIST(APPEND _LIST ${ARGN})
LIST(REMOVE_DUPLICATES _LIST)
TO_LIST_SPACES(_LIST NEW_LIST_SPACE)
SET(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE)
ENDFUNCTION()
project( CURL C )
SET(CURL_MAJOR_VERSION 7)
SET(CURL_MINOR_VERSION 19)
@ -45,12 +64,6 @@ SET(OS "\"${CMAKE_SYSTEM_NAME}\"")
# ENDIF()
INCLUDE_DIRECTORIES( ${CURL_SOURCE_DIR}/include )
# Save C and CXX STD libs (we may need to modify them)
IF(NOT CURL_CONFIG_HAS_BEEN_RUN_BEFORE)
SET(CMAKE_CXX_STANDARD_LIBRARIES_INITIAL ${CMAKE_CXX_STANDARD_LIBRARIES} CACHE INTERNAL "Initial C++ libs")
SET(CMAKE_C_STANDARD_LIBRARIES_INITIAL ${CMAKE_C_STANDARD_LIBRARIES} CACHE INTERNAL "Initial C libs")
ENDIF()
IF(WIN32)
SET(NATIVE_WINDOWS ON)
ENDIF()
@ -70,7 +83,7 @@ IF(MSVC)
MARK_AS_ADVANCED(BUILD_RELEASE_DEBUG_DIRS)
ENDIF()
OPTION(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." OFF)
OPTION(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." ON)
MARK_AS_ADVANCED(CURL_HIDDEN_SYMBOLS)
# IF(WIN32)
@ -130,15 +143,17 @@ MARK_AS_ADVANCED(ENABLE_IPV6)
IF(WIN32)
LIST_SPACES_APPEND_ONCE(CMAKE_C_STANDARD_LIBRARIES wsock32.lib ws2_32.lib) # bufferoverflowu.lib
IF(CURL_DISABLE_LDAP)
#SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} wsock32.lib bufferoverflowu.lib ws2_32.lib" CACHE STRING "" FORCE)
#SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INITIAL} wsock32.lib bufferoverflowu.lib ws2_32.lib" CACHE STRING "" FORCE)
SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INITIAL} wsock32.lib ws2_32.lib" CACHE STRING "" FORCE)
# Remove wldap32.lib from space-separated list
STRING(REPLACE " " ";" _LIST ${CMAKE_C_STANDARD_LIBRARIES})
LIST(REMOVE_ITEM _LIST "wldap32.lib")
TO_LIST_SPACES(_LIST CMAKE_C_STANDARD_LIBRARIES)
ELSE()
#SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} wsock32.lib bufferoverflowu.lib ws2_32.lib wldap32.lib" CACHE STRING "" FORCE)
#SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INITIAL} wsock32.lib bufferoverflowu.lib ws2_32.lib wldap32.lib" CACHE STRING "" FORCE)
SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INITIAL} wsock32.lib ws2_32.lib wldap32.lib" CACHE STRING "" FORCE)
# Append wldap32.lib
LIST_SPACES_APPEND_ONCE(CMAKE_C_STANDARD_LIBRARIES wldap32.lib)
ENDIF()
SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}" CACHE STRING "" FORCE)
ENDIF()