123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- # 防止重复引入
- if(Gmsh_ALREADY_INCLUDED)
- return()
- endif()
- set(Gmsh_ALREADY_INCLUDED 1)
- # find_path 搜索包含某个文件的路径
- # 如果在某个路径下发现了该文件,该结果会被存储到该变量中;如果没有找到,存储的结果将会是<VAR>-NOTFOUND
- find_path(Gmsh_DIRS
- NAMES
- include/gmsh.h
- PATHS
- ${CMAKE_SOURCE_DIR}/extlib/Gmsh
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH
- )
- set(Gmsh_VERSION_MAJOR 4)
- set(Gmsh_VERSION_MINOR 11)
- set(Gmsh_VERSION_PATCH 1)
- set(Gmsh_VERSION "${Gmsh_VERSION_MAJOR}.${Gmsh_VERSION_MINOR}.${Gmsh_VERSION_PATCH}")
- find_path(Gmsh_INCLUDE_DIRS
- NAMES
- gmsh.h
- HINTS
- ${Gmsh_DIRS}/include
- )
- find_path(Gmsh_LIBRARY_DIRS
- NAMES
- gmsh.lib
- HINTS
- ${Gmsh_DIRS}/bin
- )
- find_path(Gmsh_BINARY_DIRS
- NAMES
- gmsh-4.12.dll
- HINTS
- ${Gmsh_DIRS}/bin
- )
- set(Gmsh_LIBRARIES GJDM::Gmsh)
- add_library(GJDM::Gmsh SHARED IMPORTED)
- set_property(TARGET GJDM::Gmsh PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Gmsh_INCLUDE_DIRS})
- set_property(TARGET GJDM::Gmsh APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
- set_property(TARGET GJDM::Gmsh APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(GJDM::Gmsh PROPERTIES
- IMPORTED_IMPLIB_DEBUG "${Gmsh_DIRS}/bin/gmsh.lib"
- IMPORTED_LOCATION_DEBUG "${Gmsh_DIRS}/bin/gmsh-4.12.dll"
- IMPORTED_IMPLIB_RELEASE "${Gmsh_DIRS}/bin/gmsh.lib"
- IMPORTED_LOCATION_RELEASE "${Gmsh_DIRS}/bin/gmsh-4.12.dll"
- )
- # if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- # set(Gmsh_EXECUTABLE "${Gmsh_DIRS}/bin/gmsh.exe")
- # else()
- # set(Gmsh_EXECUTABLE "${Gmsh_DIRS}/bin/gmsh")
- # endif()
- include(FindPackageHandleStandardArgs)
- # 如果找到所有需要的变量,并且版本匹配,则将Gmsh_FOUND变量设置为TRUE
- find_package_handle_standard_args(Gmsh
- FOUND_VAR
- Gmsh_FOUND
- REQUIRED_VARS
- Gmsh_DIRS
- Gmsh_INCLUDE_DIRS
- Gmsh_BINARY_DIRS
- Gmsh_LIBRARY_DIRS
- # Gmsh_EXECUTABLE
- Gmsh_LIBRARIES
- VERSION_VAR
- Gmsh_VERSION
- )
|