diff test/dynload_plain/CMakeLists.txt @ 313:73b5b9e224e2

- dynload_plain test: stability fix for picking right testing lib on build
author Tassilo Philipp
date Tue, 05 Nov 2019 15:19:16 +0100
parents 7c6f19d42b31
children
line wrap: on
line diff
--- a/test/dynload_plain/CMakeLists.txt	Tue Oct 29 16:09:58 2019 +0100
+++ b/test/dynload_plain/CMakeLists.txt	Tue Nov 05 15:19:16 2019 +0100
@@ -6,7 +6,7 @@
 set_target_properties(x PROPERTIES PREFIX "")
 set_target_properties(x PROPERTIES SUFFIX "")
 if(${UNIX})
-exec_program("((ls /lib*/libc.so* || ls /usr/lib/libc.so*) | grep -v '\\.a\$' | (sort -V -r || sort -t . -n -k 2)) 2>/dev/null | head -1" OUTPUT_VARIABLE DEF_C_DYLIB)
+exec_program("((ldd `which ls` | grep -o '/.*/libc.so[^ ]*' || ls /lib*/libc.so* || ls /usr/lib/libc.so*) | grep -v '\\.a\$' | (sort -V -r || sort -t . -n -k 2)) 2>/dev/null | head -1" OUTPUT_VARIABLE DEF_C_DYLIB)
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDEF_C_DYLIB=\\\"${DEF_C_DYLIB}\\\"")
 endif()