Skip to content

Commit f881d4c

Browse files
committed
build: fix link options propagation for mods w/ single config gen
1 parent 6a6ee63 commit f881d4c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cmake/modules/Utilities.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,14 @@ function(generate_build_configurations)
105105
# But also include DEFAULT_EXE_LINKER_FLAGS (/DEBUG:FULL) for completeness
106106
list(APPEND TARGET_LINK_OPTIONS_LOCAL "$<$<STREQUAL:$<CONFIG>,${triplet}>:${DEFAULT_EXE_LINKER_FLAGS};${linker_flags}>")
107107
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "${triplet}")
108-
# For single-config, append to base flags (don't use TARGET_LINK_OPTIONS to avoid duplication)
108+
# For single-config, append to base flags including DEFAULT_EXE_LINKER_FLAGS
109109
# Preserve CMake's defaults including standard libraries
110-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${exe_linker_flags}" CACHE STRING "" FORCE)
111-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${shared_linker_flags}" CACHE STRING "" FORCE)
110+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${DEFAULT_EXE_LINKER_FLAGS} ${exe_linker_flags}" CACHE STRING "" FORCE)
111+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${DEFAULT_SHARED_LINKER_FLAGS} ${shared_linker_flags}" CACHE STRING "" FORCE)
112112
message(STATUS "Single-config: Applied ${triplet} linker flags to base CMAKE linker flags")
113+
# Also add to TARGET_LINK_OPTIONS for propagation to external consumers
114+
list(APPEND TARGET_LINK_OPTIONS_LOCAL "${DEFAULT_EXE_LINKER_FLAGS}")
115+
list(APPEND TARGET_LINK_OPTIONS_LOCAL "${linker_flags}")
113116
endif()
114117

115118
# Set platform-specific variables

0 commit comments

Comments
 (0)