https://git.reactos.org/?p=reactos.git;a=commitdiff;h=64b58397f3694d3234db5…
commit 64b58397f3694d3234db5de313854e67be69728f
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Aug 24 13:20:11 2024 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Aug 27 21:34:50 2024 +0300
[CMAKE] Statically link _ftol2/__ftoul2_legacy to libntdll
This is needed to resolve symbols of native applications like usetup, when compiled
with latest VS.
---
dll/ntdll/CMakeLists.txt | 5 +++++
sdk/lib/crt/CMakeLists.txt | 9 +++++++++
2 files changed, 14 insertions(+)
diff --git a/dll/ntdll/CMakeLists.txt b/dll/ntdll/CMakeLists.txt
index 5daf7ae7e1e..065188705f6 100644
--- a/dll/ntdll/CMakeLists.txt
+++ b/dll/ntdll/CMakeLists.txt
@@ -73,3 +73,8 @@ endif()
add_pch(ntdll include/ntdll.h "${PCH_SKIP_SOURCE}")
add_dependencies(ntdll ntstatus asm)
add_cd_file(TARGET ntdll DESTINATION reactos/system32 NO_CAB FOR all)
+
+# Newer VS versions link to _ftol2 / _ftoul2_legacy
+if(MSVC AND ARCH STREQUAL "i386")
+ target_link_libraries(libntdll ftol2)
+endif()
diff --git a/sdk/lib/crt/CMakeLists.txt b/sdk/lib/crt/CMakeLists.txt
index 3ade9c84877..6c38c518e56 100644
--- a/sdk/lib/crt/CMakeLists.txt
+++ b/sdk/lib/crt/CMakeLists.txt
@@ -45,3 +45,12 @@ add_library(user32_wsprintf
add_dependencies(user32_wsprintf psdk)
target_compile_definitions(user32_wsprintf PRIVATE _USER32_WSPRINTF)
+
+if(MSVC AND ARCH STREQUAL "i386")
+ add_asm_files(ftol2_asm
+ math/i386/ftol2_asm.s
+ )
+ add_library(ftol2 ${ftol2_asm})
+ set_target_properties(ftol2 PROPERTIES LINKER_LANGUAGE "C")
+ add_dependencies(ftol2 asm)
+endif()