Skip to content

Commit

Permalink
CMakeLists.txt: add workaround for using non-installed OpenSSL builds…
Browse files Browse the repository at this point in the history
… with default libdir
  • Loading branch information
DDvO committed Oct 21, 2024
1 parent 38972ad commit f892c27
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ if(NOT EXISTS "${OPENSSL_CRYPTO_LIBRARY}")
message(FATAL_ERROR "OpenSSL crypto library file does not exist: ${OPENSSL_CRYPTO_LIBRARY}")
endif()

# workaround for using local OpenSSL builds by default expecting that
# its dynamic libs have been installed in ./${LIB} when using the libs
# see for binaries dynamically linked to OpenSSL the output of ${LDD} <binary>
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(USERS "^(\w:)?\\Users\\")
set(LIB "bin")
else()
set(USERS "^/(home|Users)/")
set(LIB "lib")
endif()
string(REGEX MATCH ${USERS} MATCHED "${OPENSSL_LIB}")
if(NOT "${MATCHED}" STREQUAL "" AND NOT EXISTS "${OPENSSL_LIB}/${LIB}")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "." "${OPENSSL_LIB}/${LIB}")
# since CMake 3.13, this works also for Windows
endif()

if(DEFINED ENV{USE_LIBCMP} OR "${OPENSSL_VERSION}" LESS "3")
set(USE_LIBCMP 1)
message(STATUS "using libcmp")
Expand Down
2 changes: 1 addition & 1 deletion cmpossl
Submodule cmpossl updated 1 files
+16 −0 CMakeLists.txt
2 changes: 1 addition & 1 deletion libsecutils
Submodule libsecutils updated 1 files
+16 −0 CMakeLists.txt

0 comments on commit f892c27

Please sign in to comment.