diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9b5779..d79db61 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,7 +81,11 @@ if(BUILD_TESTING AND INJA_BUILD_TESTS)
 
   add_executable(inja_test test/test.cpp)
   target_link_libraries(inja_test PRIVATE inja)
-  add_test(inja_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/inja_test)
+  target_include_directories(inja_test PRIVATE
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third_party/include>
+  )
+  add_test(NAME inja_test COMMAND inja_test
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
 
   if(MSVC)
     target_compile_options(inja_test PRIVATE /W4 /permissive-)
