Commit 99afe235 authored by Roger Leigh's avatar Roger Leigh
Browse files

Tests: Add tests for FindGTest

parent 611735e7
......@@ -1362,6 +1362,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
if(CMake_TEST_FindGSL)
add_subdirectory(FindGSL)
endif()
if(CMake_TEST_FindGTest)
add_subdirectory(FindGTest)
endif()
if(CMake_TEST_FindJsonCpp)
add_subdirectory(FindJsonCpp)
endif()
......
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>
)
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)
#include <gtest/gtest.h>
TEST(FindCMake, LinksAndRuns)
{
ASSERT_TRUE(true);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment