[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.
This commit is contained in:
David Tenty 2025-08-20 12:45:41 -04:00 committed by GitHub
parent fdfcebb38d
commit 63195d3d7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 81 additions and 76 deletions

View File

@ -6,7 +6,7 @@ add_subdirectory(support)
# Configure the Features.inc file. # Configure the Features.inc file.
if (NOT DEFINED CLANGD_BUILD_XPC) if (NOT DEFINED CLANGD_BUILD_XPC)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(CLANGD_BUILD_XPC_DEFAULT ON) set(CLANGD_BUILD_XPC_DEFAULT ON)
else () else ()
set(CLANGD_BUILD_XPC_DEFAULT OFF) set(CLANGD_BUILD_XPC_DEFAULT OFF)
@ -193,7 +193,7 @@ if(CLANGD_TIDY_CHECKS)
endif() endif()
add_subdirectory(refactor/tweaks) add_subdirectory(refactor/tweaks)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# FIXME: Make fuzzer not use linux-specific APIs, build it everywhere. # FIXME: Make fuzzer not use linux-specific APIs, build it everywhere.
add_subdirectory(fuzzer) add_subdirectory(fuzzer)
endif() endif()

View File

@ -35,7 +35,7 @@ if(WIN32)
endif() endif()
# The Python FFI interface is broken on AIX: https://bugs.python.org/issue38628. # The Python FFI interface is broken on AIX: https://bugs.python.org/issue38628.
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(RUN_PYTHON_TESTS FALSE) set(RUN_PYTHON_TESTS FALSE)
endif() endif()

View File

@ -93,7 +93,7 @@ if(MSVC)
set(LLVM_EXPORTED_SYMBOL_FILE) set(LLVM_EXPORTED_SYMBOL_FILE)
endif() endif()
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND NOT CYGWIN) if (UNIX AND NOT APPLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "AIX" AND NOT CYGWIN)
set(LLVM_EXPORTED_SYMBOL_FILE) set(LLVM_EXPORTED_SYMBOL_FILE)
set(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT}) set(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT})
endif() endif()
@ -125,7 +125,7 @@ else()
set(output_name "clang") set(output_name "clang")
endif() endif()
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF) set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
# libclang requires headers which need _ALL_SOURCE to build on AIX # libclang requires headers which need _ALL_SOURCE to build on AIX
remove_definitions("-D_XOPEN_SOURCE=700") remove_definitions("-D_XOPEN_SOURCE=700")
@ -186,7 +186,7 @@ if(ENABLE_SHARED)
endif() endif()
endif() endif()
if (USE_VERSION_SCRIPT) if (USE_VERSION_SCRIPT)
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") if ("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
include(CheckLinkerFlag) include(CheckLinkerFlag)
# The Solaris 11.4 linker supports a subset of GNU ld version scripts, # The Solaris 11.4 linker supports a subset of GNU ld version scripts,
# but requires a special option to enable it. # but requires a special option to enable it.

View File

