FindVTK.cmake 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #
  2. # Find the native VTK includes and library
  3. #
  4. # This module defines:
  5. #
  6. # VTK_INSTALL_PATH - Where is the installed version of VTK.
  7. # USE_BUILT_VTK - Should a built-from-source version of VTK be used.
  8. #
  9. # VTK_BINARY_PATH - Where is (one of) the binary tree(s).
  10. # USE_INSTALLED_VTK - Should an installed version of VTK be used
  11. #
  12. # USE_VTK_FILE - (internal)
  13. # Full path and location to the UseVTK.cmake file.
  14. # This value changes each time USE_BUILT_VTK or
  15. # USE_INSTALLED_VTK is modified, and only if ONE of
  16. # these setting is set to ON.
  17. #
  18. # If VTK is not found, an error is displayed unless VTK_FIND_QUIETLY
  19. # is on.
  20. #
  21. #
  22. # Look for a binary tree (built from source)
  23. #
  24. FIND_PATH(VTK_BINARY_PATH UseVTK.cmake
  25. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
  26. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
  27. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
  28. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
  29. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
  30. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
  31. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
  32. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
  33. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
  34. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
  35. VTKBIN
  36. ../VTKBIN
  37. ../../VTKBIN
  38. $ENV{HOME}/VTKBIN
  39. VTK-bin
  40. ../VTK-bin
  41. ../../VTK-bin
  42. $ENV{HOME}/VTK-bin
  43. vtkbin
  44. ../vtkbin
  45. ../../vtkbin
  46. $ENV{HOME}/vtkbin
  47. VTK-vc
  48. ../VTK-vc
  49. ../../VTK-vc
  50. $ENV{HOME}/VTK-vc
  51. VTK-nmake
  52. ../VTK-nmake
  53. ../../VTK-nmake
  54. $ENV{HOME}/VTK-nmake
  55. )
  56. #
  57. # If we found a built tree, USE_BUILT_VTK allows the user to
  58. # use it or not. Defaults to ON.
  59. #
  60. IF (VTK_BINARY_PATH)
  61. SET (USE_BUILT_VTK 1 CACHE BOOL
  62. "Use a built (versus installed) version of VTK. Be sure that VTK_BINARY_PATH is correct.")
  63. ENDIF (VTK_BINARY_PATH)
  64. #
  65. # Look for an installed tree
  66. #
  67. FIND_PATH(VTK_INSTALL_PATH include/vtk/UseVTK.cmake
  68. /usr/local
  69. /usr
  70. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\Nightly]
  71. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\43]
  72. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\42]
  73. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\41]
  74. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\40]
  75. )
  76. #
  77. # If we found an installed tree, USE_INSTALLED_VTK allows the user to
  78. # use it or not.
  79. #
  80. # Defaults to OFF if a built tree was found before (see above), ON otherwise.
  81. #
  82. IF (VTK_INSTALL_PATH)
  83. IF (USE_BUILT_VTK)
  84. SET (USE_INSTALLED_VTK 0 CACHE BOOL
  85. "Use an installed (versus built from source) version of VTK. Be sure that VTK_INSTALL_PATH is correct.")
  86. ELSE (USE_BUILT_VTK)
  87. SET (USE_INSTALLED_VTK 1 CACHE BOOL
  88. "Use an installed (versus built from source) version of VTK. Be sure that VTK_INSTALL_PATH is correct.")
  89. ENDIF (USE_BUILT_VTK)
  90. ENDIF (VTK_INSTALL_PATH)
  91. #
  92. # Set the USE_VTK_FILE only if one of USE_BUILT_VTK or USE_INSTALLED_VTK
  93. # is ON.
  94. #
  95. IF (USE_BUILT_VTK)
  96. IF (NOT USE_INSTALLED_VTK)
  97. IF (EXISTS "${VTK_BINARY_PATH}/UseVTK.cmake")
  98. SET (USE_VTK_FILE "${VTK_BINARY_PATH}/UseVTK.cmake")
  99. ENDIF (EXISTS "${VTK_BINARY_PATH}/UseVTK.cmake")
  100. ENDIF (NOT USE_INSTALLED_VTK)
  101. ELSE (USE_BUILT_VTK)
  102. IF (USE_INSTALLED_VTK)
  103. IF (EXISTS "${VTK_INSTALL_PATH}/include/vtk/UseVTK.cmake")
  104. SET (USE_VTK_FILE "${VTK_INSTALL_PATH}/include/vtk/UseVTK.cmake")
  105. ENDIF (EXISTS "${VTK_INSTALL_PATH}/include/vtk/UseVTK.cmake")
  106. ENDIF (USE_INSTALLED_VTK)
  107. ENDIF (USE_BUILT_VTK)
  108. #
  109. # Display a warning if both settings are set to ON.
  110. # Otherwise display a warning if VTK was not found.
  111. #
  112. IF (USE_BUILT_VTK AND USE_INSTALLED_VTK)
  113. MESSAGE ("Warning. Please make sure that only ONE of the USE_INSTALLED_VTK or USE_BUILT_VTK setting is set to ON.")
  114. ELSE (USE_BUILT_VTK AND USE_INSTALLED_VTK)
  115. IF (NOT USE_VTK_FILE)
  116. IF (NOT VTK_FIND_QUIETLY)
  117. MESSAGE ("Warning. VTK might be found on your system as different flavours: installed VTK or built VTK. Please make sure that the VTK_INSTALL_PATH or VTK_BINARY_PATH setting reflects which VTK you are planning to use, then set ONE of the USE_INSTALLED_VTK or USE_BUILT_VTK setting to ON.")
  118. ENDIF (NOT VTK_FIND_QUIETLY)
  119. ENDIF (NOT USE_VTK_FILE)
  120. ENDIF (USE_BUILT_VTK AND USE_INSTALLED_VTK)
  121. # Note:
  122. #
  123. # If you use that module then you are probably relying on VTK to be found
  124. # on your system. Here is the CMake code you might probably want to use to
  125. # work hand-in-hand with that module (in that example CAN_BUILD is a var
  126. # that is set to 0 if your project can not be build):
  127. #
  128. # INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
  129. #
  130. # IF (USE_VTK_FILE)
  131. # INCLUDE (${USE_VTK_FILE})
  132. # ELSE (USE_VTK_FILE)
  133. # SET (CAN_BUILD 0)
  134. # ENDIF (USE_VTK_FILE)