Files
macports-ports/graphics/tinygltf/files/03_patch-enable-ctest.diff

34 lines
1.2 KiB
Diff

--- /dev/null
+++ tests/CMakeLists.txt
@@ -0,0 +1,9 @@
+if(TINYGLTF_BUILD_TESTS)
+ add_executable(tester tester.cc)
+ set_property(TARGET tester PROPERTY CXX_STANDARD 11)
+ add_test(NAME tester COMMAND tester WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ target_include_directories(tester PRIVATE
+ ${CMAKE_SOURCE_DIR}
+ ${stb_INCLUDE_DIRS}
+ )
+endif()
--- CMakeLists.txt.orig 2025-01-03 11:56:36
+++ CMakeLists.txt 2025-01-03 12:05:10
@@ -21,6 +21,7 @@
option(TINYGLTF_HEADER_ONLY "On: header-only mode. Off: create tinygltf library(No TINYGLTF_IMPLEMENTATION required in your project)" OFF)
option(TINYGLTF_INSTALL "Install tinygltf files during install step. Usually set to OFF if you include tinygltf through add_subdirectory()" ON)
option(TINYGLTF_INSTALL_VENDOR "Install vendored nlohmann/json and nothings/stb headers" ON)
+option(TINYGLTF_BUILD_TESTS "Build tests" OFF)
if (TINYGLTF_BUILD_LOADER_EXAMPLE)
add_executable(loader_example
@@ -66,3 +67,8 @@
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
install(FILES tiny_gltf.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+
+if(TINYGLTF_BUILD_TESTS)
+ include(CTest)
+ add_subdirectory(tests)
+endif(TINYGLTF_BUILD_TESTS)