From 27550b02e26c71a9638ff25aeaeff32183ca5a3f Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 16 Dec 2024 18:44:47 +0000 Subject: [PATCH] Windows: inhibit all default application manifests. In 0.81 and before, we put an application manifest (XML-formatted Windows resource) into all the GUI tools on purpose, and the CLI tools like Plink didn't have one. But in 0.82, the CLI tools do have one, and it's a small default one we didn't write ourselves, inserted by some combination of cmake and clang-imitating-MSVC (I haven't checked which of those is the cause). This appears to have happened as a side effect of a build-tools update, not on purpose. And its effect is that Windows XP now objects to our plink.exe, because it's very picky about manifest format (we have an old 'xp-wont-run' bug record about that). Since it seemed to work fine to not have a manifest at all in 0.81, let's go back to that. We were already passing /manifest:no to inhibit the default manifest in the GUI tools, to stop it fighting with our custom one; now I've moved /manifest:no into the global linker flags, so it's applied to _all_ binaries, whether we're putting our own manifest in or not. --- cmake/platforms/windows.cmake | 4 +--- windows/CMakeLists.txt | 20 +++++--------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake index a7ed7c7c..481809ec 100644 --- a/cmake/platforms/windows.cmake +++ b/cmake/platforms/windows.cmake @@ -101,14 +101,12 @@ endif() if(WINELIB) enable_language(RC) - set(LFLAG_MANIFEST_NO "") elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC" OR CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC") set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} /nologo /C1252") - set(LFLAG_MANIFEST_NO "/manifest:no") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /manifest:no") else() set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -c1252") - set(LFLAG_MANIFEST_NO "") endif() if(STRICT) diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 7e16b0f4..aefcb9d2 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -83,9 +83,7 @@ add_dependencies(pageant generated_licence_h) target_link_libraries(pageant guimisc eventloop agent network crypto utils ${platform_libraries}) -set_target_properties(pageant PROPERTIES - WIN32_EXECUTABLE ON - LINK_FLAGS "${LFLAG_MANIFEST_NO}") +set_target_properties(pageant PROPERTIES WIN32_EXECUTABLE ON) installed_program(pageant) add_sources_from_current_dir(plink no-jump-list.c nohelp.c plink.rc) @@ -111,9 +109,7 @@ target_link_libraries(putty guiterminal guimisc eventloop sshclient otherbackends settings network crypto utils ${platform_libraries}) -set_target_properties(putty PROPERTIES - WIN32_EXECUTABLE ON - LINK_FLAGS "${LFLAG_MANIFEST_NO}") +set_target_properties(putty PROPERTIES WIN32_EXECUTABLE ON) installed_program(putty) add_executable(puttytel @@ -132,9 +128,7 @@ add_dependencies(puttytel generated_licence_h) target_link_libraries(puttytel guiterminal guimisc eventloop otherbackends settings network utils ${platform_libraries}) -set_target_properties(puttytel PROPERTIES - WIN32_EXECUTABLE ON - LINK_FLAGS "${LFLAG_MANIFEST_NO}") +set_target_properties(puttytel PROPERTIES WIN32_EXECUTABLE ON) installed_program(puttytel) add_executable(puttygen @@ -152,9 +146,7 @@ add_dependencies(puttygen generated_licence_h) target_link_libraries(puttygen keygen guimisc crypto utils ${platform_libraries}) -set_target_properties(puttygen PROPERTIES - WIN32_EXECUTABLE ON - LINK_FLAGS "${LFLAG_MANIFEST_NO}") +set_target_properties(puttygen PROPERTIES WIN32_EXECUTABLE ON) installed_program(puttygen) if(HAVE_CONPTY) @@ -174,9 +166,7 @@ if(HAVE_CONPTY) target_link_libraries(pterm guiterminal guimisc eventloop settings network utils ${platform_libraries}) - set_target_properties(pterm PROPERTIES - WIN32_EXECUTABLE ON - LINK_FLAGS "${LFLAG_MANIFEST_NO}") + set_target_properties(pterm PROPERTIES WIN32_EXECUTABLE ON) installed_program(pterm) else() message("ConPTY not available; cannot build Windows pterm")