@ -204,7 +204,7 @@ check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
llvm_check_compiler_linker_flag(C "-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT) llvm_check_compiler_linker_flag(C "-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
llvm_check_compiler_linker_flag(C "-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG) llvm_check_compiler_linker_flag(C "-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD) if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD)
set(VERS_COMPAT_OPTION "-Wl,-z,gnu-version-script-compat") set(VERS_COMPAT_OPTION "-Wl,-z,gnu-version-script-compat")
llvm_check_compiler_linker_flag(C "${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT) llvm_check_compiler_linker_flag(C "${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
endif() endif()

View File

@ -282,7 +282,7 @@ else()
endif() endif()
# On AIX, we only need the static libraries. # On AIX, we only need the static libraries.
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
foreach(arch ${ASAN_SUPPORTED_ARCH}) foreach(arch ${ASAN_SUPPORTED_ARCH})
if (COMPILER_RT_HAS_VERSION_SCRIPT) if (COMPILER_RT_HAS_VERSION_SCRIPT)
if(WIN32) if(WIN32)
@ -392,7 +392,7 @@ add_compiler_rt_resource_file(asan_ignorelist asan_ignorelist.txt asan)
# On AIX, static sanitizer libraries are not added to the DSO, so we need to put # On AIX, static sanitizer libraries are not added to the DSO, so we need to put
# asan.link_with_main_exec.txt and asan_cxx.link_with_main_exec.txt to the build # asan.link_with_main_exec.txt and asan_cxx.link_with_main_exec.txt to the build
# and install dir for use in resolving undefined sanitizer symbols at runtime. # and install dir for use in resolving undefined sanitizer symbols at runtime.
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
foreach(arch ${ASAN_SUPPORTED_ARCH}) foreach(arch ${ASAN_SUPPORTED_ARCH})
add_compiler_rt_cfg(asan_symbols_${arch} asan.link_with_main_exec.txt asan ${arch}) add_compiler_rt_cfg(asan_symbols_${arch} asan.link_with_main_exec.txt asan ${arch})
add_compiler_rt_cfg(asan_cxx_symbols_${arch} asan_cxx.link_with_main_exec.txt asan ${arch}) add_compiler_rt_cfg(asan_cxx_symbols_${arch} asan_cxx.link_with_main_exec.txt asan ${arch})

View File

@ -113,7 +113,7 @@ option(LIBCXX_ENABLE_MONOTONIC_CLOCK
# #
# TODO TZDB make the default always ON when most platforms ship with the IANA # TODO TZDB make the default always ON when most platforms ship with the IANA
# database. # database.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(ENABLE_TIME_ZONE_DATABASE_DEFAULT ON) set(ENABLE_TIME_ZONE_DATABASE_DEFAULT ON)
else() else()
set(ENABLE_TIME_ZONE_DATABASE_DEFAULT OFF) set(ENABLE_TIME_ZONE_DATABASE_DEFAULT OFF)
@ -159,7 +159,7 @@ set(LIBCXX_TEST_PARAMS "" CACHE STRING
"A list of parameters to run the Lit test suite with.") "A list of parameters to run the Lit test suite with.")
# TODO: Figure out how to build GoogleBenchmark on those platforms, and how to build when exceptions or RTTI is disabled # TODO: Figure out how to build GoogleBenchmark on those platforms, and how to build when exceptions or RTTI is disabled
if (WIN32 OR MINGW OR ANDROID OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX" if (WIN32 OR MINGW OR ANDROID OR "${CMAKE_SYSTEM_NAME}" MATCHES "AIX"
OR NOT LIBCXX_ENABLE_LOCALIZATION OR NOT LIBCXX_ENABLE_LOCALIZATION
OR NOT LIBCXX_ENABLE_THREADS OR NOT LIBCXX_ENABLE_THREADS
OR NOT LIBCXX_ENABLE_FILESYSTEM OR NOT LIBCXX_ENABLE_FILESYSTEM
@ -466,7 +466,7 @@ include(HandleLibcxxFlags)
# 'config-ix' use them during feature checks. It also adds them to both # 'config-ix' use them during feature checks. It also adds them to both
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS' # 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit") add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF) set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
endif() endif()

View File

@ -244,7 +244,7 @@ include(HandleLibcxxabiFlags)
#=============================================================================== #===============================================================================
# Configure target flags # Configure target flags
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit") add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF) set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
endif() endif()
@ -458,7 +458,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
# On AIX, avoid picking up VMX extensions(i.e. vec_malloc) which would change # On AIX, avoid picking up VMX extensions(i.e. vec_malloc) which would change
# the default alignment of the allocators here. # the default alignment of the allocators here.
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
add_definitions("-D_XOPEN_SOURCE=700") add_definitions("-D_XOPEN_SOURCE=700")
endif() endif()

View File

@ -37,7 +37,7 @@ else()
endif() endif()
if (LIBCXXABI_ENABLE_THREADS AND (UNIX OR FUCHSIA) AND NOT (APPLE OR CYGWIN) if (LIBCXXABI_ENABLE_THREADS AND (UNIX OR FUCHSIA) AND NOT (APPLE OR CYGWIN)
AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX")) AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX"))
list(APPEND LIBCXXABI_SOURCES list(APPEND LIBCXXABI_SOURCES
cxa_thread_atexit.cpp cxa_thread_atexit.cpp
) )

View File

@ -6,7 +6,7 @@ set(LIBUNWIND_CXX_SOURCES
Unwind-seh.cpp Unwind-seh.cpp
) )
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
list(APPEND LIBUNWIND_CXX_SOURCES list(APPEND LIBUNWIND_CXX_SOURCES
Unwind_AIXExtras.cpp Unwind_AIXExtras.cpp
) )

View File

@ -7,7 +7,7 @@ if (APPLE AND LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY)
endif() endif()
endif() endif()
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
add_definitions("-D_ALL_SOURCE") add_definitions("-D_ALL_SOURCE")
endif() endif()

View File

@ -2,7 +2,7 @@ set(FBSDKERNEL_LIBS)
if(FBSDVMCore_FOUND) if(FBSDVMCore_FOUND)
list(APPEND FBSDKERNEL_LIBS fbsdvmcore) list(APPEND FBSDKERNEL_LIBS fbsdvmcore)
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
list(APPEND FBSDKERNEL_LIBS kvm) list(APPEND FBSDKERNEL_LIBS kvm)
endif() endif()

View File

@ -11,7 +11,7 @@ if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-Info.plist") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-Info.plist")
endif() endif()
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
remove_definitions("-D_XOPEN_SOURCE=700") remove_definitions("-D_XOPEN_SOURCE=700")
add_definitions("-D_ALL_SOURCE") add_definitions("-D_ALL_SOURCE")
endif() endif()

View File

@ -110,7 +110,7 @@ endif()
# one for llvm+clang+... using the same sources. # one for llvm+clang+... using the same sources.
# These projects will be included when "all" is included in LLVM_ENABLE_PROJECTS. # These projects will be included when "all" is included in LLVM_ENABLE_PROJECTS.
set(LLVM_ALL_PROJECTS "bolt;clang;clang-tools-extra;compiler-rt;cross-project-tests;libclc;lld;lldb;mlir;openmp;polly") set(LLVM_ALL_PROJECTS "bolt;clang;clang-tools-extra;compiler-rt;cross-project-tests;libclc;lld;lldb;mlir;openmp;polly")
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
# Disallow 'openmp' as a LLVM PROJECT on AIX as the supported way is to use # Disallow 'openmp' as a LLVM PROJECT on AIX as the supported way is to use
# LLVM_ENABLE_RUNTIMES. # LLVM_ENABLE_RUNTIMES.
list(REMOVE_ITEM LLVM_ALL_PROJECTS openmp) list(REMOVE_ITEM LLVM_ALL_PROJECTS openmp)
@ -682,7 +682,7 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "OS390")
option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
endif() endif()
option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF) option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." ON) option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." ON)
else() else()
option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." OFF) option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." OFF)
@ -786,7 +786,7 @@ option(LLVM_USE_SPLIT_DWARF
# Define an option controlling whether we should build for 32-bit on 64-bit # Define an option controlling whether we should build for 32-bit on 64-bit
# platforms, where supported. # platforms, where supported.
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT (WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")) if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT (WIN32 OR "${CMAKE_SYSTEM_NAME}" MATCHES "AIX"))
# TODO: support other platforms and toolchains. # TODO: support other platforms and toolchains.
option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
endif() endif()
@ -1256,7 +1256,7 @@ endif()
# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to # Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
# break things. In this case we need to enable the large-file API as well. # break things. In this case we need to enable the large-file API as well.
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
add_compile_definitions(_XOPEN_SOURCE=700) add_compile_definitions(_XOPEN_SOURCE=700)
add_compile_definitions(_LARGE_FILE_API) add_compile_definitions(_LARGE_FILE_API)
add_compile_options(-pthread) add_compile_options(-pthread)
@ -1284,7 +1284,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "OS390")
endif() endif()
# Build with _FILE_OFFSET_BITS=64 on Solaris to match g++ >= 9. # Build with _FILE_OFFSET_BITS=64 on Solaris to match g++ >= 9.
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
add_compile_definitions(_FILE_OFFSET_BITS=64) add_compile_definitions(_FILE_OFFSET_BITS=64)
endif() endif()
@ -1302,10 +1302,10 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
# (this is a variable that CrossCompile sets on recursive invocations) # (this is a variable that CrossCompile sets on recursive invocations)
endif() endif()
if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) if( "${CMAKE_SYSTEM_NAME}" MATCHES SunOS )
# special hack for Solaris to handle crazy system sys/regset.h # special hack for Solaris to handle crazy system sys/regset.h
include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris") include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")
endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) endif( "${CMAKE_SYSTEM_NAME}" MATCHES SunOS )
# Make sure we don't get -rdynamic in every binary. For those that need it, # Make sure we don't get -rdynamic in every binary. For those that need it,
# use EXPORT_SYMBOLS argument. # use EXPORT_SYMBOLS argument.

