62 lines
1.3 KiB
CMake
62 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(PrivateBinAPI)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
# Platform-specific configurations
|
|
if(WIN32)
|
|
# Windows-specific settings
|
|
add_definitions(-DWINDOWS)
|
|
set(PLATFORM_LIBS winhttp)
|
|
elseif(UNIX)
|
|
# Linux-specific settings
|
|
add_definitions(-DLINUX)
|
|
find_package(PkgConfig REQUIRED)
|
|
find_package(CURL REQUIRED)
|
|
set(PLATFORM_LIBS ${CURL_LIBRARIES})
|
|
endif()
|
|
|
|
# Handle dependencies
|
|
find_package(cryptopp CONFIG REQUIRED)
|
|
find_package(nlohmann_json CONFIG REQUIRED)
|
|
|
|
# Add library sources
|
|
set(SOURCES
|
|
src/privatebinapi.cpp
|
|
src/http_client.cpp
|
|
src/crypto.cpp
|
|
src/json_parser.cpp
|
|
src/base58.cpp
|
|
)
|
|
|
|
set(HEADERS
|
|
include/privatebinapi.h
|
|
include/http_client.h
|
|
include/crypto.h
|
|
include/json_parser.h
|
|
include/base58.h
|
|
)
|
|
|
|
# Create the shared library
|
|
add_library(privatebinapi SHARED ${SOURCES} ${HEADERS})
|
|
|
|
# Include directories
|
|
target_include_directories(privatebinapi PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
)
|
|
|
|
# Link dependencies
|
|
target_link_libraries(privatebinapi PRIVATE
|
|
cryptopp::cryptopp
|
|
nlohmann_json::nlohmann_json
|
|
${PLATFORM_LIBS}
|
|
)
|
|
|
|
# Install targets
|
|
install(TARGETS privatebinapi
|
|
RUNTIME DESTINATION bin
|
|
LIBRARY DESTINATION lib
|
|
ARCHIVE DESTINATION lib
|
|
)
|
|
|
|
install(FILES ${HEADERS} DESTINATION include/privatebinapi) |