Fix CMakeLists.txt syntax error and update build script to use Visual Studio 2022

This commit is contained in:
2025-08-28 09:27:23 +02:00
parent 90d9a23dd2
commit 41b17022c7
2 changed files with 5 additions and 3 deletions

View File

@ -31,13 +31,15 @@ else()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/json/include/nlohmann/json.hpp") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/json/include/nlohmann/json.hpp")
set(NLOHMANN_JSON_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/json/include") set(NLOHMANN_JSON_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/json/include")
else() else()
# Try to download it # Try to download it with compatibility settings
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
nlohmann_json nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.2 GIT_TAG v3.11.2
) )
# Set compatibility flag for older CMake versions
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
FetchContent_MakeAvailable(nlohmann_json) FetchContent_MakeAvailable(nlohmann_json)
set(NLOHMANN_JSON_INCLUDE_DIRS ${nlohmann_json_SOURCE_DIR}/include) set(NLOHMANN_JSON_INCLUDE_DIRS ${nlohmann_json_SOURCE_DIR}/include)
endif() endif()
@ -85,4 +87,4 @@ install(TARGETS privatebinapi
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
) )
install(FILES ${HEADERS} DESTINATION include/privatebinapi)) install(FILES ${HEADERS} DESTINATION include/privatebinapi)

View File

@ -6,7 +6,7 @@ if not exist "build" mkdir build
cd build cd build
REM Generate build files with CMake REM Generate build files with CMake
cmake .. -G "Visual Studio 16 2019" cmake .. -G "Visual Studio 17 2022"
REM Build the project REM Build the project
cmake --build . --config Release cmake --build . --config Release