View File

@ -69,14 +69,14 @@ endif()
# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build # Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
# with those too. # with those too.
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700") list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API") list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
endif() endif()
# Do checks with _FILE_OFFSET_BITS=64 on Solaris, because we will build # Do checks with _FILE_OFFSET_BITS=64 on Solaris, because we will build
# with those too. # with those too.
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
endif() endif()
@ -122,7 +122,7 @@ if(APPLE)
HAVE_CRASHREPORTER_INFO) HAVE_CRASHREPORTER_INFO)
endif() endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
check_include_file(linux/magic.h HAVE_LINUX_MAGIC_H) check_include_file(linux/magic.h HAVE_LINUX_MAGIC_H)
if(NOT HAVE_LINUX_MAGIC_H) if(NOT HAVE_LINUX_MAGIC_H)
# older kernels use split files # older kernels use split files
@ -411,7 +411,7 @@ endif()
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
# The st_mtim.tv_nsec member of a `stat` structure is not reliable on some AIX # The st_mtim.tv_nsec member of a `stat` structure is not reliable on some AIX
# environments. # environments.
set(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0) set(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0)

View File

@ -99,7 +99,7 @@ function(llvm_update_compile_flags name)
endfunction() endfunction()
function(add_llvm_symbol_exports target_name export_file) function(add_llvm_symbol_exports target_name export_file)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(native_export_file "${target_name}.exports") set(native_export_file "${target_name}.exports")
add_custom_command(OUTPUT ${native_export_file} add_custom_command(OUTPUT ${native_export_file}
COMMAND sed -e "s/^/_/" < ${export_file} > ${native_export_file} COMMAND sed -e "s/^/_/" < ${export_file} > ${native_export_file}
@ -108,7 +108,7 @@ function(add_llvm_symbol_exports target_name export_file)
COMMENT "Creating export file for ${target_name}") COMMENT "Creating export file for ${target_name}")
set_property(TARGET ${target_name} APPEND_STRING PROPERTY set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-exported_symbols_list,\"${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}\"") LINK_FLAGS " -Wl,-exported_symbols_list,\"${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}\"")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
# FIXME: `-Wl,-bE:` bypasses whatever handling there is in the build # FIXME: `-Wl,-bE:` bypasses whatever handling there is in the build
# compiler driver to defer to the specified export list. # compiler driver to defer to the specified export list.
set(native_export_file "${export_file}") set(native_export_file "${export_file}")
@ -268,7 +268,7 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
endif() endif()
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
include(CheckLinkerFlag) include(CheckLinkerFlag)
# Linkers that support Darwin allow a setting to internalize all symbol exports, # Linkers that support Darwin allow a setting to internalize all symbol exports,
# aiding in reducing binary size and often is applicable for executables. # aiding in reducing binary size and often is applicable for executables.
@ -315,11 +315,11 @@ function(add_link_opts target_name)
# linker in a context where the optimizations are not important. # linker in a context where the optimizations are not important.
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
if(NOT LLVM_NO_DEAD_STRIP) if(NOT LLVM_NO_DEAD_STRIP)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
# ld64's implementation of -dead_strip breaks tools that use plugins. # ld64's implementation of -dead_strip breaks tools that use plugins.
set_property(TARGET ${target_name} APPEND_STRING PROPERTY set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-dead_strip") LINK_FLAGS " -Wl,-dead_strip")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD) elseif("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD)
# Support for ld -z discard-unused=sections was only added in # Support for ld -z discard-unused=sections was only added in
# Solaris 11.4. GNU ld ignores it, but warns every time. # Solaris 11.4. GNU ld ignores it, but warns every time.
check_linker_flag(CXX "-Wl,-z,discard-unused=sections" LINKER_SUPPORTS_Z_DISCARD_UNUSED) check_linker_flag(CXX "-Wl,-z,discard-unused=sections" LINKER_SUPPORTS_Z_DISCARD_UNUSED)
@ -333,7 +333,7 @@ function(add_link_opts target_name)
LINK_FLAGS " -Wl,--gc-sections") LINK_FLAGS " -Wl,--gc-sections")
endif() endif()
else() #LLVM_NO_DEAD_STRIP else() #LLVM_NO_DEAD_STRIP
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set_property(TARGET ${target_name} APPEND_STRING PROPERTY set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-bnogc") LINK_FLAGS " -Wl,-bnogc")
endif() endif()
@ -345,7 +345,7 @@ function(add_link_opts target_name)
LINK_FLAGS " -Wl,-no_warn_duplicate_libraries") LINK_FLAGS " -Wl,-no_warn_duplicate_libraries")
endif() endif()
if(ARG_SUPPORT_PLUGINS AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if(ARG_SUPPORT_PLUGINS AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set_property(TARGET ${target_name} APPEND_STRING PROPERTY set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-brtl") LINK_FLAGS " -Wl,-brtl")
endif() endif()
@ -667,7 +667,7 @@ function(llvm_add_library name)
# that are used across shared objects which we can't hide. # that are used across shared objects which we can't hide.
if (LLVM_BUILD_LLVM_DYLIB_VIS AND NOT BUILD_SHARED_LIBS AND NOT APPLE AND if (LLVM_BUILD_LLVM_DYLIB_VIS AND NOT BUILD_SHARED_LIBS AND NOT APPLE AND
(NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND (NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND
NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") AND
NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET) NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
set_target_properties(${name} PROPERTIES set_target_properties(${name} PROPERTIES
@ -1094,7 +1094,7 @@ macro(add_llvm_executable name)
llvm_update_compile_flags(${name}) llvm_update_compile_flags(${name})
endif() endif()
if (ARG_SUPPORT_PLUGINS AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (ARG_SUPPORT_PLUGINS AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(LLVM_NO_DEAD_STRIP On) set(LLVM_NO_DEAD_STRIP On)
endif() endif()
@ -1417,7 +1417,7 @@ function(export_executable_symbols target)
# CMake doesn't set CMAKE_EXE_EXPORTS_${lang}_FLAG on Solaris, so # CMake doesn't set CMAKE_EXE_EXPORTS_${lang}_FLAG on Solaris, so
# ENABLE_EXPORTS has no effect. While Solaris ld defaults to -rdynamic # ENABLE_EXPORTS has no effect. While Solaris ld defaults to -rdynamic
# behaviour, GNU ld needs it. # behaviour, GNU ld needs it.
if (APPLE OR ${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") if (APPLE OR "${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
set_property(TARGET ${target} APPEND_STRING PROPERTY set_property(TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS " -rdynamic") LINK_FLAGS " -rdynamic")
endif() endif()
@ -2540,7 +2540,7 @@ function(llvm_setup_rpath name)
if (APPLE) if (APPLE)
set(_install_name_dir INSTALL_NAME_DIR "@rpath") set(_install_name_dir INSTALL_NAME_DIR "@rpath")
set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS) elseif("${CMAKE_SYSTEM_NAME}" MATCHES "AIX" AND BUILD_SHARED_LIBS)
# $ORIGIN is not interpreted at link time by aix ld. # $ORIGIN is not interpreted at link time by aix ld.
# Since BUILD_SHARED_LIBS is only recommended for use by developers, # Since BUILD_SHARED_LIBS is only recommended for use by developers,
# hardcode the rpath to build/install lib dir first in this mode. # hardcode the rpath to build/install lib dir first in this mode.
@ -2549,7 +2549,7 @@ function(llvm_setup_rpath name)
elseif(UNIX) elseif(UNIX)
set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}") set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") if("${CMAKE_SYSTEM_NAME}" MATCHES "(FreeBSD|DragonFly)")
set_property(TARGET ${name} APPEND_STRING PROPERTY set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-z,origin ") LINK_FLAGS " -Wl,-z,origin ")
endif() endif()
@ -2567,7 +2567,7 @@ function(llvm_setup_rpath name)
# On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF # On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF
# on install at the moment, so BUILD_WITH_INSTALL_RPATH is required. # on install at the moment, so BUILD_WITH_INSTALL_RPATH is required.
if("${CMAKE_BUILD_RPATH}" STREQUAL "") if("${CMAKE_BUILD_RPATH}" STREQUAL "")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin|AIX")
set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON) set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
else() else()
set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}") set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}")

View File

@ -228,7 +228,7 @@ if(WIN32 OR CYGWIN)
elseif(FUCHSIA OR UNIX) elseif(FUCHSIA OR UNIX)
set(LLVM_ON_WIN32 0) set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1) set(LLVM_ON_UNIX 1)
if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if(APPLE OR "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0) set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
else() else()
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
@ -249,7 +249,7 @@ set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
# We use *.dylib rather than *.so on darwin, but we stick with *.so on AIX. # We use *.dylib rather than *.so on darwin, but we stick with *.so on AIX.
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_MODULE_SUFFIX}) set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_MODULE_SUFFIX})
else() else()
set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
@ -260,7 +260,7 @@ if(APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-flat_namespace -Wl,-undefined -Wl,dynamic_lookup") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-flat_namespace -Wl,-undefined -Wl,dynamic_lookup")
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
# RHEL7 has ar and ranlib being non-deterministic by default. The D flag forces determinism, # RHEL7 has ar and ranlib being non-deterministic by default. The D flag forces determinism,
# however only GNU version of ar and ranlib (2.27) have this option. # however only GNU version of ar and ranlib (2.27) have this option.
# RHEL DTS7 is also affected by this, which uses GNU binutils 2.28 # RHEL DTS7 is also affected by this, which uses GNU binutils 2.28
@ -292,7 +292,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endif() endif()
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
# -fPIC does not enable the large code model for GCC on AIX but does for XL. # -fPIC does not enable the large code model for GCC on AIX but does for XL.
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
append("-mcmodel=large" CMAKE_CXX_FLAGS CMAKE_C_FLAGS) append("-mcmodel=large" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
@ -328,7 +328,7 @@ endif()
# by dlclose(). We need that since the CLI API relies on cross-references # by dlclose(). We need that since the CLI API relies on cross-references
# between global objects which became horribly broken when one of the libraries # between global objects which became horribly broken when one of the libraries
# is unloaded. # is unloaded.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,nodelete") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,nodelete")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,nodelete") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,nodelete")
endif() endif()
@ -454,13 +454,13 @@ if( LLVM_ENABLE_PIC )
# to SEGV (GCC PR target/96607). # to SEGV (GCC PR target/96607).
# clang with -O3 -fPIC generates code that SEGVs. # clang with -O3 -fPIC generates code that SEGVs.
# Both can be worked around by compiling with -O instead. # Both can be worked around by compiling with -O instead.
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND LLVM_NATIVE_ARCH STREQUAL "Sparc") if("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS" AND LLVM_NATIVE_ARCH STREQUAL "Sparc")
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O[23]" "-O") llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O[23]" "-O")
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O[23]" "-O") llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O[23]" "-O")
endif() endif()
endif() endif()
if((NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX")) AND if((NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")) AND
(NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"))) (NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")))
# GCC for MinGW does nothing about -fvisibility-inlines-hidden, but warns # GCC for MinGW does nothing about -fvisibility-inlines-hidden, but warns
# about use of the attributes. As long as we don't use the attributes (to # about use of the attributes. As long as we don't use the attributes (to
@ -708,7 +708,7 @@ endif ()
if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES ) if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(module_flags "-fmodules -fmodules-cache-path=${PROJECT_BINARY_DIR}/module.cache") set(module_flags "-fmodules -fmodules-cache-path=${PROJECT_BINARY_DIR}/module.cache")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
# On Darwin -fmodules does not imply -fcxx-modules. # On Darwin -fmodules does not imply -fcxx-modules.
set(module_flags "${module_flags} -fcxx-modules") set(module_flags "${module_flags} -fcxx-modules")
endif() endif()
@ -1123,7 +1123,7 @@ endif()
# But MinSizeRel seems to add that automatically, so maybe disable these # But MinSizeRel seems to add that automatically, so maybe disable these
# flags instead if LLVM_NO_DEAD_STRIP is set. # flags instead if LLVM_NO_DEAD_STRIP is set.
if(NOT CYGWIN AND NOT MSVC) if(NOT CYGWIN AND NOT MSVC)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" AND
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
if (CMAKE_CXX_COMPILER_ID MATCHES "XL") if (CMAKE_CXX_COMPILER_ID MATCHES "XL")
append("-qfuncsect" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append("-qfuncsect" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
@ -1315,9 +1315,14 @@ endif()
# linking (due to incompatibility). With MSVC, note that the plugin has to # linking (due to incompatibility). With MSVC, note that the plugin has to
# explicitly link against (exactly one) tool so we can't unilaterally turn on # explicitly link against (exactly one) tool so we can't unilaterally turn on
# LLVM_ENABLE_PLUGINS when it's enabled. # LLVM_ENABLE_PLUGINS when it's enabled.
if("${CMAKE_SYSTEM_NAME}" MATCHES AIX)
set(LLVM_EXPORT_SYMBOLS_FOR_PLUGINS_OPTION OFF)
else()
set(LLVM_EXPORT_SYMBOLS_FOR_PLUGINS_OPTION ON)
endif()
CMAKE_DEPENDENT_OPTION(LLVM_EXPORT_SYMBOLS_FOR_PLUGINS CMAKE_DEPENDENT_OPTION(LLVM_EXPORT_SYMBOLS_FOR_PLUGINS
"Export symbols from LLVM tools so that plugins can import them" OFF "Export symbols from LLVM tools so that plugins can import them" OFF
"NOT ${CMAKE_SYSTEM_NAME} MATCHES AIX" ${LLVM_EXPORT_SYMBOLS_FOR_PLUGINS_AIX_default}) "LLVM_EXPORT_SYMBOLS_FOR_PLUGINS_OPTION" ${LLVM_EXPORT_SYMBOLS_FOR_PLUGINS_AIX_default})
if(BUILD_SHARED_LIBS AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS) if(BUILD_SHARED_LIBS AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
message(FATAL_ERROR "BUILD_SHARED_LIBS not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS") message(FATAL_ERROR "BUILD_SHARED_LIBS not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS")
endif() endif()

View File

@ -62,7 +62,7 @@ elseif( CMAKE_HOST_UNIX )
if( UNIX AND NOT (BEOS OR HAIKU) ) if( UNIX AND NOT (BEOS OR HAIKU) )
set(system_libs ${system_libs} m) set(system_libs ${system_libs} m)
endif() endif()
if( UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) if( UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" )
set(system_libs ${system_libs} kstat socket) set(system_libs ${system_libs} kstat socket)
endif() endif()
if( FUCHSIA ) if( FUCHSIA )
@ -130,7 +130,7 @@ endif()
# unistd.h and it is guarded by _ALL_SOURCE, so we remove the _XOPEN_SOURCE # unistd.h and it is guarded by _ALL_SOURCE, so we remove the _XOPEN_SOURCE
# guard here. We should remove the guards all together once AIX cleans up # guard here. We should remove the guards all together once AIX cleans up
# the system headers. # the system headers.
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
remove_definitions("-D_XOPEN_SOURCE=700") remove_definitions("-D_XOPEN_SOURCE=700")
endif() endif()

View File

@ -24,7 +24,7 @@ add_llvm_component_library(LLVMTarget
# that are used across shared objects which we can't hide. # that are used across shared objects which we can't hide.
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
(NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND (NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND
NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") AND
NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET) NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
# Set default visibility to hidden, so we don't export all the Target classes # Set default visibility to hidden, so we don't export all the Target classes
# in libLLVM.so. # in libLLVM.so.

View File

@ -9,7 +9,7 @@ if (HAS_WERROR_GLOBAL_CTORS AND NOT LLVM_HAS_NOGLOBAL_CTOR_MUTEX)
endif() endif()
# Solaris code uses kstat, so specify dependency explicitly for shared builds. # Solaris code uses kstat, so specify dependency explicitly for shared builds.
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") if ("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
set(system_libs kstat) set(system_libs kstat)
endif() endif()

View File

@ -30,10 +30,10 @@ add_llvm_tool(llvm-jitlink
EXPORT_SYMBOLS EXPORT_SYMBOLS
) )
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku") if("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku")
target_link_libraries(llvm-jitlink PRIVATE network) target_link_libraries(llvm-jitlink PRIVATE network)
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
target_link_libraries(llvm-jitlink PRIVATE socket) target_link_libraries(llvm-jitlink PRIVATE socket)
endif() endif()

View File

@ -16,7 +16,7 @@ set_output_directory(DynamicLibraryLib
) )
# FIXME: Find out why AIX fails with new DynamicLibrary symbols behavior. # FIXME: Find out why AIX fails with new DynamicLibrary symbols behavior.
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
add_llvm_unittest(DynamicLibraryTests add_llvm_unittest(DynamicLibraryTests
DynamicLibraryTest.cpp DynamicLibraryTest.cpp
) )
@ -28,7 +28,7 @@ else()
) )
endif() endif()
target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib) target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
export_executable_symbols(DynamicLibraryTests) export_executable_symbols(DynamicLibraryTests)
endif() endif()
@ -64,7 +64,7 @@ endfunction(dynlib_add_module)
# Revert -Wl,-z,nodelete on this test since it relies on the file # Revert -Wl,-z,nodelete on this test since it relies on the file
# being unloaded. # being unloaded.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
string(REPLACE "-Wl,-z,nodelete" "" CMAKE_MODULE_LINKER_FLAGS string(REPLACE "-Wl,-z,nodelete" "" CMAKE_MODULE_LINKER_FLAGS
${CMAKE_MODULE_LINKER_FLAGS}) ${CMAKE_MODULE_LINKER_FLAGS})
endif() endif()

View File

@ -19,7 +19,7 @@ if(NOT DEFINED ENV{CMPLR_ROOT})
else() else()
get_filename_component(ONEAPI_VER "$ENV{CMPLR_ROOT}" NAME) get_filename_component(ONEAPI_VER "$ENV{CMPLR_ROOT}" NAME)
if(ONEAPI_VER VERSION_LESS 2024.0) if(ONEAPI_VER VERSION_LESS 2024.0)
if(LINUX OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) if(LINUX OR ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux"))
set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/linux") set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/linux")
elseif(WIN32) elseif(WIN32)
set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/windows") set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/windows")

