-
-
Notifications
You must be signed in to change notification settings - Fork 706
Description
myenv:
windows clang-cl cmake visual studio 2026
it's same as #1227 which closed
I found the eventual root cause of this issue
in build.ninja is has wrong flags
FLAGS = --target=amd64-pc-windows-msvc -fdiagnostics-absolute-paths /DWIN32 /D_WINDOWS /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -w14062 -we4238 -wd4530 -wd4251 /Ob0 /Od -std:c++17 -MTd -RTC1 -Zi -Wall -Wextra -Wpedantic -Wno-expansion-to-defined -Werror=return-type -fdiagnostics-color=always -fcolor-diagnostics -fno-exceptions /EHsc-
flags may wrong has -Wall -Wextra -Wpedantic
cause in here
LIEFCompilerFlags.cmake :24
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(LIB_LIEF PRIVATE
-Wno-expansion-to-defined
# Promote this warning into an error as error management
# where the result is 'result<void>' might miss the "return {}"
-Werror=return-type
-fdiagnostics-color=always
)
the clang-cl -wall is not same as clang -wall is means walleverything
llvm/llvm-project#102982
in LIEFCompilerFlags.cmake :51
if(MSVC AND NOT CLANG_CL)
MSVC is 1
CLANG_CL is not defined means 0
1 and not 1 = 1
so it will execute
this should execute too
I think msvc and not clang_cl means use msvc cl not the clang cl
CLANG_CL is not defined default
this should execute in clang cl
Solving:
here i just del all if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
to let this not execute
no spewing warnings anymore
[285/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\SubFramework.cpp.obj
[286/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\Routine.cpp.obj
[287/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\DyldChainedFixupsCreator.cpp.obj
[288/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\Builder.cpp.obj
[289/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\SegmentSplitInfo.cpp.obj
[290/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\endianness_support.cpp.obj
[291/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\TwoLevelHints.cpp.obj
[292/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\SegmentCommand.cpp.obj
[293/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\SourceVersion.cpp.obj
[294/519] Building CXX object _deps\lief-build\CMakeFiles\LIB_LIEF.dir\src\MachO\SymbolCommand.cpp.obj