init_cache_settings.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. if (__init_cache_settings_included)
  2. return ()
  3. endif ()
  4. set ( __init_cache_settings_included YES )
  5. if (DEFINED ENV{DIAGNOSTIC})
  6. set ( DIAGNOSTIC "$ENV{DIAGNOSTIC}" )
  7. endif ()
  8. if (DIAGNOSTIC)
  9. set ( CMAKE_MESSAGE_LOG_LEVEL DEBUG )
  10. endif ()
  11. if (DEFINED ENV{LIBS_BUNDLE})
  12. set ( LIBS_BUNDLE "$ENV{LIBS_BUNDLE}" )
  13. endif ()
  14. if (DEFINED ENV{WIN_BUNDLE})
  15. set ( WIN_BUNDLE "$ENV{WIN_BUNDLE}" )
  16. endif ()
  17. if (NOT LIBS_BUNDLE)
  18. get_filename_component ( LIBS_BUNDLE "${MANTICORE_SOURCE_DIR}/../bundle" ABSOLUTE )
  19. endif ()
  20. if (NOT IS_ABSOLUTE ${LIBS_BUNDLE})
  21. set ( LIBS_BUNDLE "${MANTICORE_BINARY_DIR}/${LIBS_BUNDLE}" )
  22. endif ()
  23. if (NOT WIN_BUNDLE)
  24. SET ( WIN_BUNDLE "${LIBS_BUNDLE}" )
  25. endif ()
  26. SET ( LIBS_BUNDLE "${LIBS_BUNDLE}" CACHE PATH "Choose the path to the dir which contains downloaded sources for libs like re2, icu, stemmer, etc." FORCE )
  27. SET ( WIN_BUNDLE "${WIN_BUNDLE}" CACHE PATH "Choose the path to the dir which contains win builds of libs like expat, mysql, etc." FORCE )
  28. if (DEFINED ENV{CACHEB})
  29. set ( CACHEB "$ENV{CACHEB}" )
  30. endif ()
  31. if (NOT DEFINED CACHEB)
  32. get_filename_component ( CACHEB "${LIBS_BUNDLE}/../cache" ABSOLUTE )
  33. endif ()
  34. if (NOT IS_ABSOLUTE ${CACHEB})
  35. set ( CACHEB "${MANTICORE_BINARY_DIR}/${CACHEB}" )
  36. endif ()
  37. if (DEFINED CACHEB)
  38. SET ( CACHEB "${CACHEB}" CACHE PATH "Cache dir where unpacked sources and builds found." )
  39. endif ()
  40. # this macro is need for cross-compiling. If we just add path to CMAKE_PREFIX_PATH, it will NOT work with active root path,
  41. # if search strategy set to 'only'. So, we add path to the root path in this case instead.
  42. macro ( PREPEND_PREFIX PATH )
  43. if (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE STREQUAL ONLY)
  44. diags ( "CMAKE_FIND_ROOT_PATH was ${CMAKE_FIND_ROOT_PATH}" )
  45. list ( REMOVE_ITEM CMAKE_FIND_ROOT_PATH "${PATH}" )
  46. list ( PREPEND CMAKE_FIND_ROOT_PATH "${PATH}" )
  47. diags ( "CMAKE_FIND_ROOT_PATH was renewed and became ${CMAKE_FIND_ROOT_PATH}" )
  48. # endif ()
  49. else ()
  50. diags ( "CMAKE_PREFIX_PATH was ${CMAKE_PREFIX_PATH}" )
  51. list ( REMOVE_ITEM CMAKE_PREFIX_PATH "${PATH}" )
  52. list ( PREPEND CMAKE_PREFIX_PATH "${PATH}" )
  53. diags ( "CMAKE_PREFIX_PATH was renewed and became ${CMAKE_PREFIX_PATH}" )
  54. endif ()
  55. endmacro ()