View File

@ -57,7 +57,7 @@ if (${OPENMP_STANDALONE_BUILD})
if (MSVC OR XCODE) if (MSVC OR XCODE)
set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar") set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar")
endif() endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=1800") set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=1800")
endif() endif()
set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.") set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.")

View File

@ -117,7 +117,7 @@ set(ENABLE_LIBOMPTARGET ON)
# there is no point in trying to compile libomptarget on other OSes. # there is no point in trying to compile libomptarget on other OSes.
# 32-bit systems are not supported either. # 32-bit systems are not supported either.
if (APPLE OR WIN32 OR WASM OR NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES if (APPLE OR WIN32 OR WASM OR NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES
OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX") OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8 OR "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(ENABLE_LIBOMPTARGET OFF) set(ENABLE_LIBOMPTARGET OFF)
endif() endif()

View File

@ -57,7 +57,7 @@ if (${OPENMP_STANDALONE_BUILD})
if (MSVC OR XCODE) if (MSVC OR XCODE)
set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar") set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar")
endif() endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=3000") set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=3000")
endif() endif()
set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.") set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.")

View File

@ -136,7 +136,7 @@ set(LIBOMP_ASMFLAGS "" CACHE STRING
"Appended user specified assembler flags.") "Appended user specified assembler flags.")
set(LIBOMP_LDFLAGS "" CACHE STRING set(LIBOMP_LDFLAGS "" CACHE STRING
"Appended user specified linker flags.") "Appended user specified linker flags.")
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(LIBOMP_LIBFLAGS "-lperfstat" CACHE STRING set(LIBOMP_LIBFLAGS "-lperfstat" CACHE STRING
"Appended user specified linked libs flags. (e.g., -lm)") "Appended user specified linked libs flags. (e.g., -lm)")
if("${LIBOMP_ARCH}" STREQUAL "ppc") if("${LIBOMP_ARCH}" STREQUAL "ppc")

