Skip to content

Commit

Permalink
[cmake] setup LD_LIBRARY_PATH to run test on unix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiencastan committed Apr 26, 2020
1 parent 59179cf commit 6dba4ff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cmake/Helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,16 @@ function(alicevision_add_test test_file)
PROPERTY FOLDER Test
)

add_test(NAME ${TEST_EXECUTABLE_NAME}
add_test(NAME test_${TEST_EXECUTABLE_NAME}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMAND $<TARGET_FILE:${TEST_EXECUTABLE_NAME}> --catch_system_error=yes --log_level=all
)

if(UNIX)
# setup LD_LIBRARY_PATH for running tests
get_property(TEST_LINK_DIRS TARGET ${TEST_EXECUTABLE_NAME} PROPERTY LINK_DIRECTORIES)

set_property(TEST test_${TEST_EXECUTABLE_NAME} PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${TEST_LINK_DIRS}:$ENV{LD_LIBRARY_PATH}")
endif()

endfunction()

0 comments on commit 6dba4ff

Please sign in to comment.