FindOpenSSL (Crossplatform solution)

This commit is contained in:
Andrew
2023-06-02 15:36:34 +03:00
parent 72d441b539
commit a14d44cdca
5 changed files with 12 additions and 29 deletions

View File

@@ -4,7 +4,7 @@ SET(CMAKE_CXX_STANDARD 17)
SET(OPENSSL_USE_STATIC_LIBS TRUE)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_SEARCH_MODULE(OPENSSL REQUIRED openssl)
FIND_PACKAGE(OpenSSL REQUIRED)
IF(!OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "OpenSSL Development Libraries Not Found")
@@ -16,7 +16,8 @@ INCLUDE(cmake/CPM.cmake)
CPMAddPackage(
NAME nlohmann_json
GITHUB_REPOSITORY nlohmann/json
VERSION 3.11.2)
VERSION 3.11.2
)
CONFIGURE_FILE(keys.json keys.json COPYONLY)
@@ -24,8 +25,8 @@ SET(BUILD_SHARED_LIBS OFF)
SET(CMAKE_EXE_LINKER_FLAGS "-static")
ADD_EXECUTABLE(xpkey src/main.cpp src/xp.cpp src/key.cpp src/util.cpp src/cli.cpp)
TARGET_INCLUDE_DIRECTORIES(xpkey PUBLIC crypto)
TARGET_LINK_LIBRARIES(xpkey PUBLIC crypto nlohmann_json::nlohmann_json)
TARGET_LINK_LIBRARIES(xpkey PUBLIC OpenSSL::Crypto nlohmann_json::nlohmann_json)
ADD_EXECUTABLE(srv2003key src/server.cpp src/key.cpp src/util.cpp src/cli.cpp)
TARGET_INCLUDE_DIRECTORIES(srv2003key PUBLIC crypto)
TARGET_LINK_LIBRARIES(srv2003key PUBLIC crypto nlohmann_json::nlohmann_json)
TARGET_LINK_LIBRARIES(srv2003key PUBLIC OpenSSL::Crypto nlohmann_json::nlohmann_json)