[compiler-rt] [compiler-rt] Add version info to Windows runtime DLLs (PR #216408)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 13:56:57 PDT 2026
================
@@ -24,6 +25,65 @@ function(set_target_output_directories target output_dir)
endif()
endfunction()
+function(add_compiler_rt_windows_version_resource_file OUT_VAR RESOURCE_VAR name)
+ set(sources ${ARGN})
+ if(MSVC AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(resource_file)
+ foreach(candidate_resource_file IN ITEMS
+ "${LLVM_SOURCE_DIR}/resources/windows_version_resource.rc"
+ "${LLVM_MAIN_SRC_DIR}/resources/windows_version_resource.rc"
+ "${LLVM_MAIN_SRC_DIR}/llvm/resources/windows_version_resource.rc")
+ if(EXISTS "${candidate_resource_file}")
+ set(resource_file "${candidate_resource_file}")
+ break()
+ endif()
+ endforeach()
+
+ if(resource_file)
+ set(target_resource_file
+ "${CMAKE_CURRENT_BINARY_DIR}/${name}_windows_version_resource.rc")
+ configure_file("${resource_file}" "${target_resource_file}" COPYONLY)
+ list(APPEND sources "${target_resource_file}")
+ source_group("Resource Files" "${target_resource_file}")
+ set(${RESOURCE_VAR} "${target_resource_file}" PARENT_SCOPE)
+ endif()
+ endif()
+ set(${OUT_VAR} ${sources} PARENT_SCOPE)
+endfunction()
+
+function(set_compiler_rt_windows_version_resource_properties name resource_file)
+ if(DEFINED LLVM_VERSION_MAJOR)
----------------
rnk wrote:
No action required: It's a crime that cmake doesn't have a utility like:
```
set_with_default(destvar srcvar "default, 0")
```
https://github.com/llvm/llvm-project/pull/216408
More information about the llvm-commits
mailing list