Update to use installed Crypto++ library

This commit is contained in:
2025-08-28 09:52:53 +02:00
parent 42c00c3452
commit 8e92ccb386
3 changed files with 22 additions and 81 deletions

View File

@@ -52,16 +52,26 @@ if(PKG_CONFIG_FOUND)
pkg_check_modules(CRYPTOPP QUIET libcrypto++ cryptopp)
endif()
if(CRYPTOPP_FOUND)
# Try to find Crypto++ using find_package
find_package(cryptopp CONFIG QUIET)
if(cryptopp_FOUND)
# Use the found package
message(STATUS "Found Crypto++ package")
set(CRYPTOPP_INCLUDE_DIRS ${CRYPTOPP_INCLUDE_DIRS})
set(CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARIES})
message(STATUS "Found Crypto++ package via find_package")
set(CRYPTOPP_INCLUDE_DIRS "")
set(CRYPTOPP_LIBRARIES cryptopp::cryptopp)
else()
# For now, we'll provide a warning and use stub implementations
# In a real implementation, you would install Crypto++ separately
message(WARNING "Crypto++ not found. Using stub implementations for cryptographic functions.")
add_definitions(-DNO_CRYPTO)
# Try to find it via vcpkg
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg/installed/x64-windows/include/cryptopp/config.h")
message(STATUS "Found Crypto++ via vcpkg")
set(CRYPTOPP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg/installed/x64-windows/include")
set(CRYPTOPP_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg/installed/x64-windows/lib/cryptopp.lib")
else()
# For now, we'll provide a warning and use stub implementations
# In a real implementation, you would install Crypto++ separately
message(WARNING "Crypto++ not found. Using stub implementations for cryptographic functions.")
add_definitions(-DNO_CRYPTO)
endif()
endif()
# Add library sources
@@ -97,9 +107,11 @@ else()
endif()
# Include Crypto++
if(CRYPTOPP_FOUND)
if(cryptopp_FOUND)
target_link_libraries(privatebinapi PRIVATE cryptopp::cryptopp)
elseif(CRYPTOPP_LIBRARIES)
target_include_directories(privatebinapi PRIVATE ${CRYPTOPP_INCLUDE_DIRS})
target_link_libraries(privatebinapi ${CRYPTOPP_LIBRARIES})
target_link_libraries(privatebinapi PRIVATE ${CRYPTOPP_LIBRARIES})
endif()
# Link dependencies