From e272b48e849093e5fbab620219edc14706ac740a Mon Sep 17 00:00:00 2001 From: cctv130 <133784576+cctv130@users.noreply.github.com> Date: Tue, 19 Aug 2025 05:42:31 +0800 Subject: [PATCH] fix: windows clang build (#719) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update settings.cmake Fix the issue where debugging on Windows in VSCode doesn’t work * fix: windows clang build The following flags are not supported in non-MSVC environments /EHsc /wd4141 /wd4146 /wd4180 /wd4244 /wd4258 /wd4267 /wd4291 /wd4345 /wd4351 /wd4355 /wd4456 /wd4457 /wd4458 /wd4459 /wd4503 /wd4624 /wd4722 /wd4800 /wd4100 /wd4127 /wd4512 /wd4505 /wd4610 /wd4510 /wd4702 /wd4245 /wd4706 /wd4310 /wd4701 /wd4703 /wd4389 /wd4611 /wd4805 /wd4204 /wd4577 /wd4091 /wd4592 /wd4324 Update cmake_minimum_required(VERSION 3.21) to remove CMake warning. --- CMakeLists.txt | 5 ++++- bin/lift/CMakeLists.txt | 2 +- cmake/utils.cmake | 2 +- lib/Arch/AArch32/Runtime/CMakeLists.txt | 2 +- lib/Arch/AArch64/Runtime/CMakeLists.txt | 2 +- lib/Arch/PPC/Runtime/CMakeLists.txt | 2 +- lib/Arch/SPARC32/Runtime/CMakeLists.txt | 2 +- lib/Arch/SPARC64/Runtime/CMakeLists.txt | 2 +- lib/Arch/X86/Runtime/CMakeLists.txt | 2 +- 9 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da0f4f95..ea1241f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,7 +143,7 @@ target_include_directories(remill_settings INTERFACE $ ) -if(WIN32) +if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND MSVC) # warnings and compiler settings target_compile_options(remill_settings INTERFACE "$<$:/MDd>$<$:/MD>" @@ -167,6 +167,9 @@ if(WIN32) else() # warnings and compiler settings + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + target_compile_options(remill_settings INTERFACE -fPIC) + endif() target_compile_options(remill_settings INTERFACE -Wall -Wextra -Wno-unused-parameter -Wno-c++98-compat -Wno-unreachable-code-return -Wno-nested-anon-types diff --git a/bin/lift/CMakeLists.txt b/bin/lift/CMakeLists.txt index b9f4e564..85b7e0f6 100644 --- a/bin/lift/CMakeLists.txt +++ b/bin/lift/CMakeLists.txt @@ -13,7 +13,7 @@ # limitations under the License. project(remill-lift) -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.21) # # target settings diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 588766c9..f2665087 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.21) function(GetTargetTree output_variable) if(${ARGC} LESS 1) diff --git a/lib/Arch/AArch32/Runtime/CMakeLists.txt b/lib/Arch/AArch32/Runtime/CMakeLists.txt index 884cf2f0..0f493116 100644 --- a/lib/Arch/AArch32/Runtime/CMakeLists.txt +++ b/lib/Arch/AArch32/Runtime/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.21) project(arm_runtime) set(ARMRUNTIME_SOURCEFILES diff --git a/lib/Arch/AArch64/Runtime/CMakeLists.txt b/lib/Arch/AArch64/Runtime/CMakeLists.txt index 75460716..a4185da9 100644 --- a/lib/Arch/AArch64/Runtime/CMakeLists.txt +++ b/lib/Arch/AArch64/Runtime/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.21) project(AARCH64_runtime) set(AARCH64RUNTIME_SOURCEFILES diff --git a/lib/Arch/PPC/Runtime/CMakeLists.txt b/lib/Arch/PPC/Runtime/CMakeLists.txt index b9bb1842..e2ad70db 100644 --- a/lib/Arch/PPC/Runtime/CMakeLists.txt +++ b/lib/Arch/PPC/Runtime/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.21) project(ppc_runtime) set(PPCRUNTIME_SOURCEFILES diff --git a/lib/Arch/SPARC32/Runtime/CMakeLists.txt b/lib/Arch/SPARC32/Runtime/CMakeLists.txt index 13bc2bc1..bc32bd43 100644 --- a/lib/Arch/SPARC32/Runtime/CMakeLists.txt +++ b/lib/Arch/SPARC32/Runtime/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.21) project(sparc32_runtime) set(SPARC32RUNTIME_SOURCEFILES diff --git a/lib/Arch/SPARC64/Runtime/CMakeLists.txt b/lib/Arch/SPARC64/Runtime/CMakeLists.txt index a7a2253d..b0937155 100644 --- a/lib/Arch/SPARC64/Runtime/CMakeLists.txt +++ b/lib/Arch/SPARC64/Runtime/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.21) project(sparc64_runtime) set(SPARC64RUNTIME_SOURCEFILES diff --git a/lib/Arch/X86/Runtime/CMakeLists.txt b/lib/Arch/X86/Runtime/CMakeLists.txt index 170e2e90..ad91af8a 100644 --- a/lib/Arch/X86/Runtime/CMakeLists.txt +++ b/lib/Arch/X86/Runtime/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.21) project(x86_runtime) set(X86RUNTIME_SOURCEFILES