]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Discover OpenSSL engines directory
authorCraig Andrews <candrews@integralblue.com>
Tue, 30 Oct 2018 00:41:12 +0000 (20:41 -0400)
committerCraig Andrews <candrews@integralblue.com>
Tue, 30 Oct 2018 02:00:24 +0000 (22:00 -0400)
The directory can be overriden by setting the CMake variable OPENSSL_ENGINES_DIR

.gitignore
.travis.yml
CMakeLists.txt

index 3558c56508e1876b9281a878735b869a81a06142..567609b1234a9b8806c5a05da6c866e480aa148d 100644 (file)
@@ -1,2 +1 @@
-bin/
 build/
index 8f023cffd21018103db0e4e080a6bc1462329fc6..ae592a060905cf6466c18fb697d65f71eef18fe6 100644 (file)
@@ -31,5 +31,5 @@ before_script:
   - cd ..
 
 script:
-  - cmake -DOPENSSL_ROOT_DIR=${PREFIX} -DOPENSSL_LIBRARIES=${PREFIX}/lib && make
+  - cmake -DOPENSSL_ROOT_DIR=${PREFIX} -DOPENSSL_LIBRARIES=${PREFIX}/lib -DOPENSSL_ENGINES_DIR=${PREFIX}/engines && make
   - make test
index 774a1a7c2ae225b5ff4e878908f84c38f3306848..55b86c9fb1c84e4375157fef651961b86a15e1ff 100644 (file)
@@ -38,6 +38,16 @@ set(OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${BIN_DIRECTORY})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY})
 
+# Remove when https://gitlab.kitware.com/cmake/cmake/issues/18525 is addressed
+set(OPENSSL_ENGINES_DIR "" CACHE PATH "OpenSSL Engines Directory")
+if ("${OPENSSL_ENGINES_DIR}" STREQUAL "")
+       include(FindPkgConfig)
+       pkg_get_variable(OPENSSL_ENGINES_DIR libcrypto enginesdir)
+       if ("${OPENSSL_ENGINES_DIR}" STREQUAL "")
+               message( FATAL_ERROR "Unable to discover the OpenSSL engines directory. Provide the path using -DOPENSSL_ENGINES_DIR" )
+       endif()
+endif()
+
 set(GOST_89_SOURCE_FILES
         gost89.c
         gost89.h
@@ -164,14 +174,13 @@ add_custom_target(tags
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
 
 # install
-set(OPENSSL_ENGINES_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/engines-${OPENSSL_VERSION_MAJOR}_${OPENSSL_VERSION_MINOR})
 set(OPENSSL_MAN_INSTALL_DIR ${CMAKE_INSTALL_MANDIR}/man1)
 
 install(TARGETS gost_engine gostsum gost12sum EXPORT GostEngineConfig
-        LIBRARY  DESTINATION ${OPENSSL_ENGINES_INSTALL_DIR}
+        LIBRARY  DESTINATION ${OPENSSL_ENGINES_DIR}
         RUNTIME  DESTINATION ${CMAKE_INSTALL_BINDIR})
 install(FILES gostsum.1 gost12sum.1 DESTINATION ${OPENSSL_MAN_INSTALL_DIR})
 if (MSVC)
- install(FILES $<TARGET_PDB_FILE:gost_engine> DESTINATION ${OPENSSL_ENGINES_INSTALL_DIR} OPTIONAL)
+ install(FILES $<TARGET_PDB_FILE:gost_engine> DESTINATION ${OPENSSL_ENGINES_DIR} OPTIONAL)
  install(FILES $<TARGET_PDB_FILE:gostsum> $<TARGET_PDB_FILE:gost12sum> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
 endif()