Skip to content

Commit 533c99c

Browse files
use openssl 1.0.2 only when connext is used
Signed-off-by: Mikael Arguedas <[email protected]>
1 parent 60ba093 commit 533c99c

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

test_security/CMakeLists.txt

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,33 @@ if(BUILD_TESTING)
262262
set(RTI_BIN_PATH "$ENV{RTI_OPENSSL_BIN}")
263263
file(TO_CMAKE_PATH "${RTI_BIN_PATH}" RTI_BIN_PATH)
264264
set(TEST_PATH "${RTI_BIN_PATH};${ENV_PATH}")
265+
if(WIN32)
266+
string(REPLACE "\\" "\\\\" RTI_OPENSSL_LIBS "$ENV{RTI_OPENSSL_LIBS}")
267+
set(append_library_dirs "${append_library_dirs};${RTI_OPENSSL_LIBS}")
268+
else()
269+
set(append_library_dirs "${append_library_dirs}:$ENV{RTI_OPENSSL_LIBS}")
270+
endif()
271+
272+
else()
273+
# TODO(mikaelarguedas) Move this outside the 'if not connext' block once Connext supports OpenSSL 1.1.1
274+
if(APPLE)
275+
# connext need the openssl libraries to be on the DYLD_LIBRARY_PATH at runtime
276+
# as SIP strips these variables on recent MacOS we populate them here
277+
# see https://github.com/ros2/ros2/issues/409
278+
execute_process(
279+
COMMAND "brew" "--prefix" "openssl"
280+
RESULT_VARIABLE _retcode
281+
OUTPUT_VARIABLE _out_var
282+
ERROR_VARIABLE _error_var
283+
)
284+
if(NOT _retcode EQUAL 0)
285+
message(FATAL_ERROR "command 'brew --prefix openssl' failed with error code '${_retcode}' and error message '${_error_var}'")
286+
endif()
287+
string(STRIP "${_out_var}" _out_var)
288+
set(openssl_lib_path "${_out_var}/lib")
289+
file(TO_NATIVE_PATH "${openssl_lib_path}" openssl_lib_path)
290+
set(append_library_dirs "${append_library_dirs};${openssl_lib_path}")
291+
endif()
265292
endif()
266293

267294
if(NOT WIN32)
@@ -291,29 +318,6 @@ if(BUILD_TESTING)
291318
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR}")
292319
if(WIN32)
293320
set(append_library_dirs "${append_library_dirs}/$<CONFIG>")
294-
string(REPLACE "\\" "\\\\" RTI_OPENSSL_LIBS "$ENV{RTI_OPENSSL_LIBS}")
295-
set(append_library_dirs "${append_library_dirs};${RTI_OPENSSL_LIBS}")
296-
# TODO(mikaelarguedas) uncomment this once Connext supports OpenSSL 1.1.1
297-
# in the meantime use RTI_OPENSSL_LIBS
298-
# elseif(APPLE)
299-
# # connext need the openssl libraries to be on the DYLD_LIBRARY_PATH at runtime
300-
# # as SIP strips these variables on recent MacOS we populate them here
301-
# # see https://github.com/ros2/ros2/issues/409
302-
# execute_process(
303-
# COMMAND "brew" "--prefix" "openssl"
304-
# RESULT_VARIABLE _retcode
305-
# OUTPUT_VARIABLE _out_var
306-
# ERROR_VARIABLE _error_var
307-
# )
308-
# if(NOT _retcode EQUAL 0)
309-
# message(FATAL_ERROR "command 'brew --prefix openssl' failed with error code '${_retcode}' and error message '${_error_var}'")
310-
# endif()
311-
# string(STRIP "${_out_var}" _out_var)
312-
# set(openssl_lib_path "${_out_var}/lib")
313-
# file(TO_NATIVE_PATH "${openssl_lib_path}" openssl_lib_path)
314-
# set(append_library_dirs "${append_library_dirs};${openssl_lib_path}")
315-
else()
316-
set(append_library_dirs "${append_library_dirs}:$ENV{RTI_OPENSSL_LIBS}")
317321
endif()
318322

319323
# finding gtest once in the highest scope

0 commit comments

Comments
 (0)