Clang.cmake 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #=============================================================================
  2. # Copyright 2002-2012 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # This module is shared by multiple languages; use include blocker.
  14. if(__COMPILER_CLANG)
  15. return()
  16. endif()
  17. set(__COMPILER_CLANG 1)
  18. if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
  19. OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
  20. macro(__compiler_clang lang)
  21. endmacro()
  22. else()
  23. include(Compiler/GNU)
  24. macro(__compiler_clang lang)
  25. __compiler_gnu(${lang})
  26. set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
  27. set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
  28. set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
  29. if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0)
  30. set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-target ")
  31. set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "-gcc-toolchain ")
  32. else()
  33. set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
  34. set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
  35. endif()
  36. endmacro()
  37. endif()