Skip to content

Instantly share code, notes, and snippets.

@zethon
Created December 19, 2017 19:04
Show Gist options
  • Save zethon/858b20b4d94e47f11c80995348481d43 to your computer and use it in GitHub Desktop.
Save zethon/858b20b4d94e47f11c80995348481d43 to your computer and use it in GitHub Desktop.
CMake, Curl and Visual Studio
# This was required in my project's CMake in order to properly link and build against curl
if (MSVC)
add_definitions(
-D_SCL_SECURE_NO_WARNINGS
-DWIN32_LEAN_AND_MEAN
-DCURL_STATICLIB
)
list(APPEND CURL_LIBRARIES
"Crypt32.lib"
"Ws2_32.lib"
)
SET(CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:library")
endif()
@zethon
Copy link
Author

zethon commented Dec 19, 2017

This had to be called before the above else CURL_LIBRARIES gets reset.

# set(CURL_LIBRARY "-lcurl") 
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment