--- ./Modules/Platform/AIX-GNU.cmake_orig	2023-06-26 07:14:22.212796426 +0000
+++ ./Modules/Platform/AIX-GNU.cmake	2023-06-26 07:18:37.528408923 +0000
@@ -12,9 +12,14 @@
   set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
   set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
   string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-bnoipath")
-  set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
+  # WE DO NO WANT BEXPALL
+  # set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
+  set(CMAKE_SHARED_MODULE_${lang}_FLAGS ${CMAKE_SHARED_LIBRARY_${lang}_FLAGS})
+  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS})
+  
   set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
-
+  # Needed to have SOVERSION...
+  set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-o ")
   set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
   if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1)
     unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
@@ -22,11 +27,17 @@
 
   # Construct the export list ourselves to pass only the object files so
   # that we export only the symbols actually provided by the sources.
+  # By default, module are .so and shared libraries .a in AIX.
   set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
     "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/exports.exp -c <CMAKE_${lang}_COMPILER> <AIX_EXPORTS> <OBJECTS>"
-    "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/exports.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
-    )
+    "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/exports.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>"
+    "<CMAKE_AR> -X32_64 rc <TARGET> <TARGET_SONAME>"
+  )
 
+  set(CMAKE_${lang}_CREATE_SHARED_MODULE
+    "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/exports.exp -c <CMAKE_${lang}_COMPILER> <AIX_EXPORTS> <OBJECTS>"
+    "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/exports.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+  )
   set(CMAKE_${lang}_LINK_EXECUTABLE_WITH_EXPORTS
     "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <TARGET_IMPLIB> -c <CMAKE_${lang}_COMPILER> -l . <AIX_EXPORTS> <OBJECTS>"
     "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> -Wl,-bE:<TARGET_IMPLIB> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
--- ./Modules/Platform/AIX-XL.cmake_orig	2023-06-26 07:23:25.502759719 +0000
+++ ./Modules/Platform/AIX-XL.cmake	2023-06-26 07:27:59.472814252 +0000
@@ -12,10 +12,14 @@
   set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
   set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
   string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-bnoipath")
-  set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
-  set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ")
-  set(CMAKE_SHARED_MODULE_${lang}_FLAGS  " ")
+  # WE DO NO WANT BEXPALL
+  # set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
+  set(CMAKE_SHARED_MODULE_${lang}_FLAGS ${CMAKE_SHARED_LIBRARY_${lang}_FLAGS})
+  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS})
 
+  set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
+  # Needed to have SOVERSION...
+  set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-o ")
   set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
 
   set(_OBJECTS " <OBJECTS>")
@@ -28,11 +32,18 @@
 
   # Construct the export list ourselves to pass only the object files so
   # that we export only the symbols actually provided by the sources.
+  # By default, module are .so and shared libraries .a in AIX.
   set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
     "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/exports.exp -c <CMAKE_${lang}_COMPILER> <AIX_EXPORTS>${_OBJECTS}"
-    "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/exports.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+    "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>"
+    "<CMAKE_AR> -X32_64 rc <TARGET> <TARGET_SONAME>"
     )
 
+  set(CMAKE_${lang}_CREATE_SHARED_MODULE
+    "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp -c <CMAKE_${lang}_COMPILER> <AIX_EXPORTS>${_OBJECTS}"
+    "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+     )
+
   set(CMAKE_${lang}_LINK_EXECUTABLE_WITH_EXPORTS
     "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <TARGET_IMPLIB> -c <CMAKE_${lang}_COMPILER> -l . <AIX_EXPORTS> <OBJECTS>"
     "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> -Wl,-bE:<TARGET_IMPLIB> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
--- ./Modules/Platform/AIX.cmake_orig	2023-06-26 07:30:16.008697232 +0000
+++ ./Modules/Platform/AIX.cmake	2023-06-26 07:32:41.349379900 +0000
@@ -1,9 +1,16 @@
-set(CMAKE_SHARED_LIBRARY_PREFIX "lib")          # lib
-set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")          # .so
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".a")
+set(CMAKE_SHARED_MODULE_PREFIX "lib")
+set(CMAKE_SHARED_MODULE_SUFFIX ".so")
 set(CMAKE_AIX_IMPORT_FILE_PREFIX "")
 set(CMAKE_AIX_IMPORT_FILE_SUFFIX ".imp")
 set(CMAKE_DL_LIBS "-lld")
 
+set(CMAKE_MODULE_EXISTS 1)
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".so")
+
 # RPATH support on AIX is called libpath.  By default the runtime
 # libpath is paths specified by -L followed by /usr/lib and /lib.  In
 # order to prevent the -L paths from being used we must force use of
@@ -17,17 +24,5 @@
 # Files named "libfoo.a" may actually be shared libraries.
 set_property(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1)
 
-# since .a can be a static or shared library on AIX, we can not do this.
-# at some point if we wanted it, we would have to figure out if a .a is
-# static or shared, then we could add this back:
-
-# Initialize C link type selection flags.  These flags are used when
-# building a shared library, shared module, or executable that links
-# to other libraries to select whether to use the static or shared
-# versions of the libraries.
-#foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
-#  set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-bstatic")
-#  set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-bdynamic")
-#endforeach()
 
 include(Platform/UnixPaths)
