diff --git a/cmake/Modules/SetPlatformToolchainTools.cmake b/cmake/Modules/SetPlatformToolchainTools.cmake new file mode 100644 --- /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 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -28,6 +28,7 @@ set(CMAKE_CFG_RESOLVED_INTDIR "") endif() +include(SetPlatformToolchainTools) include(base-config-ix) include(CompilerRTUtils) @@ -574,15 +575,6 @@ 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 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -28,6 +28,7 @@ load_llvm_config() construct_compiler_rt_default_triple() + include(SetPlatformToolchainTools) if(APPLE) include(CompilerRTDarwinUtils) endif() @@ -35,15 +36,6 @@ 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)