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

8
.idea/.gitignore generated vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

2
.idea/WindowsXPKg.iml generated
View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module classpath="External" external.linked.project.id="WindowsXPKg" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="Makefile" type="CPP_MODULE" version="4" /> <module classpath="CMake" type="CPP_MODULE" version="4" />

21
.idea/misc.xml generated
View File

@ -1,26 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration"> <component name="CidrRootsConfiguration">
<sourceRoots> <sourceRoots>
<file path="$PROJECT_DIR$" /> <file path="$PROJECT_DIR$/src" />
</sourceRoots> </sourceRoots>
<libraryRoots> <libraryRoots>
<file path="$PROJECT_DIR$/lib" /> <file path="$PROJECT_DIR$/lib" />
</libraryRoots> </libraryRoots>
<excludeRoots>
<file path="$PROJECT_DIR$/build" />
</excludeRoots>
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MakefileSettings">
<option name="linkedExternalProjectsSettings">
<MakefileProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="version" value="2" />
</MakefileProjectSettings>
</option>
</component>
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project> </project>

1
.idea/vcs.xml generated
View File

@ -2,5 +2,6 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/build/_deps/nlohmann_json-src" vcs="Git" />
</component> </component>
</project> </project>

View File

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