From 7dd543053cc03b8e350efd9471dbeeeafc7bf946 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Tue, 5 Jan 2016 17:16:05 +0300 Subject: [PATCH] Fix more SDL_main issues - Always include SDL2/SDL_main.h in all tests to handle main() correctly - Link all tests with SDL2pp (and thus with libSDL2main) --- tests/CMakeLists.txt | 1 + tests/header_test.cc.in | 1 + tests/test_error.cc | 1 + tests/test_optional.cc | 2 ++ tests/test_pointrect.cc | 2 ++ tests/test_pointrect_constexpr.cc | 2 ++ tests/test_rwops.cc | 2 ++ 7 files changed, 11 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 656b876..7424787 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,6 +29,7 @@ FOREACH(HEADER ${LIBRARY_HEADERS}) STRING(REGEX REPLACE [^a-zA-Z0-9] _ HEADER_NORMALIZED ${HEADER}) CONFIGURE_FILE(header_test.cc.in ${HEADER_NORMALIZED}_test.cc) ADD_EXECUTABLE(${HEADER_NORMALIZED}_test ${HEADER_NORMALIZED}_test.cc) + TARGET_LINK_LIBRARIES(${HEADER_NORMALIZED}_test SDL2pp) ENDFOREACH(HEADER ${TESTS}) FOREACH(TEST ${CLI_TESTS}) diff --git a/tests/header_test.cc.in b/tests/header_test.cc.in index f998669..4126edf 100644 --- a/tests/header_test.cc.in +++ b/tests/header_test.cc.in @@ -1,3 +1,4 @@ +#include #include <@HEADER@> int main(int, char*[]) { diff --git a/tests/test_error.cc b/tests/test_error.cc index 6242f18..34728cf 100644 --- a/tests/test_error.cc +++ b/tests/test_error.cc @@ -1,3 +1,4 @@ +#include #include #include diff --git a/tests/test_optional.cc b/tests/test_optional.cc index 3a736ee..3905641 100644 --- a/tests/test_optional.cc +++ b/tests/test_optional.cc @@ -1,5 +1,7 @@ #include +#include + #include #include "testing.h" diff --git a/tests/test_pointrect.cc b/tests/test_pointrect.cc index 7c7a2bd..f8ad098 100644 --- a/tests/test_pointrect.cc +++ b/tests/test_pointrect.cc @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/tests/test_pointrect_constexpr.cc b/tests/test_pointrect_constexpr.cc index c36c17a..73b3a1e 100644 --- a/tests/test_pointrect_constexpr.cc +++ b/tests/test_pointrect_constexpr.cc @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/tests/test_rwops.cc b/tests/test_rwops.cc index 3ece7c5..69bbd3f 100644 --- a/tests/test_rwops.cc +++ b/tests/test_rwops.cc @@ -1,5 +1,7 @@ #include +#include + #include #include #include