-add_test(NAME engine
- COMMAND perl run_tests
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)
-set_tests_properties(engine PROPERTIES ENVIRONMENT OPENSSL_ENGINES=${OUTPUT_DIRECTORY})
+if(NOT SKIP_PERL_TESTS)
+ execute_process(COMMAND perl -MTest2::V0 -e ""
+ ERROR_QUIET RESULT_VARIABLE HAVE_TEST2_V0)
+ if(NOT HAVE_TEST2_V0)
+ set(TEST_ENVIRONMENT
+ CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ PERL5LIB=${CMAKE_CURRENT_SOURCE_DIR}/test
+ OPENSSL_ENGINES=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ OPENSSL_PROGRAM=${OPENSSL_PROGRAM}
+ OPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}
+ OPENSSL_CONF=${CMAKE_CURRENT_SOURCE_DIR}/test/empty.cnf
+ )
+ add_test(NAME engine
+ COMMAND prove --merge -PWrapOpenSSL ${CMAKE_CURRENT_SOURCE_DIR}/test)
+ set_tests_properties(engine PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT}")
+ else()
+ message(STATUS "No Test2::V0 perl module (engine tests skipped)")
+ endif()
+endif()
+
+add_executable(sign benchmark/sign.c)
+target_link_libraries(sign gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB})
+
+# All that may need to load just built engine will have path to it defined.
+set(BINARY_TESTS_TARGETS
+ test_digest
+ test_ciphers
+ test_curves
+ test_params
+ test_derive
+ test_sign
+ test_context
+ test_keyexpimp
+ test_gost89
+ test_tls
+ )
+set_property(TARGET ${BINARY_TESTS_TARGETS} APPEND PROPERTY COMPILE_DEFINITIONS ENGINE_DIR="${OUTPUT_DIRECTORY}")