From bece79f9bea1aa61d578429b63da76879ac5e5ba Mon Sep 17 00:00:00 2001 From: Christopher Degawa Date: Fri, 11 Jun 2021 15:38:44 -0500 Subject: Tests: Add case covering FindGLUT variables and imported targets Signed-off-by: Christopher Degawa --- .gitlab/ci/configure_debian10_aarch64_ninja.cmake | 1 + .gitlab/ci/configure_debian10_ninja.cmake | 1 + .gitlab/ci/configure_fedora34_makefiles.cmake | 1 + Tests/CMakeLists.txt | 1 + Tests/FindGLUT/CMakeLists.txt | 9 +++++++++ Tests/FindGLUT/Test/CMakeLists.txt | 17 +++++++++++++++++ Tests/FindGLUT/Test/main.c | 11 +++++++++++ 7 files changed, 41 insertions(+) create mode 100644 Tests/FindGLUT/CMakeLists.txt create mode 100644 Tests/FindGLUT/Test/CMakeLists.txt create mode 100644 Tests/FindGLUT/Test/main.c diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake index 4d8dde6..a6b7cb5 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake @@ -16,6 +16,7 @@ set(CMake_TEST_FindGDAL "ON" CACHE BOOL "") set(CMake_TEST_FindGIF "ON" CACHE BOOL "") set(CMake_TEST_FindGit "ON" CACHE BOOL "") set(CMake_TEST_FindGLEW "ON" CACHE BOOL "") +set(CMake_TEST_FindGLUT "ON" CACHE BOOL "") set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "") set(CMake_TEST_FindGSL "ON" CACHE BOOL "") set(CMake_TEST_FindGTest "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index 732624a..10d0997 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -16,6 +16,7 @@ set(CMake_TEST_FindGDAL "ON" CACHE BOOL "") set(CMake_TEST_FindGIF "ON" CACHE BOOL "") set(CMake_TEST_FindGit "ON" CACHE BOOL "") set(CMake_TEST_FindGLEW "ON" CACHE BOOL "") +set(CMake_TEST_FindGLUT "ON" CACHE BOOL "") set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "") set(CMake_TEST_FindGSL "ON" CACHE BOOL "") set(CMake_TEST_FindGTest "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora34_makefiles.cmake b/.gitlab/ci/configure_fedora34_makefiles.cmake index 48786e4..d4bdb6a 100644 --- a/.gitlab/ci/configure_fedora34_makefiles.cmake +++ b/.gitlab/ci/configure_fedora34_makefiles.cmake @@ -16,6 +16,7 @@ set(CMake_TEST_FindGDAL "ON" CACHE BOOL "") set(CMake_TEST_FindGIF "ON" CACHE BOOL "") set(CMake_TEST_FindGit "ON" CACHE BOOL "") set(CMake_TEST_FindGLEW "ON" CACHE BOOL "") +set(CMake_TEST_FindGLUT "ON" CACHE BOOL "") set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "") set(CMake_TEST_FindGSL "ON" CACHE BOOL "") set(CMake_TEST_FindGTest "ON" CACHE BOOL "") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 341aba6..388ff20 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1442,6 +1442,7 @@ if(BUILD_TESTING) GIF Git GLEW + GLUT GnuTLS GSL GTK2 diff --git a/Tests/FindGLUT/CMakeLists.txt b/Tests/FindGLUT/CMakeLists.txt new file mode 100644 index 0000000..e75ec40 --- /dev/null +++ b/Tests/FindGLUT/CMakeLists.txt @@ -0,0 +1,9 @@ +add_test(NAME FindGLUT.Test COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGLUT/Test" + "${CMake_BINARY_DIR}/Tests/FindGLUT/Test" + ${build_generator_args} + --build-project TestFindGLUT + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) diff --git a/Tests/FindGLUT/Test/CMakeLists.txt b/Tests/FindGLUT/Test/CMakeLists.txt new file mode 100644 index 0000000..0f4e536 --- /dev/null +++ b/Tests/FindGLUT/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.21) +project(TestFindGLUT C) +include(CTest) + +find_package(GLUT REQUIRED) + +add_executable(testglut_tgt main.c) +target_link_libraries(testglut_tgt GLUT::GLUT) +add_test(NAME testglut_tgt COMMAND testglut_tgt) + +add_executable(testglut_var main.c) +target_include_directories(testglut_var PRIVATE ${GLUT_INCLUDE_DIRS}) +target_link_libraries(testglut_var PRIVATE ${GLUT_LIBRARIES}) +add_test(NAME testglut_var COMMAND testglut_var) + +set_tests_properties(testglut_tgt testglut_var + PROPERTIES WILL_FAIL true) diff --git a/Tests/FindGLUT/Test/main.c b/Tests/FindGLUT/Test/main.c new file mode 100644 index 0000000..1c8569c --- /dev/null +++ b/Tests/FindGLUT/Test/main.c @@ -0,0 +1,11 @@ +#include +#include + +int main() +{ + /* The following should call exit(1) and print + freeglut ERROR: Function called + without first calling 'glutInit'. + to stderr */ + glutCreateWindow("gluttest"); +} -- cgit v0.12