File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,18 @@ if(ENABLE_GLSLANG_BINARIES)
321321 add_subdirectory (StandAlone )
322322endif ()
323323
324+ option (ALLOW_EXTERNAL_GTEST "Allows to build against installed googletest. This is unsupported if the commit isn't the one in known_good.json" )
325+ set (GMOCK_TARGET gmock)
326+ if (NOT TARGET ${GMOCK_TARGET} )
327+ if (ALLOW_EXTERNAL_GTEST)
328+ message (STATUS "Trying to find local googletest" )
329+ find_package (GTest )
330+ if (TARGET GTest::gmock)
331+ set (GMOCK_TARGET GTest::gmock)
332+ endif ()
333+ endif ()
334+ endif ()
335+
324336if (GLSLANG_TESTS)
325337 enable_testing ()
326338 add_subdirectory (gtests )
Original file line number Diff line number Diff line change 3232# POSSIBILITY OF SUCH DAMAGE.
3333
3434if (GLSLANG_TESTS)
35- if (TARGET gmock )
35+ if (TARGET ${GMOCK_TARGET} )
3636 message (STATUS "Google Mock found - building tests" )
3737
3838 set (TEST_SOURCES
@@ -76,9 +76,7 @@ if(GLSLANG_TESTS)
7676 PRIVATE GLSLANG_TEST_BUILD=1 )
7777 target_include_directories (glslangtests PRIVATE
7878 ${CMAKE_CURRENT_SOURCE_DIR}
79- ${PROJECT_SOURCE_DIR}
80- ${gmock_SOURCE_DIR} /include
81- ${gtest_SOURCE_DIR} /include )
79+ ${PROJECT_SOURCE_DIR} )
8280
8381 if (ENABLE_OPT)
8482 target_link_libraries (glslangtests
@@ -90,7 +88,7 @@ if(GLSLANG_TESTS)
9088 glslang glslang-default-resource-limits
9189 $<$<AND :$<CXX_COMPILER_ID :GNU >,$<VERSION_LESS :$<CXX_COMPILER_VERSION >,9.0>>:stdc ++fs >)
9290
93- target_link_libraries (glslangtests PRIVATE ${LIBRARIES} gmock )
91+ target_link_libraries (glslangtests PRIVATE ${LIBRARIES} ${GMOCK_TARGET} )
9492
9593 # The TARGET_RUNTIME_DLL_DIRS feature requires CMake 3.27 or greater.
9694 if (WIN32 AND BUILD_SHARED_LIBS AND CMAKE_VERSION VERSION_LESS "3.27" )
You can’t perform that action at this time.
0 commit comments