FindCFD.cmake 1018 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # 防止重复引用
  2. if(CFD_ALREADY_INCLUDED)
  3. return()
  4. endif()
  5. set(CFD_ALREADY_INCLUDED 1)
  6. # find_path 搜索包含某个文件的路径
  7. # 如果在某个路径下发现了该文件,该结果会被存储到该变量中;如果没有找到,存储的结果将会是<VAR>-NOTFOUND
  8. find_path(CFD_DIRS
  9. NAMES
  10. DUBHE.exe
  11. PATHS
  12. ${CMAKE_SOURCE_DIR}/extlib/CFD
  13. NO_SYSTEM_ENVIRONMENT_PATH
  14. NO_CMAKE_SYSTEM_PATH
  15. )
  16. # CFD版本号设置
  17. set(CFD_VERSION_MAJOR 1)
  18. set(CFD_VERSION_MINOR 0)
  19. set(CFD_VERSION_PATCH 0)
  20. set(CFD_VERSION "${CFD_VERSION_MAJOR}.${CFD_VERSION_MINOR}.${CFD_VERSION_PATCH}")
  21. if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
  22. set(CFD_EXECUTABLE "${CFD_DIRS}/DUBHE.exe")
  23. endif()
  24. include(FindPackageHandleStandardArgs)
  25. # 如果找到所有需要的变量,并且版本匹配,则将CFD_FOUND变量设置为TRUE
  26. find_package_handle_standard_args(CFD
  27. FOUND_VAR
  28. CFD_FOUND
  29. REQUIRED_VARS
  30. CFD_DIRS
  31. CFD_EXECUTABLE
  32. VERSION_VAR
  33. CFD_VERSION
  34. )