--- ./Modules/Platform/AIX-XLClang.cmake_orig	2023-06-26 07:34:29.523271879 +0000
+++ ./Modules/Platform/AIX-XLClang.cmake	2023-06-26 07:35:44.899727534 +0000
@@ -8,8 +8,8 @@
 endif()
 set(__AIX_COMPILER_XLCLANG 1)
 
-include(Platform/AIX-XL)
+include(Platform/AIX-GNU)
 
 macro(__aix_compiler_xlclang lang)
-  __aix_compiler_xl(${lang})
+  __aix_compiler_gnu(${lang})
 endmacro()
--- ./Source/cmGeneratorTarget.cxx_orig	2023-06-26 07:38:04.279834331 +0000
+++ ./Source/cmGeneratorTarget.cxx	2023-06-26 07:42:29.925673900 +0000
@@ -5257,7 +5257,7 @@
   // The library name.
   targetNames.Base = components.base;
   targetNames.Output =
-    components.prefix + targetNames.Base + components.suffix;
+    components.prefix + targetNames.Base;
 
   if (this->IsFrameworkOnApple()) {
     targetNames.Real = components.prefix;
@@ -5272,12 +5272,12 @@
     // The library's soname.
     this->ComputeVersionedName(targetNames.SharedObject, components.prefix,
                                targetNames.Base, components.suffix,
-                               targetNames.Output, soversion);
+                               targetNames.Output + ".so", soversion);
 
     // The library's real name on disk.
     this->ComputeVersionedName(targetNames.Real, components.prefix,
                                targetNames.Base, components.suffix,
-                               targetNames.Output, version);
+                               targetNames.Output + components.suffix, cmValue(""));
   }
 
   // The import library name.
@@ -6746,7 +6746,7 @@
   std::string const& suffix, std::string const& name, cmValue version) const
 {
   vName = this->Makefile->IsOn("APPLE") ? (prefix + base) : name;
-  if (version) {
+  if (version && *version != "") {
     vName += ".";
     vName += *version;
   }
--- ./Source/cmInstallTargetGenerator.cxx_orig	2023-06-26 07:44:28.237638913 +0000
+++ ./Source/cmInstallTargetGenerator.cxx	2023-06-26 07:48:48.803357329 +0000
@@ -320,10 +320,15 @@
     } else {
       bool haveNamelink = false;
 
+#ifndef _AIX
       // Library link name.
       std::string fromName = fromDirConfig + targetNames.Output;
       std::string toName = targetNames.Output;
-
+#else
+      // Name is RealName
+      std::string fromName = fromDirConfig + targetNames.Real;
+      std::string toName = targetNames.Real;
+#endif
       // Library interface name.
       std::string fromSOName;
       std::string toSOName;
@@ -359,6 +364,10 @@
           }
 
           // Install the soname link if it has its own name.
+#ifdef _AIX
+         // We do not want both SOName and RealName
+         else
+#endif
           if (!fromSOName.empty()) {
             files.From.emplace_back(fromSOName);
             files.To.emplace_back(toSOName);
--- ./Source/cmMakefileLibraryTargetGenerator.cxx_orig	2023-06-26 07:51:53.708360863 +0000
+++ ./Source/cmMakefileLibraryTargetGenerator.cxx	2023-06-26 07:54:33.972814548 +0000
@@ -763,12 +763,12 @@
     vars.LinkLibraries = linkLibs.c_str();
     vars.ObjectsQuoted = buildObjs.c_str();
     std::string targetOutSOName;
-    if (this->GeneratorTarget->HasSOName(this->GetConfigName())) {
+    //if (this->GeneratorTarget->HasSOName(this->GetConfigName())) {
       vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
       targetOutSOName = this->LocalGenerator->ConvertToOutputFormat(
         this->TargetNames.SharedObject.c_str(), cmOutputConverter::SHELL);
       vars.TargetSOName = targetOutSOName.c_str();
-    }
+    //}
     vars.LinkFlags = linkFlags.c_str();
 
     vars.Manifests = manifests.c_str();
@@ -910,6 +910,7 @@
   cm::append(commands, commands1);
   commands1.clear();
 
+#ifndef _AIX
   // Add a rule to create necessary symlinks for the library.
   // Frameworks are handled by cmOSXBundleGenerator.
   if (targetOutPath != targetOutPathReal &&
@@ -924,7 +925,7 @@
     cm::append(commands, commands1);
     commands1.clear();
   }
-
+#endif
   // Add the post-build rules when building but not when relinking.
   if (!relink) {
     this->LocalGenerator->AppendCustomCommands(
--- ./Source/cmSystemTools.cxx_orig	2023-06-26 07:55:49.229933517 +0000
+++ ./Source/cmSystemTools.cxx	2023-06-26 07:59:59.962812473 +0000
@@ -3072,6 +3072,13 @@
   (void)emsg;
   return cm::nullopt;
 #else
+ 
+  // Ignore archive
+  if (file.length() >= 2 && file.back() == 'a' && file[file.length()-2] == '.') {
+    *changed = true;
+    return true;
+  }
+  
   bool chg = false;
   cmXCOFF xcoff(file.c_str(), cmXCOFF::Mode::ReadWrite);
   if (!xcoff) {
