summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@codelibre.net>2015-12-10 23:08:23 (GMT)
committerRoger Leigh <rleigh@codelibre.net>2015-12-10 23:09:16 (GMT)
commit99afe23513054db4add5143de4aa3a826e8c6c75 (patch)
treeefd88c253726469322db14953b0d9cc262400616
parent611735e76e14807e2145d6b67efbb080d419f19f (diff)
downloadCMake-99afe23513054db4add5143de4aa3a826e8c6c75.zip
CMake-99afe23513054db4add5143de4aa3a826e8c6c75.tar.gz
CMake-99afe23513054db4add5143de4aa3a826e8c6c75.tar.bz2
Tests: Add tests for FindGTest
-rw-r--r--Tests/CMakeLists.txt5
-rw-r--r--Tests/FindGTest/CMakeLists.txt10
-rw-r--r--Tests/FindGTest/Test/CMakeLists.txt17
-rw-r--r--Tests/FindGTest/Test/main.cxx6
4 files changed, 38 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5d492cf..65bfb77 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -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()
diff --git a/Tests/FindGTest/CMakeLists.txt b/Tests/FindGTest/CMakeLists.txt
new file mode 100644
index 0000000..cbc92b1
--- /dev/null
+++ b/Tests/FindGTest/CMakeLists.txt
@@ -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>
+ )
diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt
new file mode 100644
index 0000000..99368ac
--- /dev/null
+++ b/Tests/FindGTest/Test/CMakeLists.txt
@@ -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)
diff --git a/Tests/FindGTest/Test/main.cxx b/Tests/FindGTest/Test/main.cxx
new file mode 100644
index 0000000..0572a5d
--- /dev/null
+++ b/Tests/FindGTest/Test/main.cxx
@@ -0,0 +1,6 @@
+#include <gtest/gtest.h>
+
+TEST(FindCMake, LinksAndRuns)
+{
+ ASSERT_TRUE(true);
+}