View File

@ -140,14 +140,14 @@ function(libomp_get_libflags libflags)
if(LIBOMP_HAVE_SHM_OPEN_WITH_LRT) if(LIBOMP_HAVE_SHM_OPEN_WITH_LRT)
libomp_append(libflags_local -lrt) libomp_append(libflags_local -lrt)
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly|FreeBSD|OpenBSD") if("${CMAKE_SYSTEM_NAME}" MATCHES "DragonFly|FreeBSD|OpenBSD")
libomp_append(libflags_local "-Wl,--no-as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG) libomp_append(libflags_local "-Wl,--no-as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG)
libomp_append(libflags_local "-lm") libomp_append(libflags_local "-lm")
libomp_append(libflags_local "-Wl,--as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG) libomp_append(libflags_local "-Wl,--as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG)
if (${CMAKE_SYSTEM_NAME} STREQUAL "DragonFly") if ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
libomp_append(libflags_local "-lkvm") libomp_append(libflags_local "-lkvm")
endif() endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|NetBSD|SunOS") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux|NetBSD|SunOS")
libomp_append(libflags_local -lm) libomp_append(libflags_local -lm)
endif() endif()
set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS}) set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS})

View File

@ -321,7 +321,7 @@ else()
(LIBOMP_ARCH STREQUAL sparcv9)) (LIBOMP_ARCH STREQUAL sparcv9))
AND # OS supported? AND # OS supported?
((WIN32 AND LIBOMP_HAVE_PSAPI) OR APPLE OR ((WIN32 AND LIBOMP_HAVE_PSAPI) OR APPLE OR
(NOT (WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND LIBOMP_HAVE_WEAK_ATTRIBUTE))) (NOT (WIN32 OR "${CMAKE_SYSTEM_NAME}" MATCHES "AIX") AND LIBOMP_HAVE_WEAK_ATTRIBUTE)))
set(LIBOMP_HAVE_OMPT_SUPPORT TRUE) set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
else() else()
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE) set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)

