CMakeFindEclipseCDT4.cmake 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #=============================================================================
  2. # Copyright 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 file is included in CMakeSystemSpecificInformation.cmake if
  14. # the Eclipse CDT4 extra generator has been selected.
  15. FIND_PROGRAM(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable")
  16. FUNCTION(_FIND_ECLIPSE_VERSION)
  17. # This code is in a function so the variables used here have only local scope
  18. IF(CMAKE_ECLIPSE_EXECUTABLE)
  19. GET_FILENAME_COMPONENT(_ECLIPSE_DIR "${CMAKE_ECLIPSE_EXECUTABLE}" PATH)
  20. FILE(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*")
  21. IF("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+")
  22. SET(_ECLIPSE_VERSION ${CMAKE_MATCH_1})
  23. ENDIF()
  24. ENDIF()
  25. IF(_ECLIPSE_VERSION)
  26. MESSAGE(STATUS "Found Eclipse version ${_ECLIPSE_VERSION}")
  27. ELSE()
  28. SET(_ECLIPSE_VERSION "3.6" )
  29. MESSAGE(STATUS "Could not determine Eclipse version, assuming ${_ECLIPSE_VERSION}")
  30. ENDIF()
  31. # Set up a map with the names of the Eclipse releases:
  32. SET(_ECLIPSE_VERSION_NAME_ "Unknown" )
  33. SET(_ECLIPSE_VERSION_NAME_3.2 "Callisto" )
  34. SET(_ECLIPSE_VERSION_NAME_3.3 "Europa" )
  35. SET(_ECLIPSE_VERSION_NAME_3.4 "Ganymede" )
  36. SET(_ECLIPSE_VERSION_NAME_3.5 "Galileo" )
  37. SET(_ECLIPSE_VERSION_NAME_3.6 "Helios" )
  38. SET(_ECLIPSE_VERSION_NAME_3.7 "Indigo" )
  39. SET(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.")
  40. SET_PROPERTY(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})"
  41. "3.3 (${_ECLIPSE_VERSION_NAME_3.3})"
  42. "3.4 (${_ECLIPSE_VERSION_NAME_3.4})"
  43. "3.5 (${_ECLIPSE_VERSION_NAME_3.5})"
  44. "3.6 (${_ECLIPSE_VERSION_NAME_3.6})"
  45. "3.7 (${_ECLIPSE_VERSION_NAME_3.7})")
  46. ENDFUNCTION()
  47. _FIND_ECLIPSE_VERSION()
  48. # This variable is used by the Eclipse generator and appended to the make invocation commands.
  49. SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
  50. # This variable is used by the Eclipse generator in out-of-source builds only.
  51. SET(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
  52. MARK_AS_ADVANCED(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT)
  53. # Determine builtin macros and include dirs:
  54. INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake)