From bd26a7f857ec0fbe5b29ee6d2e5ba248d88b3919 Mon Sep 17 00:00:00 2001 From: freemine Date: Wed, 27 Apr 2022 18:06:42 +0800 Subject: [PATCH] fix compiler error when linking with static gtest lib (#11956) --- src/client/tests/CMakeLists.txt | 4 +++- src/os/tests/CMakeLists.txt | 4 +++- src/query/tests/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/client/tests/CMakeLists.txt b/src/client/tests/CMakeLists.txt index 6ba6d5f6a8..457bc732ee 100644 --- a/src/client/tests/CMakeLists.txt +++ b/src/client/tests/CMakeLists.txt @@ -12,7 +12,9 @@ IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR)) SET(CMAKE_CXX_STANDARD 11) INCLUDE_DIRECTORIES(/usr/include /usr/local/include) - LINK_DIRECTORIES(/usr/lib /usr/local/lib) + IF (NOT LIB_GTEST_STATIC_DIR) + LINK_DIRECTORIES(/usr/lib /usr/local/lib) + ENDIF() AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) diff --git a/src/os/tests/CMakeLists.txt b/src/os/tests/CMakeLists.txt index ef2c387e07..728648ba37 100644 --- a/src/os/tests/CMakeLists.txt +++ b/src/os/tests/CMakeLists.txt @@ -12,7 +12,9 @@ IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR)) SET(CMAKE_CXX_STANDARD 11) INCLUDE_DIRECTORIES(/usr/include /usr/local/include) - LINK_DIRECTORIES(/usr/lib /usr/local/lib) + IF (NOT LIB_GTEST_STATIC_DIR) + LINK_DIRECTORIES(/usr/lib /usr/local/lib) + ENDIF() AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) diff --git a/src/query/tests/CMakeLists.txt b/src/query/tests/CMakeLists.txt index 6f3268377c..6a77cc148f 100644 --- a/src/query/tests/CMakeLists.txt +++ b/src/query/tests/CMakeLists.txt @@ -12,7 +12,9 @@ IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR)) SET(CMAKE_CXX_STANDARD 11) INCLUDE_DIRECTORIES(/usr/include /usr/local/include) - LINK_DIRECTORIES(/usr/lib /usr/local/lib) + IF (NOT LIB_GTEST_STATIC_DIR) + LINK_DIRECTORIES(/usr/lib /usr/local/lib) + ENDIF() INCLUDE_DIRECTORIES(${HEADER_GTEST_INCLUDE_DIR}) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) -- GitLab