diff --git a/recompiler/tests/test_runtime_exe_name.py b/recompiler/tests/test_runtime_exe_name.py index c4ac56aa..b36792b4 100644 --- a/recompiler/tests/test_runtime_exe_name.py +++ b/recompiler/tests/test_runtime_exe_name.py @@ -62,6 +62,8 @@ def main() -> int: cmake = (ROOT / "runtime/runtime.cmake").read_text(encoding="utf-8") check("psxrecomp_exe_name-${target}.txt" in cmake, "runtime.cmake writes psxrecomp_exe_name-.txt") + check("file(GENERATE" in cmake and "TARGET_FILE_BASE_NAME:${target}" in cmake, + "marker uses the final CMake target filename") check('MAKE_C_IDENTIFIER "${PSXRT_WINDOW_TITLE}"' in cmake, "OUTPUT_NAME still derives from WINDOW_TITLE (marker must match it)") diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index 98f1ab6d..11a8c8dd 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -976,13 +976,11 @@ function(psxrecomp_add_runtime_target target) # Revelations_Persona__Recompiled.exe — same algorithm, colon in a # different place. # - # Written at configure time (not file(GENERATE)) because _psxrt_exe_name is - # a plain variable here: it carries no generator expression and does not - # vary per configuration, so a fixed filename is correct on multi-config - # generators too. Name only, never a path — the consumers already know - # their build directory, and only ever got the basename wrong. - file(WRITE "${CMAKE_BINARY_DIR}/psxrecomp_exe_name-${target}.txt" - "${_psxrt_exe_name}\n") + # Generate-time output uses the final target property, so a game that + # changes OUTPUT_NAME after this helper returns still publishes the name + # CMake will actually link. + file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/psxrecomp_exe_name-${target}.txt" + CONTENT "$\n") # ---- Windows / desktop app icon --------------------------------------- # Prefer an explicit APP_ICON, then the game-repo copy under assets/, then