From 3eaad77de2a9c751e56424f3c34afec943beb647 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 5 May 2015 19:09:51 +0200 Subject: tests: Only link against threading library if available Signed-off-by: Andreas Schneider --- tests/CMakeLists.txt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7cdb2c48..a775c3c2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -17,24 +17,28 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) +set(TORTURE_LINK_LIBRARIES + ${CMOCKA_LIBRARY} + ${LIBSSH_STATIC_LIBRARY} + ${LIBSSH_LINK_LIBRARIES}) + +if (Threads_FOUND) + set(TORTURE_LINK_LIBRARIES + ${TORTURE_LINK_LIBRARIES} + ${LIBSSH_THREADS_STATIC_LIBRARY} + ${LIBSSH_THREADS_LINK_LIBRARIES}) +endif () + # create test library add_library(${TORTURE_LIBRARY} STATIC cmdline.c torture.c) target_link_libraries(${TORTURE_LIBRARY} - ${CMOCKA_LIBRARY} - ${LIBSSH_STATIC_LIBRARY} - ${LIBSSH_LINK_LIBRARIES} - ${LIBSSH_THREADS_STATIC_LIBRARY} - ${LIBSSH_THREADS_LINK_LIBRARIES} + ${TORTURE_LINK_LIBRARIES} ${ARGP_LIBRARIES} ) set(TEST_TARGET_LIBRARIES ${TORTURE_LIBRARY} - ${CMOCKA_LIBRARY} - ${LIBSSH_STATIC_LIBRARY} - ${LIBSSH_LINK_LIBRARIES} - ${LIBSSH_THREADS_STATIC_LIBRARY} - ${LIBSSH_THREADS_LINK_LIBRARIES} + ${TORTURE_LINK_LIBRARIES} ) add_subdirectory(unittests) -- cgit