Gtests can be run on another source tree

The gtest executable accepts a --test-root option to specify
a root directory for test files.  It defaults to the Test directory
in the source tree from which the executable is built.

For example, this lets us run test exectuables built with MinGW on Linux
on a Windows machine with its own copy of the source tree.
This commit is contained in:
David Neto
2016-10-05 10:25:09 -04:00
parent 196b6e24f6
commit 1d3a966106
13 changed files with 56 additions and 34 deletions

View File

@@ -29,8 +29,12 @@ if (TARGET gmock)
install(TARGETS glslangtests
RUNTIME DESTINATION bin)
set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")
# Supply a default test root directory, so that manual testing
# doesn't have to specify the --test-root option in the normal
# case that you want to use the tests from the same source tree.
target_compile_definitions(glslangtests
PRIVATE GLSLANG_TEST_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}/../Test")
PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}")
target_include_directories(glslangtests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}
@@ -39,5 +43,6 @@ if (TARGET gmock)
target_link_libraries(glslangtests PRIVATE
SPVRemapper glslang OSDependent OGLCompiler HLSL glslang
SPIRV glslang-default-resource-limits gmock)
add_test(NAME glslang-gtests COMMAND glslangtests)
add_test(NAME glslang-gtests
COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}")
endif()