AIX-GNU.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # This module is shared by multiple languages; use include blocker.
  4. if(__AIX_COMPILER_GNU)
  5. return()
  6. endif()
  7. set(__AIX_COMPILER_GNU 1)
  8. #
  9. # By default, runtime linking is enabled. All shared objects specified on the command line
  10. # will be listed, even if there are no symbols referenced, in the output file.
  11. string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,-brtl")
  12. macro(__aix_compiler_gnu lang)
  13. set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
  14. set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
  15. string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-G,-bnoipath")
  16. set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
  17. set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
  18. set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
  19. if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1)
  20. unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
  21. endif()
  22. # Construct the export list ourselves to pass only the object files so
  23. # that we export only the symbols actually provided by the sources.
  24. set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
  25. "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp <OBJECTS>"
  26. "<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> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
  27. )
  28. set(CMAKE_${lang}_LINK_EXECUTABLE_WITH_EXPORTS
  29. "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp <OBJECTS>"
  30. "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
  31. endmacro()