Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add building with pem-pack #108

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ option(
ON
)

option(
CRYPTOPP_USE_PEM_PACK
"Include the PEM-Pack in compiliation (https://github.com/noloader/cryptopp-pem)"
)

if(CRYPTOPP_INCLUDE_PREFIX)
set(CRYPTOPP_INCLUDE_PREFIX
${CRYPTOPP_INCLUDE_PREFIX}
Expand Down
13 changes: 13 additions & 0 deletions cmake/GetCryptoppSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ if(GIT_FOUND)
SOURCE_DIR
${CRYPTOPP_INCLUDE_PREFIX}
)
fetchcontent_declare(
cryptopp-pem
GIT_REPOSITORY "https://github.com/noloader/cryptopp-pem"
QUIET
)
else()
message(STATUS "Downloading crypto++ from URL...")
cmake_policy(SET CMP0135 NEW)
Expand All @@ -39,5 +44,13 @@ else()
cryptopp
URL "${source_location}.zip" QUIET SOURCE_DIR ${CRYPTOPP_INCLUDE_PREFIX}
)
fetchcontent_declare(
cryptopp-pem
URL "https://github.com/noloader/cryptopp-pem/archive/refs/heads/master.zip"
QUIET
)
endif()
fetchcontent_populate(cryptopp)
if(CRYPTOPP_USE_PEM_PACK)
fetchcontent_populate(cryptopp-pem)
endif()
26 changes: 26 additions & 0 deletions cryptopp/sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ set(cryptopp_SOURCES
zlib.cpp
)

set(cryptopp_SOURCES_PEM
"${cryptopp-pem_SOURCE_DIR}/pem_common.cpp"
"${cryptopp-pem_SOURCE_DIR}/pem_eol.cxx"
"${cryptopp-pem_SOURCE_DIR}/pem_read.cpp"
"${cryptopp-pem_SOURCE_DIR}/pem_write.cpp"
"${cryptopp-pem_SOURCE_DIR}/x509cert.cpp"
)

# ***** Library headers *****
set(cryptopp_HEADERS
3way.h
Expand Down Expand Up @@ -374,6 +382,11 @@ set(cryptopp_HEADERS
zlib.h
)

set(cryptopp_HEADERS_PEM
"${cryptopp-pem_SOURCE_DIR}/pem_common.h"
"${cryptopp-pem_SOURCE_DIR}/x509cert.h"
)

# ***** Test sources *****
set(cryptopp_SOURCES_TEST
# adhoc.cpp
Expand Down Expand Up @@ -448,3 +461,16 @@ if(ANDROID)
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c
)
endif()

if(CRYPTOPP_USE_PEM_PACK)
list(
APPEND
cryptopp_SOURCES
${cryptopp_SOURCES_PEM}
)
list(
APPEND
cryptopp_HEADERS
${cryptopp_HEADERS_PEM}
)
endif()
Loading