From aba26067429d2eedf94723714aa9381fb7098848 Mon Sep 17 00:00:00 2001 From: burekn Date: Tue, 23 Apr 2019 11:26:13 -0700 Subject: [PATCH] Prevents build of test if gtest is not found. --- .../mutex_testing_tool/CMakeLists.txt | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/test/realtime/mutex_testing_tool/CMakeLists.txt b/test/realtime/mutex_testing_tool/CMakeLists.txt index 13584aea515..64f9f10be6e 100644 --- a/test/realtime/mutex_testing_tool/CMakeLists.txt +++ b/test/realtime/mutex_testing_tool/CMakeLists.txt @@ -15,18 +15,20 @@ include(${PROJECT_SOURCE_DIR}/cmake/common/gtest.cmake) check_gtest() -add_library(mutex_testing_tool SHARED TMutex.cpp) +if(GTEST_FOUND) + add_library(mutex_testing_tool SHARED TMutex.cpp) -add_library(mutex_testing_tool_preload SHARED Mutex.cpp) -target_link_libraries(mutex_testing_tool_preload PRIVATE mutex_testing_tool ${CMAKE_DL_LIBS}) + add_library(mutex_testing_tool_preload SHARED Mutex.cpp) + target_link_libraries(mutex_testing_tool_preload PRIVATE mutex_testing_tool ${CMAKE_DL_LIBS}) -add_executable(TMutexTests TMutexTests.cpp) -target_include_directories(TMutexTests PRIVATE ${GTEST_INCLUDE_DIRS}) -target_link_libraries(TMutexTests mutex_testing_tool ${GTEST_LIBRARIES}) -STRING(REPLACE " " "\\ " MUTEX_PRELOAD_LIBRARY_FILE "$") -add_gtest(TMutexTests SOURCES TMutexTests.cpp - ENVIRONMENTS - "LD_LIBRARY_PATH=$" - "LD_PRELOAD=$" - LABELS "NoMemoryCheck" - ) + add_executable(TMutexTests TMutexTests.cpp) + target_include_directories(TMutexTests PRIVATE ${GTEST_INCLUDE_DIRS}) + target_link_libraries(TMutexTests mutex_testing_tool ${GTEST_LIBRARIES}) + STRING(REPLACE " " "\\ " MUTEX_PRELOAD_LIBRARY_FILE "$") + add_gtest(TMutexTests SOURCES TMutexTests.cpp + ENVIRONMENTS + "LD_LIBRARY_PATH=$" + "LD_PRELOAD=$" + LABELS "NoMemoryCheck" + ) +endif()