-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
1>Checking Build System
Building Custom Rule E:/ChatRoom-backend/CMakeLists.txt
main.cc
LINK : fatal error LNK1181: 无法打开输入文件“Jsoncpp_lib.lib” [E:\ChatRoom-backend\build\chat_server.vcxproj]
my cmakelists
cmake_minimum_required(VERSION 3.15)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
project(chat_server CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC)
# 这一步是为了配合 vcpkg 的 x64-windows-static
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
add_compile_options(/utf-8)
add_compile_options(/W3 /wd4996)
endif()
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
find_package(Drogon CONFIG REQUIRED)
find_package(hiredis CONFIG REQUIRED)
find_package(redis++ CONFIG REQUIRED)
find_package(jsoncpp CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
add_executable(chat_server src/main.cc)
target_link_libraries(chat_server
PRIVATE
Drogon::Drogon
redis++::redis++_static
nlohmann_json::nlohmann_json
# Attempting to use jsoncpp_lib or jsoncpp_static directly
jsoncpp_static
)
target_include_directories(chat_server PRIVATE src)