Skip to content

Commit 144d69b

Browse files
antonovalexnnrdementi
authored andcommitted
Check googletest framework before building utests
1 parent b06e66f commit 144d69b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
[submodule "Intel-PMT"]
1111
path = Intel-PMT
1212
url = https://github.com/intel/Intel-PMT.git
13-
[submodule "googletest"]
14-
path = googletest
13+
[submodule "tests/googletest"]
14+
path = tests/googletest
1515
url = https://github.com/google/googletest.git

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ add_subdirectory(src)
185185
add_subdirectory(examples)
186186
add_subdirectory(tests)
187187

188-
if(UNIX)
189-
add_subdirectory(googletest)
190-
endif(UNIX)
191-
192188
message(STATUS "Install directory: ${CMAKE_INSTALL_PREFIX}")
193189

194190
#######################

tests/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ if(UNIX)
1717
target_link_libraries(urltest Threads::Threads PCM_STATIC)
1818
endif(LINUX)
1919

20-
add_subdirectory(utests)
20+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/include/gtest/gtest.h")
21+
add_subdirectory(googletest)
22+
add_subdirectory(utests)
23+
else()
24+
message(WARNING
25+
"Local googletest does not exist - unit tests will not be built.\n"
26+
"If you need unit tests, please update submodules with the command: 'git submodule update --init --recursive'.\n")
27+
endif()
2128
endif(UNIX)
2229

2330
if(PCM_FUZZ)

0 commit comments

Comments
 (0)