Binding Google Test into CMake.

This commit is contained in:
Francois Best 2016-10-03 20:34:43 -07:00
parent 3740624176
commit 4bd4015f9d
5 changed files with 13 additions and 13 deletions

View File

@ -4,5 +4,6 @@ project(arduino_midi_library)
set(ROOT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) set(ROOT_SOURCE_DIR ${PROJECT_SOURCE_DIR})
include_directories(${ROOT_SOURCE_DIR}) include_directories(${ROOT_SOURCE_DIR})
add_subdirectory(external)
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(test) add_subdirectory(test)

1
external/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1 @@
add_subdirectory(google-test)

View File

@ -1,5 +1,7 @@
project(test-runner) project(test-runner)
include_directories(${gtest_SOURCE_DIR}/include)
add_executable(test-runner add_executable(test-runner
test-runner.cpp test-runner.cpp
test-runner.h test-runner.h
@ -7,3 +9,7 @@ add_executable(test-runner
test-runner_Main.cpp test-runner_Main.cpp
test-runner_Main.h test-runner_Main.h
) )
target_link_libraries(test-runner
test-mocks
gtest
)

View File

@ -1,15 +1,7 @@
#include "test-runner_Main.h" #include "test-runner_Main.h"
#include <gtest/gtest.h>
BEGIN_TEST_RUNNER_NAMESPACE int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
bool run() return RUN_ALL_TESTS();
{
return false;
}
END_TEST_RUNNER_NAMESPACE
int main()
{
return TEST_RUNNER_NAMESPACE::run() ? 0 : 1;
} }

View File

@ -6,4 +6,4 @@ BEGIN_TEST_RUNNER_NAMESPACE
END_TEST_RUNNER_NAMESPACE END_TEST_RUNNER_NAMESPACE
int main(); int main(int argc, char **argv);