1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
From: =?utf-8?q?Timo_R=C3=B6hling?= <timo@gaussglocke.de>
Date: Tue, 17 Nov 2020 17:08:23 +0100
Subject: Add test executable for CTest
Forwarded: not-needed
---
CMakeLists.txt | 7 +++++++
test_tinyexr.cc | 3 +--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d429a54..d72760c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,7 @@ project(tinyexr VERSION ${TINYEXR_VERSION} LANGUAGES C CXX)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
+include(CTest)
find_package(ZLIB REQUIRED)
@@ -44,3 +45,9 @@ install(EXPORT tinyexrTargets
NAMESPACE tinyexr::
)
+if(BUILD_TESTING)
+ add_executable(test_tinyexr test_tinyexr.cc)
+ target_link_libraries(test_tinyexr tinyexr::tinyexr)
+ add_test(NAME test_tinyexr COMMAND test_tinyexr ${CMAKE_CURRENT_SOURCE_DIR}/asakusa.exr)
+endif()
+
diff --git a/test_tinyexr.cc b/test_tinyexr.cc
index 8c80e0c..1e2879c 100644
--- a/test_tinyexr.cc
+++ b/test_tinyexr.cc
@@ -16,8 +16,7 @@
//#define TINYEXR_USE_MINIZ (0)
//#include <zlib.h>
-#define TINYEXR_IMPLEMENTATION
-#include "tinyexr.h"
+#include <tinyexr.h>
#ifdef __clang__
#if __has_warning("-Wzero-as-null-pointer-constant")
|