CMakeEclipseCDT4.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # This file is included in CMakeSystemSpecificInformation.cmake if
  2. # the Eclipse CDT4 extra generator has been selected.
  3. FIND_PROGRAM(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable")
  4. # The Eclipse generator needs to know the standard include path
  5. # so that Eclipse ca find the headers at runtime and parsing etc. works better
  6. # This is done here by actually running gcc with the options so it prints its
  7. # system include directories, which are parsed then and stored in the cache.
  8. MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _result)
  9. SET(${_result})
  10. SET(_gccOutput)
  11. FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" )
  12. EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -v -E -x ${_lang} dummy
  13. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
  14. ERROR_VARIABLE _gccOutput
  15. OUTPUT_QUIET )
  16. FILE(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
  17. IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" )
  18. SET(${_result} ${CMAKE_MATCH_1})
  19. STRING(REPLACE "\n" " " ${_result} "${${_result}}")
  20. SEPARATE_ARGUMENTS(${_result})
  21. ENDIF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" )
  22. ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang)
  23. # Now check for C
  24. IF ("${CMAKE_C_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS)
  25. _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs)
  26. SET(CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories")
  27. ENDIF ("${CMAKE_C_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS)
  28. # And now the same for C++
  29. IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS)
  30. _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs)
  31. SET(CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories")
  32. ENDIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS)