diff --git a/cmake/Modules/SetPlatformToolchainTools.cmake b/cmake/Modules/SetPlatformToolchainTools.cmake new file mode 100644 index 000000000000..ab2abe934473 --- /dev/null +++ b/cmake/Modules/SetPlatformToolchainTools.cmake @@ -0,0 +1,9 @@ +get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) + +if(CMAKE_SYSTEM_NAME MATCHES "AIX") + foreach(lang IN LISTS languages) + set(CMAKE_${lang}_ARCHIVE_CREATE " -X32_64 qc ") + set(CMAKE_${lang}_ARCHIVE_APPEND " -X32_64 q ") + set(CMAKE_${lang}_ARCHIVE_FINISH " -X32_64 ") + endforeach() +endif() diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 1e721a046a2f..c5003b5efa1d 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -28,6 +28,7 @@ else() set(CMAKE_CFG_RESOLVED_INTDIR "") endif() +include(SetPlatformToolchainTools) include(base-config-ix) include(CompilerRTUtils) @@ -574,15 +575,6 @@ if (CMAKE_LINKER MATCHES "link.exe$") set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221") endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") - set(CMAKE_C_ARCHIVE_CREATE " -X32_64 qc ") - set(CMAKE_CXX_ARCHIVE_CREATE " -X32_64 qc ") - set(CMAKE_C_ARCHIVE_APPEND " -X32_64 q ") - set(CMAKE_CXX_ARCHIVE_APPEND " -X32_64 q ") - set(CMAKE_C_ARCHIVE_FINISH " -X32_64 ") - set(CMAKE_CXX_ARCHIVE_FINISH " -X32_64 ") -endif() - add_subdirectory(include) option(COMPILER_RT_USE_LIBCXX diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index e2489f1a3ed0..0b965d90a5b5 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -28,6 +28,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) load_llvm_config() construct_compiler_rt_default_triple() + include(SetPlatformToolchainTools) if(APPLE) include(CompilerRTDarwinUtils) endif() @@ -35,15 +36,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) include(UseLibtool) endif() include(AddCompilerRT) - - if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") - set(CMAKE_C_ARCHIVE_CREATE " -X32_64 qc ") - set(CMAKE_CXX_ARCHIVE_CREATE " -X32_64 qc ") - set(CMAKE_C_ARCHIVE_APPEND " -X32_64 q ") - set(CMAKE_CXX_ARCHIVE_APPEND " -X32_64 q ") - set(CMAKE_C_ARCHIVE_FINISH " -X32_64 ") - set(CMAKE_CXX_ARCHIVE_FINISH " -X32_64 ") - endif() endif() if (COMPILER_RT_STANDALONE_BUILD)