title: Linking project with statically build curl
body: <p>I'm doing small project in C++ with CMake and MinGW32, which requires libcurl library, but when i try to link statically build libcurl.a I get undefined reference errors</p>
  
  <blockquote>
  <pre><code>undefined reference to `_imp__curl_easy_init'
  undefined reference to `_imp__curl_easy_setopt'
  undefined reference to `_imp__curl_easy_perform'
  undefined reference to `_imp__curl_easy_getinfo'
  undefined reference to `_imp__curl_easy_strerror'
  </code></pre>
  </blockquote>
  
  <p>I have cURL source code in dep/curl and my source code in src folder. And this is how my project's CMakeLists.txt looks like:</p>
  
  <pre><code>project(ShutdownServer)
  cmake_minimum_required(VERSION 2.8)
  set(CMAKE_BUILD_TYPE "Release")
  set(CURL_STATICLIB true)
  set(BUILD_CURL_EXE false)
  
  add_subdirectory(dep/curl)
  set(TARGET_NAME "ShutdownServer")
  set(LIBCURL_DIR ${PROJECT_SOURCE_DIR}/dep/curl)
  
  aux_source_directory(src SRC_LIST)
  add_executable(${TARGET_NAME} ${SRC_LIST})
  
  find_path(LIBCURL_INCLUDE_DIR curl/curl.h HINTS ${LIBCURL_DIR}/include)
  include_directories(${LIBCURL_INCLUDE_DIR})
  
  add_dependencies(${TARGET_NAME} libcurl)
  
  set(LIBS ${LIBS} ws2_32)
  set(LIBS ${LIBS} iphlpapi)
  set(LIBS ${LIBS} libcurl)
  
  target_link_libraries(${TARGET_NAME} ${LIBS})
  
  set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++")
  </code></pre>
  
  <p>When I switch CURL_STATICLIB option to false, and build libcurl dynamically, project is build fine, but I'd rather had build all into one binary file. Can anybody please tell me what is wrong with this?</p>