Intel.cmake 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_INTEL)
  5. return()
  6. endif()
  7. set(__COMPILER_INTEL 1)
  8. include(Compiler/CMakeCommonCompilerMacros)
  9. if(CMAKE_HOST_WIN32)
  10. # MSVC-like
  11. macro(__compiler_intel lang)
  12. if("x${lang}" STREQUAL "xFortran")
  13. set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-warn:errors")
  14. else()
  15. set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
  16. endif()
  17. set(CMAKE_${lang}_LINK_MODE LINKER)
  18. endmacro()
  19. else()
  20. # GNU-like
  21. macro(__compiler_intel lang)
  22. set(CMAKE_${lang}_VERBOSE_FLAG "-v")
  23. string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
  24. string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
  25. string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
  26. string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
  27. string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
  28. # Compiler + IPO does not recognize --dependency-file link option
  29. set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE)
  30. if("${lang}" STREQUAL "CXX")
  31. set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}")
  32. if(CMAKE_${lang}_COMPILER_ARG1)
  33. separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}")
  34. list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
  35. unset(_COMPILER_ARGS)
  36. endif()
  37. list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
  38. endif()
  39. if("x${lang}" STREQUAL "xFortran")
  40. set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-warn" "errors")
  41. else()
  42. # Precompile Headers
  43. set(CMAKE_PCH_EXTENSION .pchi)
  44. set(CMAKE_LINK_PCH ON)
  45. set(CMAKE_PCH_EPILOGUE "#pragma hdrstop")
  46. set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
  47. set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Wno-pch-messages -pch-use <PCH_FILE> -include <PCH_HEADER>)
  48. set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Wno-pch-messages -pch-create <PCH_FILE> -include <PCH_HEADER>)
  49. # COMPILE_WARNING_AS_ERROR
  50. set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
  51. endif()
  52. set(CMAKE_${lang}_LINK_MODE DRIVER)
  53. endmacro()
  54. endif()