Skip to content

Commit 09a0352

Browse files
build(win): only pass /MANIFEST:NO to MSVC (#5129)
Fixes #5124 `fancy_add_executable()` currently adds the Windows manifest resource file for all `WIN32` builds, but it also unconditionally passes `/MANIFEST:NO` to the linker. That switch is MSVC-specific, so MinGW ends up forwarding it to `ld` as a path and the executable link fails. This change keeps embedding `src/windows/oiio_exe.rc` for all Windows toolchains, but only adds `/MANIFEST:NO` when the build is using MSVC. That preserves the intended long-path manifest behavior from #5066 while letting MinGW link the Windows executables again. Assisted-by: Codex / GPT-5 Tests: - Ran a targeted CMake smoke test that configures a dummy executable with `WIN32=TRUE,MSVC=TRUE` and verified that `/MANIFEST:NO` is present in `LINK_OPTIONS` and the `.rc` file is attached as a source. - Ran the same smoke test with `WIN32=TRUE,MSVC=FALSE` and verified that the `.rc` file is still attached but `/MANIFEST:NO` is not added. - I could not run an actual MinGW build locally in this environment because a MinGW toolchain is not installed here. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
1 parent 7355728 commit 09a0352

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cmake/fancy_add_executable.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ macro (fancy_add_executable)
4545
if (_target_NAME_enabled)
4646
add_executable (${_target_NAME} ${_target_SRC})
4747
if (WIN32)
48-
# Disable default manifest generation to avoid conflicts.
49-
target_link_options(${_target_NAME} PRIVATE "/MANIFEST:NO")
48+
if (MSVC)
49+
# Disable default manifest generation to avoid conflicts.
50+
target_link_options(${_target_NAME} PRIVATE "/MANIFEST:NO")
51+
endif ()
5052
# Include Windows resource file, which will in turn embed our exe manifest.
5153
target_sources(${_target_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/src/windows/oiio_exe.rc")
5254
endif ()

0 commit comments

Comments
 (0)