Only link with libdl on Linux
Requiring an extra library for dlopen is a Linux non-POSIX-compliance.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt
index 6233de4..a30c89c 100644
--- a/programs/test/CMakeLists.txt
+++ b/programs/test/CMakeLists.txt
@@ -38,7 +38,9 @@
if(USE_SHARED_MBEDTLS_LIBRARY)
add_executable(dlopen "dlopen.c")
target_include_directories(dlopen PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
- target_link_libraries(dlopen "-ldl")
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ target_link_libraries(dlopen "-ldl")
+ endif()
endif()
foreach(exe IN LISTS executables_libs executables_mbedcrypto)