diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea8cf43eb3bbd2c059ec83712e4baf1fe916292b..4190e68a88d7377b79626c41f8e38088a07c73bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,6 @@ include("FetchContent")
 
 include(ExternalProject)
 
-configure_file(xpdevplus.h.in xpdevplus.h)
 add_compile_options(-include xpdevplus.h)
 
 FetchContent_Declare(
@@ -59,6 +58,7 @@ set(SOURCE
 	$<TARGET_OBJECTS:xpdev>
 )
 
+configure_file(xpdevplus.h.in xpdevplus.h)
 add_library(xpdevplus STATIC ${SOURCE})
 target_link_libraries(xpdevplus ciolib comio encode hash uifc xpdev)
 target_include_directories(xpdevplus PUBLIC ${XPDevPlus_BINARY_DIR})