123456789101112131415161718192021222324252627282930313233343536373839 |
- # 防止重复引用
- if(CFD_ALREADY_INCLUDED)
- return()
- endif()
- set(CFD_ALREADY_INCLUDED 1)
- # find_path 搜索包含某个文件的路径
- # 如果在某个路径下发现了该文件,该结果会被存储到该变量中;如果没有找到,存储的结果将会是<VAR>-NOTFOUND
- find_path(CFD_DIRS
- NAMES
- DUBHE.exe
- PATHS
- ${CMAKE_SOURCE_DIR}/extlib/CFD
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH
- )
- # CFD版本号设置
- set(CFD_VERSION_MAJOR 1)
- set(CFD_VERSION_MINOR 0)
- set(CFD_VERSION_PATCH 0)
- set(CFD_VERSION "${CFD_VERSION_MAJOR}.${CFD_VERSION_MINOR}.${CFD_VERSION_PATCH}")
- if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- set(CFD_EXECUTABLE "${CFD_DIRS}/DUBHE.exe")
- endif()
- include(FindPackageHandleStandardArgs)
- # 如果找到所有需要的变量,并且版本匹配,则将CFD_FOUND变量设置为TRUE
- find_package_handle_standard_args(CFD
- FOUND_VAR
- CFD_FOUND
- REQUIRED_VARS
- CFD_DIRS
- CFD_EXECUTABLE
- VERSION_VAR
- CFD_VERSION
- )
|