David Tenty 63195d3d7a
[NFC][CMake] quote ${CMAKE_SYSTEM_NAME} consistently (#154537)
A CMake change included in CMake 4.0 makes `AIX` into a variable
(similar to `APPLE`, etc.)
ff03db6657

However, `${CMAKE_SYSTEM_NAME}` unfortunately also expands exactly to
`AIX` and `if` auto-expands variable names in CMake. That means you get
a double expansion if you write:

`if (${CMAKE_SYSTEM_NAME}  MATCHES "AIX")`
which becomes:
`if (AIX  MATCHES "AIX")`
which is as if you wrote:
`if (ON MATCHES "AIX")`

You can prevent this by quoting the expansion of "${CMAKE_SYSTEM_NAME}",
due to policy
[CMP0054](https://cmake.org/cmake/help/latest/policy/CMP0054.html#policy:CMP0054)
which is on by default in 4.0+. Most of the LLVM CMake already does
this, but this PR fixes the remaining cases where we do not.
2025-08-20 12:45:41 -04:00

40 lines
701 B
CMake

if ( LLVM_INCLUDE_UTILS )
add_subdirectory(llvm-jitlink-executor)
endif()
set(LLVM_LINK_COMPONENTS
AllTargetsDescs
AllTargetsDisassemblers
AllTargetsInfos
BinaryFormat
ExecutionEngine
JITLink
MC
Object
OrcDebugging
OrcJIT
OrcShared
OrcTargetProcess
RuntimeDyld
Support
TargetParser
)
add_llvm_tool(llvm-jitlink
llvm-jitlink.cpp
llvm-jitlink-coff.cpp
llvm-jitlink-elf.cpp
llvm-jitlink-macho.cpp
llvm-jitlink-statistics.cpp
EXPORT_SYMBOLS
)
if("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku")
target_link_libraries(llvm-jitlink PRIVATE network)
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
target_link_libraries(llvm-jitlink PRIVATE socket)
endif()