AIX-XL.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_XL)
  5. return()
  6. endif()
  7. set(__AIX_COMPILER_XL 1)
  8. macro(__aix_compiler_xl lang)
  9. set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
  10. set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
  11. string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-bnoipath")
  12. set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
  13. set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ")
  14. set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
  15. set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
  16. set(_OBJECTS " <OBJECTS>")
  17. if(DEFINED CMAKE_XL_CreateExportList AND CMAKE_XL_CreateExportList STREQUAL "")
  18. # Prior to CMake 3.16, CMAKE_XL_CreateExportList held the path to the XL CreateExportList tool.
  19. # Users could set it to an empty value to skip automatic exports in favor of manual -bE: flags.
  20. # Preserve that behavior for compatibility (even though it was undocumented).
  21. set(_OBJECTS "")
  22. endif()
  23. # Construct the export list ourselves to pass only the object files so
  24. # that we export only the symbols actually provided by the sources.
  25. set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
  26. "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp${_OBJECTS}"
  27. "<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>"
  28. )
  29. set(CMAKE_${lang}_LINK_EXECUTABLE_WITH_EXPORTS
  30. "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <TARGET_IMPLIB> -l . <OBJECTS>"
  31. "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> -Wl,-bE:<TARGET_IMPLIB> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
  32. unset(_OBJECTS)
  33. endmacro()