2023-06-01 23:09:44 +03:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
|
2023-05-30 11:07:50 +03:00
|
|
|
PROJECT(WindowsXPKg)
|
|
|
|
SET(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
2023-06-16 15:57:56 +03:00
|
|
|
SET(BUILD_SHARED_LIBS OFF)
|
|
|
|
SET(CMAKE_EXE_LINKER_FLAGS "-static")
|
|
|
|
SET(OPENSSL_USE_STATIC_LIBS TRUE)
|
|
|
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
|
|
|
2023-06-02 15:36:34 +03:00
|
|
|
FIND_PACKAGE(OpenSSL REQUIRED)
|
2023-05-30 22:37:13 +03:00
|
|
|
|
2023-06-01 23:09:44 +03:00
|
|
|
IF(!OPENSSL_FOUND)
|
2023-06-16 15:57:56 +03:00
|
|
|
MESSAGE(SEND_ERROR "OpenSSL Development Libraries Not Found")
|
|
|
|
MESSAGE(SEND_ERROR "Please consult your package manager of choice to install the prerequisite")
|
|
|
|
MESSAGE(SEND_ERROR "The package name is commonly called libssl-dev or openssl-dev depending on distribution")
|
|
|
|
MESSAGE(FATAL_ERROR "Can not continue without OpenSSL")
|
2023-06-01 23:09:44 +03:00
|
|
|
ENDIF()
|
2023-05-30 22:37:13 +03:00
|
|
|
|
2023-06-01 23:09:44 +03:00
|
|
|
INCLUDE(cmake/CPM.cmake)
|
2023-06-01 20:55:36 +03:00
|
|
|
|
2023-06-01 23:09:44 +03:00
|
|
|
# Include JSON runtime library
|
2023-06-01 20:55:36 +03:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME nlohmann_json
|
|
|
|
GITHUB_REPOSITORY nlohmann/json
|
2023-06-02 15:36:34 +03:00
|
|
|
VERSION 3.11.2
|
|
|
|
)
|
2023-06-01 20:55:36 +03:00
|
|
|
|
2023-06-05 18:43:31 +03:00
|
|
|
CPMAddPackage("gh:fmtlib/fmt#7.1.3")
|
|
|
|
|
2023-06-01 23:09:44 +03:00
|
|
|
CONFIGURE_FILE(keys.json keys.json COPYONLY)
|
2023-06-01 18:54:11 +03:00
|
|
|
|
2023-06-16 15:57:56 +03:00
|
|
|
ADD_LIBRARY(BINK1998 STATIC src/BINK1998.cpp)
|
|
|
|
TARGET_INCLUDE_DIRECTORIES(BINK1998 PUBLIC crypto)
|
|
|
|
TARGET_LINK_LIBRARIES(BINK1998 OpenSSL::Crypto nlohmann_json::nlohmann_json fmt)
|
|
|
|
|
|
|
|
ADD_LIBRARY(BINK2002 STATIC src/BINK2002.cpp)
|
|
|
|
TARGET_INCLUDE_DIRECTORIES(BINK2002 PUBLIC crypto)
|
|
|
|
TARGET_LINK_LIBRARIES(BINK2002 OpenSSL::Crypto nlohmann_json::nlohmann_json fmt)
|
|
|
|
|
|
|
|
ADD_LIBRARY(CONFID STATIC src/confid.cpp)
|
|
|
|
TARGET_INCLUDE_DIRECTORIES(CONFID PUBLIC crypto)
|
|
|
|
TARGET_LINK_LIBRARIES(CONFID OpenSSL::Crypto nlohmann_json::nlohmann_json fmt)
|
|
|
|
|
|
|
|
ADD_EXECUTABLE(xpkey src/main.cpp src/key.cpp src/util.cpp src/cli.cpp)
|
2023-05-30 22:37:13 +03:00
|
|
|
TARGET_INCLUDE_DIRECTORIES(xpkey PUBLIC crypto)
|
2023-06-16 15:57:56 +03:00
|
|
|
TARGET_LINK_LIBRARIES(xpkey BINK1998 BINK2002 CONFID OpenSSL::Crypto nlohmann_json::nlohmann_json fmt)
|