View File

@ -121,7 +121,7 @@ else()
# Unix specific files # Unix specific files
libomp_append(LIBOMP_CXXFILES z_Linux_util.cpp) libomp_append(LIBOMP_CXXFILES z_Linux_util.cpp)
libomp_append(LIBOMP_CXXFILES kmp_gsupport.cpp) libomp_append(LIBOMP_CXXFILES kmp_gsupport.cpp)
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
libomp_append(LIBOMP_GNUASMFILES z_AIX_asm.S) # AIX assembly file libomp_append(LIBOMP_GNUASMFILES z_AIX_asm.S) # AIX assembly file
else() else()
libomp_append(LIBOMP_GNUASMFILES z_Linux_asm.S) # Unix assembly file libomp_append(LIBOMP_GNUASMFILES z_Linux_asm.S) # Unix assembly file
@ -218,7 +218,7 @@ if(OPENMP_MSVC_NAME_SCHEME)
LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}" LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}"
LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE} LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
) )
elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
set(LIBOMP_SHARED_OUTPUT_NAME "omp" CACHE STRING "Output name for the shared libomp runtime library.") set(LIBOMP_SHARED_OUTPUT_NAME "omp" CACHE STRING "Output name for the shared libomp runtime library.")
set_target_properties(omp PROPERTIES set_target_properties(omp PROPERTIES
OUTPUT_NAME "${LIBOMP_SHARED_OUTPUT_NAME}" OUTPUT_NAME "${LIBOMP_SHARED_OUTPUT_NAME}"

View File

@ -57,12 +57,12 @@ endif(HAVE_LIB_RT)
# We need extra libraries on Windows # We need extra libraries on Windows
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
target_link_libraries(benchmark PRIVATE shlwapi) target_link_libraries(benchmark PRIVATE shlwapi)
endif() endif()
# We need extra libraries on Solaris # We need extra libraries on Solaris
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
target_link_libraries(benchmark PRIVATE kstat) target_link_libraries(benchmark PRIVATE kstat)
endif() endif()

View File

@ -16,7 +16,7 @@ if(WIN32)
endif() endif()
# Google Test requires headers which need _ALL_SOURCE to build on AIX # Google Test requires headers which need _ALL_SOURCE to build on AIX
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
remove_definitions("-D_XOPEN_SOURCE=700") remove_definitions("-D_XOPEN_SOURCE=700")
add_definitions("-D_ALL_SOURCE") add_definitions("-D_ALL_SOURCE")
endif() endif()