diff options
author | Brad King <brad.king@kitware.com> | 2015-12-14 15:00:02 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-12-14 15:00:02 (GMT) |
commit | c952f2b42469c22b09570d35eb67d6521eeffbb7 (patch) | |
tree | 42945ce3ee921a64e1dcc478dcfe9275fc4b91dd /Tests | |
parent | 09da79b40ff5a809490b40709a9e564e4ceec0b7 (diff) | |
parent | f0b5ce7f94ae699ed583777534742bbeb211407a (diff) | |
download | CMake-c952f2b42469c22b09570d35eb67d6521eeffbb7.zip CMake-c952f2b42469c22b09570d35eb67d6521eeffbb7.tar.gz CMake-c952f2b42469c22b09570d35eb67d6521eeffbb7.tar.bz2 |
Merge topic 'FindGTest-imported-targets'
f0b5ce7f Help: Add notes for topic 'FindGTest-imported-targets'
99afe235 Tests: Add tests for FindGTest
611735e7 FindGTest: Add imported targets and update documentation
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/FindGTest/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindGTest/Test/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/FindGTest/Test/main.cxx | 6 |
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); +} |