From 292780f991d2ec4ed6796f3c2599aff011bfbed0 Mon Sep 17 00:00:00 2001 From: elpatron Date: Thu, 28 Aug 2025 09:58:21 +0200 Subject: [PATCH] Fix Crypto++ include directories and libraries paths --- CMakeLists.txt | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 954ceea..19f5a99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,33 +46,8 @@ else() endif() # Handle Crypto++ dependency -# First try to find it as a package -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(CRYPTOPP QUIET libcrypto++ cryptopp) -endif() - -# Try to find Crypto++ using find_package -find_package(cryptopp CONFIG QUIET) - -if(cryptopp_FOUND) - # Use the found package - message(STATUS "Found Crypto++ package via find_package") - set(CRYPTOPP_INCLUDE_DIRS "") - set(CRYPTOPP_LIBRARIES cryptopp::cryptopp) -else() - # 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() +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") # Add library sources set(SOURCES @@ -97,19 +72,11 @@ add_library(privatebinapi SHARED ${SOURCES} ${HEADERS}) # Include directories target_include_directories(privatebinapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CRYPTOPP_INCLUDE_DIRS} ) -# Include Crypto++ -if(NOT DEFINED NO_CRYPTO) - if(cryptopp_FOUND) - # Crypto++ found via find_package - target_link_libraries(privatebinapi PRIVATE cryptopp::cryptopp) - elseif(CRYPTOPP_INCLUDE_DIRS) - # Crypto++ found via vcpkg or other method - target_include_directories(privatebinapi PRIVATE ${CRYPTOPP_INCLUDE_DIRS}) - target_link_libraries(privatebinapi PRIVATE ${CRYPTOPP_LIBRARIES}) - endif() -endif() +# Link Crypto++ +target_link_libraries(privatebinapi PRIVATE ${CRYPTOPP_LIBRARIES}) # Include nlohmann/json if(nlohmann_json_FOUND)