47 lines
1.6 KiB
Diff
47 lines
1.6 KiB
Diff
diff --git a/tests/amd_smi_test/CMakeLists.txt b/tests/amd_smi_test/CMakeLists.txt
|
|
index 33bb0018..d57501fe 100644
|
|
--- a/tests/amd_smi_test/CMakeLists.txt
|
|
+++ b/tests/amd_smi_test/CMakeLists.txt
|
|
@@ -1,15 +1,21 @@
|
|
# Required Defines first:
|
|
option(INSTALL_GTEST "Install GTest (only useful if GTest is not already installed)" OFF)
|
|
|
|
+option(USE_SYSTEM_GTEST "Use system GTest" OFF)
|
|
+
|
|
# Help tests find libraries at runtime
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-new-dtags")
|
|
set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../../lib"
|
|
CACHE STRING "RUNPATH for tests. Helps find libgtest.so and libamd_smi.so")
|
|
|
|
-# Download and compile googletest
|
|
-include(FetchContent)
|
|
-FetchContent_Declare(googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.14.0)
|
|
-FetchContent_MakeAvailable(googletest)
|
|
+if(USE_SYSTEM_GTEST)
|
|
+ find_package( GTest REQUIRED )
|
|
+else()
|
|
+ # Download and compile googletest
|
|
+ include(FetchContent)
|
|
+ FetchContent_Declare(googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.14.0)
|
|
+ FetchContent_MakeAvailable(googletest)
|
|
+endif()
|
|
|
|
enable_testing()
|
|
|
|
@@ -63,8 +69,10 @@ install(
|
|
DESTINATION ${SHARE_INSTALL_PREFIX}/tests
|
|
COMPONENT ${TESTS_COMPONENT})
|
|
|
|
-# Install googletest libraries with tests
|
|
-install(
|
|
- TARGETS gtest gtest_main
|
|
- DESTINATION ${SHARE_INSTALL_PREFIX}/tests
|
|
- COMPONENT ${TESTS_COMPONENT})
|
|
+if( NOT USE_SYSTEM_GTEST)
|
|
+ # Install googletest libraries with tests
|
|
+ install(
|
|
+ TARGETS gtest gtest_main
|
|
+ DESTINATION ${SHARE_INSTALL_PREFIX}/tests
|
|
+ COMPONENT ${TESTS_COMPONENT})
|
|
+endif()
|