Tests: Add tests for FindGTest

This commit is contained in:
Roger Leigh 2015-12-10 23:08:23 +00:00
parent 611735e76e
commit 99afe23513
4 changed files with 38 additions and 0 deletions

View File

@ -1362,6 +1362,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
if(CMake_TEST_FindGSL) if(CMake_TEST_FindGSL)
add_subdirectory(FindGSL) add_subdirectory(FindGSL)
endif() endif()
if(CMake_TEST_FindGTest)
add_subdirectory(FindGTest)
endif()
if(CMake_TEST_FindJsonCpp) if(CMake_TEST_FindJsonCpp)
add_subdirectory(FindJsonCpp) add_subdirectory(FindJsonCpp)
endif() endif()

View File

@ -0,0 +1,10 @@
add_test(NAME FindGTest.Test COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindGTest/Test"
"${CMake_BINARY_DIR}/Tests/FindGTest/Test"
${build_generator_args}
--build-project TestFindGTest
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.1)
project(TestFindGTest CXX)
include(CTest)
# CMake does not actually provide FindGTest publicly.
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
find_package(GTest REQUIRED)
add_executable(test_gtest_tgt main.cxx)
target_link_libraries(test_gtest_tgt GTest::Main)
add_test(NAME test_gtest_tgt COMMAND test_gtest_tgt)
add_executable(test_gtest_var main.cxx)
target_include_directories(test_gtest_var PRIVATE ${GTEST_INCLUDE_DIRS})
target_link_libraries(test_gtest_var PRIVATE ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_test(NAME test_gtest_var COMMAND test_gtest_var)

View File

@ -0,0 +1,6 @@
#include <gtest/gtest.h>
TEST(FindCMake, LinksAndRuns)
{
ASSERT_TRUE(true);
}