Linux-Intel.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #=============================================================================
  2. # Copyright 2002-2009 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(__LINUX_COMPILER_INTEL)
  15. return()
  16. endif()
  17. set(__LINUX_COMPILER_INTEL 1)
  18. if(NOT XIAR)
  19. set(_intel_xiar_hints)
  20. foreach(lang C CXX Fortran)
  21. if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}")
  22. get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH)
  23. list(APPEND _intel_xiar_hints ${_hint})
  24. endif()
  25. endforeach()
  26. find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints})
  27. mark_as_advanced(XIAR)
  28. endif(NOT XIAR)
  29. macro(__linux_compiler_intel lang)
  30. set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
  31. set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
  32. # We pass this for historical reasons. Projects may have
  33. # executables that use dlopen but do not set ENABLE_EXPORTS.
  34. set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
  35. if(XIAR)
  36. # INTERPROCEDURAL_OPTIMIZATION
  37. set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -ipo)
  38. set(CMAKE_${lang}_CREATE_STATIC_LIBRARY_IPO
  39. "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
  40. "${XIAR} -s <TARGET> ")
  41. endif()
  42. endmacro()