Skip to content

Commit

Permalink
Added Interface with CRYPTOPP_INSTALL_PREFIX definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Vollstrecker committed Aug 30, 2022
1 parent 75db4db commit c399ee8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cryptopp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,9 @@ set_target_properties(cryptopp PROPERTIES LINKER_LANGUAGE CXX)
if(${CRYPTOPP_BUILD_SHARED})
target_compile_definitions(cryptopp PRIVATE "CRYPTOPP_EXPORTS")
endif()

# TODO: make the prefix for includes settable (e.g. cryptopp, crypto++)
target_compile_definitions(
cryptopp
INTERFACE $<INSTALL_INTERFACE:CRYPTOPP_INCLUDE_PREFIX=${CRYPTOPP_INCLUDE_PREFIX}>)
cmake_path(GET CRYPTOPP_PROJECT_DIR PARENT_PATH CRYPTOPP_PREFIXED_INCLUDE_DIR)
target_include_directories(
cryptopp
Expand Down
5 changes: 5 additions & 0 deletions test/example-src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
#include <array>
#include <cstdint>

#ifdef CRYPTOPP_INCLUDE_PREFIX
#define CRYPTOPP_HEADER(hdr) <CRYPTOPP_INCLUDE_PREFIX/hdr>
#include CRYPTOPP_HEADER(osrng.h)
#else
#include <cryptopp/osrng.h> // for random number generation
#endif

int main(int argc, char **argv) {
constexpr size_t c_buffer_size = 16;
Expand Down

0 comments on commit c399ee8

Please sign in to comment.