Reputation: 101
If I try to build cURL it shows me the following output:
Checking Build System
Building Custom Rule C:/CPP/Projects/WebsiteGuardian/CMakeLists.txt
LINK : warning LNK4098: Standardbibliothek "LIBCMTD" steht in Konflikt mit anderen Bibliotheken; /NODEFAULTLIB:Biblioth
ek verwenden. [C:\CPP\Projects\WebsiteGuardian\build\WebsiteGuardian.vcxproj]
WebsiteGuardian.vcxproj -> C:\CPP\Projects\WebsiteGuardian\build\Debug\WebsiteGuardian.exe
Building Custom Rule C:/CPP/Projects/WebsiteGuardian/CMakeLists.txt
I build it like this: I downloaded the current .zip from here: curl.haxx.se/download.html After that I build curl with: "Set RTLIBCFG=static" and "nmake /f Makefile.vc mode=static VC=15 MACHINE=x86 DEBUG=no". I copied the include- and lib directory in my projectfolder. It will also found succesfully. My CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(WebsiteGuardian CXX)
set(CMAKE_CXX_STANDARD 17)
set(CURL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
set(CURL_LIBRARY ${CMAKE_SOURCE_DIR}/lib/libcurl_a_debug.lib )
add_definitions(-DCURL_STATICLIB)
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR})
add_executable(WebsiteGuardian "src/main.cpp")
target_link_libraries(WebsiteGuardian ${CURL_LIBRARY} wldap32 ws2_32 Crypt32.lib Wldap32 Normaliz)
Upvotes: 1
Views: 6155
Reputation: 101
Thanks for the many answers. This works fine for me:
cmake_minimum_required(VERSION 3.10)
project(WebsiteGuardian CXX)
set(CMAKE_CXX_STANDARD 17)
set(CURL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
set(CURL_LIBRARY ${CMAKE_SOURCE_DIR}/lib/libcurl_a_debug.lib )
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
add_definitions(-DCURL_STATICLIB)
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR})
add_executable(WebsiteGuardian "src/main.cpp")
target_link_libraries(WebsiteGuardian ${CURL_LIBRARY} wldap32 ws2_32 Crypt32.lib Wldap32 Normaliz)
Upvotes: 5