https://github.com/daltenty updated https://github.com/llvm/llvm-project/pull/154537
>From d642441854a74abcf5d3aa651abdec3465e78188 Mon Sep 17 00:00:00 2001 From: David Tenty <dalte...@ibm.com> Date: Wed, 20 Aug 2025 00:08:58 -0400 Subject: [PATCH 1/3] [NFC][CMake] quote ${CMAKE_SYSTEM_NAME} consistently --- llvm/cmake/modules/AddLLVM.cmake | 26 +++++++++---------- llvm/cmake/modules/HandleLLVMOptions.cmake | 25 +++++++++++------- llvm/lib/Target/CMakeLists.txt | 2 +- llvm/lib/TargetParser/CMakeLists.txt | 2 +- llvm/tools/llvm-jitlink/CMakeLists.txt | 4 +-- .../Support/DynamicLibrary/CMakeLists.txt | 6 ++--- mlir/cmake/modules/FindSyclRuntime.cmake | 2 +- offload/cmake/OpenMPTesting.cmake | 2 +- openmp/CMakeLists.txt | 2 +- openmp/cmake/OpenMPTesting.cmake | 2 +- openmp/runtime/CMakeLists.txt | 2 +- openmp/runtime/cmake/LibompHandleFlags.cmake | 6 ++--- openmp/runtime/src/CMakeLists.txt | 4 +-- third-party/benchmark/src/CMakeLists.txt | 4 +-- third-party/unittest/CMakeLists.txt | 2 +- 15 files changed, 48 insertions(+), 43 deletions(-) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 83772ed8d2b13..835750e2d2a13 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -99,7 +99,7 @@ function(llvm_update_compile_flags name) endfunction() 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") add_custom_command(OUTPUT ${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}") set_property(TARGET ${target_name} APPEND_STRING PROPERTY 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 # compiler driver to defer to the specified export list. set(native_export_file "${export_file}") @@ -268,7 +268,7 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) endif() endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") include(CheckLinkerFlag) # Linkers that support Darwin allow a setting to internalize all symbol exports, # 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. if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") 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. set_property(TARGET ${target_name} APPEND_STRING PROPERTY 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 # 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) @@ -333,7 +333,7 @@ function(add_link_opts target_name) LINK_FLAGS " -Wl,--gc-sections") endif() 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 LINK_FLAGS " -Wl,-bnogc") endif() @@ -345,7 +345,7 @@ function(add_link_opts target_name) LINK_FLAGS " -Wl,-no_warn_duplicate_libraries") 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 LINK_FLAGS " -Wl,-brtl") endif() @@ -667,7 +667,7 @@ function(llvm_add_library name) # 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 (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) set_target_properties(${name} PROPERTIES @@ -1094,7 +1094,7 @@ macro(add_llvm_executable name) llvm_update_compile_flags(${name}) 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) endif() @@ -1417,7 +1417,7 @@ function(export_executable_symbols target) # CMake doesn't set CMAKE_EXE_EXPORTS_${lang}_FLAG on Solaris, so # ENABLE_EXPORTS has no effect. While Solaris ld defaults to -rdynamic # 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 LINK_FLAGS " -rdynamic") endif() @@ -2540,7 +2540,7 @@ function(llvm_setup_rpath name) if (APPLE) set(_install_name_dir INSTALL_NAME_DIR "@rpath") 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. # Since BUILD_SHARED_LIBS is only recommended for use by developers, # hardcode the rpath to build/install lib dir first in this mode. @@ -2549,7 +2549,7 @@ function(llvm_setup_rpath name) elseif(UNIX) set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 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 LINK_FLAGS " -Wl,-z,origin ") endif() @@ -2567,7 +2567,7 @@ function(llvm_setup_rpath name) # 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. 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) else() set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}") diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 91aaeb5a6e3ff..c487f57da3461 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -228,7 +228,7 @@ if(WIN32 OR CYGWIN) elseif(FUCHSIA OR UNIX) set(LLVM_ON_WIN32 0) 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) else() set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) @@ -249,7 +249,7 @@ set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # 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}) else() 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") 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, # 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 @@ -292,7 +292,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") 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. if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") 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 # between global objects which became horribly broken when one of the libraries # 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_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,nodelete") endif() @@ -454,13 +454,13 @@ if( LLVM_ENABLE_PIC ) # to SEGV (GCC PR target/96607). # clang with -O3 -fPIC generates code that SEGVs. # 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_RELWITHDEBINFO "-O[23]" "-O") 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"))) # 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 @@ -708,7 +708,7 @@ endif () if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES ) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) 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. set(module_flags "${module_flags} -fcxx-modules") endif() @@ -1123,7 +1123,7 @@ endif() # But MinSizeRel seems to add that automatically, so maybe disable these # flags instead if LLVM_NO_DEAD_STRIP is set. 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") if (CMAKE_CXX_COMPILER_ID MATCHES "XL") 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 # explicitly link against (exactly one) tool so we can't unilaterally turn on # 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 "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) message(FATAL_ERROR "BUILD_SHARED_LIBS not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS") endif() diff --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt index e26e00ea3fdfd..bcc13f942bf96 100644 --- a/llvm/lib/Target/CMakeLists.txt +++ b/llvm/lib/Target/CMakeLists.txt @@ -24,7 +24,7 @@ add_llvm_component_library(LLVMTarget # that are used across shared objects which we can't hide. 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 (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND + NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") AND NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET) # Set default visibility to hidden, so we don't export all the Target classes # in libLLVM.so. diff --git a/llvm/lib/TargetParser/CMakeLists.txt b/llvm/lib/TargetParser/CMakeLists.txt index 62e97bfebe099..5eecfbf80b2f7 100644 --- a/llvm/lib/TargetParser/CMakeLists.txt +++ b/llvm/lib/TargetParser/CMakeLists.txt @@ -9,7 +9,7 @@ if (HAS_WERROR_GLOBAL_CTORS AND NOT LLVM_HAS_NOGLOBAL_CTOR_MUTEX) endif() # 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) endif() diff --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt index e337fe5f99865..19e3edaf63d86 100644 --- a/llvm/tools/llvm-jitlink/CMakeLists.txt +++ b/llvm/tools/llvm-jitlink/CMakeLists.txt @@ -30,10 +30,10 @@ add_llvm_tool(llvm-jitlink EXPORT_SYMBOLS ) -if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku") +if("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku") target_link_libraries(llvm-jitlink PRIVATE network) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") +if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") target_link_libraries(llvm-jitlink PRIVATE socket) endif() diff --git a/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt b/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt index 2366209c25aee..98b7f2d19ee46 100644 --- a/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt +++ b/llvm/unittests/Support/DynamicLibrary/CMakeLists.txt @@ -16,7 +16,7 @@ set_output_directory(DynamicLibraryLib ) # 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 DynamicLibraryTest.cpp ) @@ -28,7 +28,7 @@ else() ) endif() target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib) -if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") export_executable_symbols(DynamicLibraryTests) endif() @@ -64,7 +64,7 @@ endfunction(dynlib_add_module) # Revert -Wl,-z,nodelete on this test since it relies on the file # being unloaded. -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") string(REPLACE "-Wl,-z,nodelete" "" CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS}) endif() diff --git a/mlir/cmake/modules/FindSyclRuntime.cmake b/mlir/cmake/modules/FindSyclRuntime.cmake index 9e6ae04025848..5986895cb1628 100644 --- a/mlir/cmake/modules/FindSyclRuntime.cmake +++ b/mlir/cmake/modules/FindSyclRuntime.cmake @@ -19,7 +19,7 @@ if(NOT DEFINED ENV{CMPLR_ROOT}) else() get_filename_component(ONEAPI_VER "$ENV{CMPLR_ROOT}" NAME) 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") elseif(WIN32) set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/windows") diff --git a/offload/cmake/OpenMPTesting.cmake b/offload/cmake/OpenMPTesting.cmake index 8e955ff399275..ef8cf34ba0c85 100644 --- a/offload/cmake/OpenMPTesting.cmake +++ b/offload/cmake/OpenMPTesting.cmake @@ -57,7 +57,7 @@ if (${OPENMP_STANDALONE_BUILD}) if (MSVC OR XCODE) set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar") endif() - if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") + if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=1800") endif() set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.") diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index edd79df7fb767..beaba1d122efb 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -117,7 +117,7 @@ set(ENABLE_LIBOMPTARGET ON) # there is no point in trying to compile libomptarget on other OSes. # 32-bit systems are not supported either. 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) endif() diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake index 14cc5c67d84c2..85240aede728d 100644 --- a/openmp/cmake/OpenMPTesting.cmake +++ b/openmp/cmake/OpenMPTesting.cmake @@ -57,7 +57,7 @@ if (${OPENMP_STANDALONE_BUILD}) if (MSVC OR XCODE) set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar") endif() - if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") + if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=3000") endif() set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.") diff --git a/openmp/runtime/CMakeLists.txt b/openmp/runtime/CMakeLists.txt index b6c4759ec03f7..93eb14f10a50a 100644 --- a/openmp/runtime/CMakeLists.txt +++ b/openmp/runtime/CMakeLists.txt @@ -136,7 +136,7 @@ set(LIBOMP_ASMFLAGS "" CACHE STRING "Appended user specified assembler flags.") set(LIBOMP_LDFLAGS "" CACHE STRING "Appended user specified linker flags.") -if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") set(LIBOMP_LIBFLAGS "-lperfstat" CACHE STRING "Appended user specified linked libs flags. (e.g., -lm)") if("${LIBOMP_ARCH}" STREQUAL "ppc") diff --git a/openmp/runtime/cmake/LibompHandleFlags.cmake b/openmp/runtime/cmake/LibompHandleFlags.cmake index 61fc31d0fc7fd..c36a88fb862ae 100644 --- a/openmp/runtime/cmake/LibompHandleFlags.cmake +++ b/openmp/runtime/cmake/LibompHandleFlags.cmake @@ -140,14 +140,14 @@ function(libomp_get_libflags libflags) if(LIBOMP_HAVE_SHM_OPEN_WITH_LRT) libomp_append(libflags_local -lrt) 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 "-lm") 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") endif() - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|NetBSD|SunOS") + elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux|NetBSD|SunOS") libomp_append(libflags_local -lm) endif() set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS}) diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index 569061c6494b8..08e1753b93636 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -121,7 +121,7 @@ else() # Unix specific files libomp_append(LIBOMP_CXXFILES z_Linux_util.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 else() 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}" 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_target_properties(omp PROPERTIES OUTPUT_NAME "${LIBOMP_SHARED_OUTPUT_NAME}" diff --git a/third-party/benchmark/src/CMakeLists.txt b/third-party/benchmark/src/CMakeLists.txt index 943594b70bcd0..0357dcce3f831 100644 --- a/third-party/benchmark/src/CMakeLists.txt +++ b/third-party/benchmark/src/CMakeLists.txt @@ -57,12 +57,12 @@ endif(HAVE_LIB_RT) # We need extra libraries on Windows -if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") +if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows") target_link_libraries(benchmark PRIVATE shlwapi) endif() # We need extra libraries on Solaris -if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") +if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") target_link_libraries(benchmark PRIVATE kstat) endif() diff --git a/third-party/unittest/CMakeLists.txt b/third-party/unittest/CMakeLists.txt index b9f3593320d77..3fa885a16ea1e 100644 --- a/third-party/unittest/CMakeLists.txt +++ b/third-party/unittest/CMakeLists.txt @@ -16,7 +16,7 @@ if(WIN32) endif() # 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") add_definitions("-D_ALL_SOURCE") endif() >From 2434965d7dcf1fee8eac88a8599086901a1be94e Mon Sep 17 00:00:00 2001 From: David Tenty <daltenty....@gmail.com> Date: Wed, 20 Aug 2025 10:40:51 -0400 Subject: [PATCH 2/3] Update openmp/CMakeLists.txt Co-authored-by: Hubert Tong <hubert.reinterpretc...@gmail.com> --- openmp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index beaba1d122efb..f3de4bc4ee87b 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -117,7 +117,7 @@ set(ENABLE_LIBOMPTARGET ON) # there is no point in trying to compile libomptarget on other OSes. # 32-bit systems are not supported either. 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) endif() >From 8d0c787337a3aafa82ae3a38478ff735dbbcf18b Mon Sep 17 00:00:00 2001 From: David Tenty <dalte...@ibm.com> Date: Wed, 20 Aug 2025 12:03:08 -0400 Subject: [PATCH 3/3] Add cases I missed initially --- clang-tools-extra/clangd/CMakeLists.txt | 4 ++-- clang/bindings/python/tests/CMakeLists.txt | 2 +- clang/tools/libclang/CMakeLists.txt | 6 +++--- compiler-rt/cmake/config-ix.cmake | 2 +- compiler-rt/lib/asan/CMakeLists.txt | 4 ++-- libcxx/CMakeLists.txt | 4 ++-- libcxxabi/CMakeLists.txt | 4 ++-- libcxxabi/src/CMakeLists.txt | 2 +- libunwind/src/CMakeLists.txt | 2 +- lldb/source/Host/CMakeLists.txt | 2 +- .../Plugins/Process/FreeBSDKernel/CMakeLists.txt | 2 +- lldb/tools/driver/CMakeLists.txt | 2 +- llvm/CMakeLists.txt | 14 +++++++------- llvm/cmake/config-ix.cmake | 8 ++++---- llvm/lib/Support/CMakeLists.txt | 4 ++-- openmp/runtime/cmake/config-ix.cmake | 2 +- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt index 06920a97ddc88..fb3f05329be21 100644 --- a/clang-tools-extra/clangd/CMakeLists.txt +++ b/clang-tools-extra/clangd/CMakeLists.txt @@ -6,7 +6,7 @@ add_subdirectory(support) # Configure the Features.inc file. if (NOT DEFINED CLANGD_BUILD_XPC) - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") set(CLANGD_BUILD_XPC_DEFAULT ON) else () set(CLANGD_BUILD_XPC_DEFAULT OFF) @@ -193,7 +193,7 @@ if(CLANGD_TIDY_CHECKS) endif() 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. add_subdirectory(fuzzer) endif() diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt index a0ddabc21bb41..d9a6bbf452bd6 100644 --- a/clang/bindings/python/tests/CMakeLists.txt +++ b/clang/bindings/python/tests/CMakeLists.txt @@ -35,7 +35,7 @@ if(WIN32) endif() # 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) endif() diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt index 2b1e266f07392..e0ff7605b68b8 100644 --- a/clang/tools/libclang/CMakeLists.txt +++ b/clang/tools/libclang/CMakeLists.txt @@ -93,7 +93,7 @@ if(MSVC) set(LLVM_EXPORTED_SYMBOL_FILE) 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(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT}) endif() @@ -125,7 +125,7 @@ else() set(output_name "clang") endif() -if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX") set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF) # libclang requires headers which need _ALL_SOURCE to build on AIX remove_definitions("-D_XOPEN_SOURCE=700") @@ -186,7 +186,7 @@ if(ENABLE_SHARED) endif() endif() if (USE_VERSION_SCRIPT) - if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + if ("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") include(CheckLinkerFlag) # The Solaris 11.4 linker supports a subset of GNU ld version scripts, # but requires a special option to enable it. diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index e3310b1ff0e2c..67db4383ec3dc 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -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 "-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") llvm_check_compiler_linker_flag(C "${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT) endif() diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt index 97cc5c85703e1..d1d229e3e6d40 100644 --- a/compiler-rt/lib/asan/CMakeLists.txt +++ b/compiler-rt/lib/asan/CMakeLists.txt @@ -282,7 +282,7 @@ else() endif() # 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}) if (COMPILER_RT_HAS_VERSION_SCRIPT) 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 # 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. -if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") 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_cxx_symbols_${arch} asan_cxx.link_with_main_exec.txt asan ${arch}) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 85514cc7547a9..8f653efa59665 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -113,7 +113,7 @@ option(LIBCXX_ENABLE_MONOTONIC_CLOCK # # TODO TZDB make the default always ON when most platforms ship with the IANA # database. -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") set(ENABLE_TIME_ZONE_DATABASE_DEFAULT ON) else() set(ENABLE_TIME_ZONE_DATABASE_DEFAULT OFF) @@ -466,7 +466,7 @@ include(HandleLibcxxFlags) # 'config-ix' use them during feature checks. It also adds them to both # '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") set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF) endif() diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index cf478bcee01fa..3dabd87b9c587 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -244,7 +244,7 @@ include(HandleLibcxxabiFlags) #=============================================================================== # Configure target flags -if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") add_flags_if_supported("-mdefault-visibility-export-mapping=explicit") set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF) 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 # 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") endif() diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt index 0675577aed6a1..38a54b16278a7 100644 --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -37,7 +37,7 @@ else() endif() 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 cxa_thread_atexit.cpp ) diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt index 71663a22cdf41..514c2fcd5bf4e 100644 --- a/libunwind/src/CMakeLists.txt +++ b/libunwind/src/CMakeLists.txt @@ -6,7 +6,7 @@ set(LIBUNWIND_CXX_SOURCES Unwind-seh.cpp ) -if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX") list(APPEND LIBUNWIND_CXX_SOURCES Unwind_AIXExtras.cpp ) diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index b15d72e61b6e5..c9e8afe48fcde 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -7,7 +7,7 @@ if (APPLE AND LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY) endif() endif() -if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX") add_definitions("-D_ALL_SOURCE") endif() diff --git a/lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt b/lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt index b0d1370286a8c..c35b4def24e25 100644 --- a/lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt +++ b/lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt @@ -2,7 +2,7 @@ set(FBSDKERNEL_LIBS) if(FBSDVMCore_FOUND) list(APPEND FBSDKERNEL_LIBS fbsdvmcore) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") +if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") list(APPEND FBSDKERNEL_LIBS kvm) endif() diff --git a/lldb/tools/driver/CMakeLists.txt b/lldb/tools/driver/CMakeLists.txt index 5c0cac484cc94..446bf68d09622 100644 --- a/lldb/tools/driver/CMakeLists.txt +++ b/lldb/tools/driver/CMakeLists.txt @@ -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") endif() -if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") +if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX") remove_definitions("-D_XOPEN_SOURCE=700") add_definitions("-D_ALL_SOURCE") endif() diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 565f5caa561fd..970eb7be8af8f 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -110,7 +110,7 @@ endif() # one for llvm+clang+... using the same sources. # 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") -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 # LLVM_ENABLE_RUNTIMES. 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) endif() 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) else() 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 # 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. option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) endif() @@ -1256,7 +1256,7 @@ endif() # 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. -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(_LARGE_FILE_API) add_compile_options(-pthread) @@ -1284,7 +1284,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "OS390") endif() # 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) endif() @@ -1302,10 +1302,10 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST) # (this is a variable that CrossCompile sets on recursive invocations) endif() -if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) +if( "${CMAKE_SYSTEM_NAME}" MATCHES SunOS ) # special hack for Solaris to handle crazy system sys/regset.h 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, # use EXPORT_SYMBOLS argument. diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index a8e4e5a63244d..ed2bfa6df68f4 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -69,14 +69,14 @@ endif() # Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build # 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_LARGE_FILE_API") endif() # Do checks with _FILE_OFFSET_BITS=64 on Solaris, because we will build # 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") endif() @@ -122,7 +122,7 @@ if(APPLE) HAVE_CRASHREPORTER_INFO) endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") check_include_file(linux/magic.h HAVE_LINUX_MAGIC_H) if(NOT HAVE_LINUX_MAGIC_H) # older kernels use split files @@ -411,7 +411,7 @@ endif() CHECK_STRUCT_HAS_MEMBER("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 # environments. set(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0) diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt index b7578dd580072..6646af6db5d3c 100644 --- a/llvm/lib/Support/CMakeLists.txt +++ b/llvm/lib/Support/CMakeLists.txt @@ -62,7 +62,7 @@ elseif( CMAKE_HOST_UNIX ) if( UNIX AND NOT (BEOS OR HAIKU) ) set(system_libs ${system_libs} m) endif() - if( UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + if( UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" ) set(system_libs ${system_libs} kstat socket) endif() if( FUCHSIA ) @@ -130,7 +130,7 @@ endif() # 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 # 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") endif() diff --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake index 144c657be67e8..30b69d46a8bd1 100644 --- a/openmp/runtime/cmake/config-ix.cmake +++ b/openmp/runtime/cmake/config-ix.cmake @@ -321,7 +321,7 @@ else() (LIBOMP_ARCH STREQUAL sparcv9)) AND # OS supported? ((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) else() set(LIBOMP_HAVE_OMPT_SUPPORT FALSE) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits