Skip to content

Commit

Permalink
use openssl 1.0.2 only when connext is used
Browse files Browse the repository at this point in the history
Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
  • Loading branch information
mikaelarguedas committed Aug 25, 2020
1 parent 3080805 commit f9c4233
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions test_security/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,33 @@ if(BUILD_TESTING)
set(RTI_BIN_PATH "$ENV{RTI_OPENSSL_BIN}")
file(TO_CMAKE_PATH "${RTI_BIN_PATH}" RTI_BIN_PATH)
set(TEST_PATH "${RTI_BIN_PATH};${ENV_PATH}")
if(WIN32)
string(REPLACE "\\" "\\\\" RTI_OPENSSL_LIBS "$ENV{RTI_OPENSSL_LIBS}")
set(append_library_dirs "${append_library_dirs};${RTI_OPENSSL_LIBS}")
else()
set(append_library_dirs "${append_library_dirs}:$ENV{RTI_OPENSSL_LIBS}")
endif()

else()
# TODO(mikaelarguedas) Move this outside the 'if not connext' block once Connext supports OpenSSL 1.1.1
if(APPLE)
# connext need the openssl libraries to be on the DYLD_LIBRARY_PATH at runtime
# as SIP strips these variables on recent MacOS we populate them here
# see https://github.com/ros2/ros2/issues/409
execute_process(
COMMAND "brew" "--prefix" "openssl"
RESULT_VARIABLE _retcode
OUTPUT_VARIABLE _out_var
ERROR_VARIABLE _error_var
)
if(NOT _retcode EQUAL 0)
message(FATAL_ERROR "command 'brew --prefix openssl' failed with error code '${_retcode}' and error message '${_error_var}'")
endif()
string(STRIP "${_out_var}" _out_var)
set(openssl_lib_path "${_out_var}/lib")
file(TO_NATIVE_PATH "${openssl_lib_path}" openssl_lib_path)
set(append_library_dirs "${append_library_dirs};${openssl_lib_path}")
endif()
endif()

if(NOT WIN32)
Expand Down Expand Up @@ -292,29 +319,6 @@ if(BUILD_TESTING)
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR}")
if(WIN32)
set(append_library_dirs "${append_library_dirs}/$<CONFIG>")
string(REPLACE "\\" "\\\\" RTI_OPENSSL_LIBS "$ENV{RTI_OPENSSL_LIBS}")
set(append_library_dirs "${append_library_dirs};${RTI_OPENSSL_LIBS}")
# TODO(mikaelarguedas) uncomment this once Connext supports OpenSSL 1.1.1
# in the meantime use RTI_OPENSSL_LIBS
# elseif(APPLE)
# # connext need the openssl libraries to be on the DYLD_LIBRARY_PATH at runtime
# # as SIP strips these variables on recent MacOS we populate them here
# # see https://github.com/ros2/ros2/issues/409
# execute_process(
# COMMAND "brew" "--prefix" "openssl"
# RESULT_VARIABLE _retcode
# OUTPUT_VARIABLE _out_var
# ERROR_VARIABLE _error_var
# )
# if(NOT _retcode EQUAL 0)
# message(FATAL_ERROR "command 'brew --prefix openssl' failed with error code '${_retcode}' and error message '${_error_var}'")
# endif()
# string(STRIP "${_out_var}" _out_var)
# set(openssl_lib_path "${_out_var}/lib")
# file(TO_NATIVE_PATH "${openssl_lib_path}" openssl_lib_path)
# set(append_library_dirs "${append_library_dirs};${openssl_lib_path}")
else()
set(append_library_dirs "${append_library_dirs}:$ENV{RTI_OPENSSL_LIBS}")
endif()

# finding gtest once in the highest scope
Expand Down

0 comments on commit f9c4233

Please sign in to comment.