IBMClang.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file LICENSE.rst or https://cmake.org/licensing for details.
  3. # This module is shared by multiple languages; use include blocker.
  4. if(__COMPILER_IBMClang)
  5. return()
  6. endif()
  7. set(__COMPILER_IBMClang 1)
  8. # Macro to set ibm-clang unique config. This should be called after common
  9. # clang config is included and include only what isn't common.
  10. macro(__compiler_ibmclang lang)
  11. # Feature flags.
  12. set(CMAKE_${lang}_VERBOSE_FLAG "-v")
  13. set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
  14. set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIC")
  15. set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
  16. set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
  17. if(CMAKE_${lang}_COMPILER_TARGET AND "${lang}" STREQUAL "CXX")
  18. list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
  19. endif()
  20. # Thin LTO is not yet supported on AIX.
  21. if(NOT (CMAKE_SYSTEM_NAME STREQUAL "AIX"))
  22. set(_CMAKE_LTO_THIN TRUE)
  23. endif()
  24. if("${lang}" STREQUAL "CXX")
  25. list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-dM" "-E" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
  26. endif()
  27. endmacro()