summaryrefslogtreecommitdiffstats
path: root/Tests/FindDevIL
diff options
context:
space:
mode:
authorAlex <10857-leha-bot@users.noreply.gitlab.kitware.com>2021-03-08 18:11:09 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-18 14:42:02 (GMT)
commit73b27f6ae8c9599c9cfea13d8b3413837355ec8a (patch)
treee230cdbeff20e7d8e522c6a8c3a2be98e8f4acdf /Tests/FindDevIL
parent52d3d1bdc5c099209d02e44130d352df55ffc9a0 (diff)
downloadCMake-73b27f6ae8c9599c9cfea13d8b3413837355ec8a.zip
CMake-73b27f6ae8c9599c9cfea13d8b3413837355ec8a.tar.gz
CMake-73b27f6ae8c9599c9cfea13d8b3413837355ec8a.tar.bz2
FindDevIL: add imported targets and tests
Fixes: #21900
Diffstat (limited to 'Tests/FindDevIL')
-rw-r--r--Tests/FindDevIL/CMakeLists.txt10
-rw-r--r--Tests/FindDevIL/Test/CMakeLists.txt29
-rw-r--r--Tests/FindDevIL/Test/main.c10
-rw-r--r--Tests/FindDevIL/Test/main_ilu.c8
4 files changed, 57 insertions, 0 deletions
diff --git a/Tests/FindDevIL/CMakeLists.txt b/Tests/FindDevIL/CMakeLists.txt
new file mode 100644
index 0000000..d37d50f
--- /dev/null
+++ b/Tests/FindDevIL/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindDevIL.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindDevIL/Test"
+ "${CMake_BINARY_DIR}/Tests/FindDevIL/Test"
+ ${build_generator_args}
+ --build-project TestFindDevIL
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindDevIL/Test/CMakeLists.txt b/Tests/FindDevIL/Test/CMakeLists.txt
new file mode 100644
index 0000000..c2c1322
--- /dev/null
+++ b/Tests/FindDevIL/Test/CMakeLists.txt
@@ -0,0 +1,29 @@
+cmake_minimum_required(VERSION 3.1)
+project(TestFindDevIL C)
+include(CTest)
+
+find_package(DevIL)
+
+#FIXME: check version too.
+# add_definitions(
+# -DCMAKE_EXPECTED_SDL_VERSION_MAJOR=${SDL_VERSION_MAJOR}
+# -DCMAKE_EXPECTED_SDL_VERSION_MINOR=${SDL_VERSION_MINOR}
+# -DCMAKE_EXPECTED_SDL_VERSION_PATCH=${SDL_VERSION_PATCH})
+
+add_executable(test_devil_var main.c)
+target_include_directories(test_devil_var PRIVATE ${IL_INCLUDE_DIRS})
+target_link_libraries(test_devil_var PRIVATE ${IL_LIBRARIES})
+add_test(NAME test_devil_var COMMAND test_devil_var)
+
+add_executable(test_devil_il_tgt main.c)
+target_link_libraries(test_devil_il_tgt DevIL::IL)
+add_test(NAME test_devil_il_tgt COMMAND test_devil_il_tgt)
+
+add_executable(test_devil_ilu_tgt main_ilu.c)
+target_link_libraries(test_devil_ilu_tgt DevIL::ILU)
+
+add_executable(test_devil_ilu_var main_ilu.c)
+target_include_directories(test_devil_ilu_var PRIVATE ${IL_INCLUDE_DIRS} ${ILU_INCLUDE_DIRS})
+target_link_libraries(test_devil_ilu_var ${IL_LIBRARIES} ${ILU_LIBRARIES})
+
+#FIXME: Check DevIL::ILUT target
diff --git a/Tests/FindDevIL/Test/main.c b/Tests/FindDevIL/Test/main.c
new file mode 100644
index 0000000..4a07087
--- /dev/null
+++ b/Tests/FindDevIL/Test/main.c
@@ -0,0 +1,10 @@
+#include <IL/il.h>
+
+int main()
+{
+ // Test 1 requires to link to the library.
+ ilInit();
+
+ ilShutDown();
+ return 0;
+}
diff --git a/Tests/FindDevIL/Test/main_ilu.c b/Tests/FindDevIL/Test/main_ilu.c
new file mode 100644
index 0000000..a9e7819
--- /dev/null
+++ b/Tests/FindDevIL/Test/main_ilu.c
@@ -0,0 +1,8 @@
+#include <IL/ilu.h>
+
+int main()
+{
+ // IL Utilities requires only initialization.
+ // Unlike main DevIL there are no shutdown function.
+ iluInit();
+}