add cmake build options

- add cmake build options as configure provides
  * -DENABLE_ASM (default ON)
  * -DENABLE_EXTRATESTS (default OFF)
  * -DENABLE_NC (default OFF)
  * -DOPENSSLDIR (default ${CMAKE_INSTALL_PREFIX}/etc/ssl)

- add biotest and pidwraptest if ENABLE_EXTRATESTS is ON

- add compiler flag `-fno-common` if CMAKE_SYSTEM_NAME is Darwin
  to prevent link error Undefined symbols "_OPENSSL_ia32cap_P"
This commit is contained in:
kinichiro
2016-04-11 12:59:23 +09:00
parent c94670a8cd
commit bda62f7fe4
6 changed files with 59 additions and 3 deletions

View File

@@ -9,8 +9,6 @@ include_directories(
../apps/openssl/compat
)
set(ENV{srcdir} ${CMAKE_CURRENT_SOURCE_DIR})
# aeadtest
add_executable(aeadtest aeadtest.c)
target_link_libraries(aeadtest ${OPENSSL_LIBS})
@@ -24,7 +22,7 @@ add_test(aes_wrap aes_wrap)
# arc4randomforktest
# Windows/mingw does not have fork, but Cygwin does.
if(NOT CMAKE_HOST_WIN32)
if(NOT CMAKE_HOST_WIN32 AND NOT CMAKE_SYSTEM_NAME MATCHES "MINGW")
add_executable(arc4randomforktest arc4randomforktest.c)
target_link_libraries(arc4randomforktest ${OPENSSL_LIBS})
add_test(arc4randomforktest ${CMAKE_CURRENT_SOURCE_DIR}/arc4randomforktest.sh)
@@ -50,6 +48,14 @@ add_executable(bftest bftest.c)
target_link_libraries(bftest ${OPENSSL_LIBS})
add_test(bftest bftest)
# biotest
# the BIO tests rely on resolver results that are OS and environment-specific
if(ENABLE_EXTRATESTS)
add_executable(biotest biotest.c)
target_link_libraries(biotest ${OPENSSL_LIBS})
add_test(biotest biotest)
endif()
# bntest
add_executable(bntest bntest.c)
target_link_libraries(bntest ${OPENSSL_LIBS})
@@ -198,6 +204,15 @@ add_executable(pbkdf2 pbkdf2.c)
target_link_libraries(pbkdf2 ${OPENSSL_LIBS})
add_test(pbkdf2 pbkdf2)
# pidwraptest
# pidwraptest relies on an OS-specific way to give out pids and is generally
# awkward on systems with slow fork
if(ENABLE_EXTRATESTS)
add_executable(pidwraptest pidwraptest.c)
target_link_libraries(pidwraptest ${OPENSSL_LIBS})
add_test(pidwraptest ${CMAKE_CURRENT_SOURCE_DIR}/pidwraptest.sh)
endif()
# pkcs7test
add_executable(pkcs7test pkcs7test.c)
target_link_libraries(pkcs7test ${OPENSSL_LIBS})