https://git.reactos.org/?p=reactos.git;a=commitdiff;h=96dc5836ab1a93120e833…
commit 96dc5836ab1a93120e8336830b7dff6267232a53
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Tue Apr 6 19:28:47 2021 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Tue Apr 6 19:28:47 2021 +0200
[CMAKE] Make cmake use static libraries for testing the compiler
---
toolchain-gcc.cmake | 3 +++
1 file changed, 3 insertions(+)
diff --git a/toolchain-gcc.cmake b/toolchain-gcc.cmake
index 56d1d8337bd..44f6d0ce166 100644
--- a/toolchain-gcc.cmake
+++ b/toolchain-gcc.cmake
@@ -55,6 +55,9 @@ set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING
"Standard C Libraries")
#MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES)
set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++
Libraries")
+# This allows to have CMake test the compiler without linking
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import")