# 防止重复引用 if(IR_ALREADY_INCLUDED) return() endif() set(IR_ALREADY_INCLUDED 1) # find_path 搜索包含某个文件的路径 # 如果在某个路径下发现了该文件,该结果会被存储到该变量中;如果没有找到,存储的结果将会是-NOTFOUND find_path(IR_DIRS NAMES Optical-RMC-Code.exe IFIRFlowPointFDLL.dll IFIRFlowPointFDLL.lib PATHS ${CMAKE_SOURCE_DIR}/extlib/IR NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH ) # IR版本号设置 set(IR_VERSION_MAJOR 1) set(IR_VERSION_MINOR 0) set(IR_VERSION_PATCH 0) set(IR_VERSION "${IR_VERSION_MAJOR}.${IR_VERSION_MINOR}.${IR_VERSION_PATCH}") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(IR_EXECUTABLE "${IR_DIRS}/Optical-RMC-Code.exe") endif() include(FindPackageHandleStandardArgs) # 如果找到所有需要的变量,并且版本匹配,则将IR_FOUND变量设置为TRUE find_package_handle_standard_args(IR FOUND_VAR IR_FOUND REQUIRED_VARS IR_DIRS IR_EXECUTABLE VERSION_VAR IR_VERSION )