-
Notifications
You must be signed in to change notification settings - Fork 7
/
FindGmsh.cmake
48 lines (44 loc) · 1.77 KB
/
FindGmsh.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#############################################################
# Try to find Gmsh #
# #
# Once done this will define: #
# GMSH_FOUND - system has Gmsh #
# GMSH_DIR - Gmsh directory #
# GMSH_INC - Gmsh include directory #
# GMSH_LIB - Gmsh library (static or dynamic) #
# #
# Usage: #
# find_package( GMSH ) #
# #
# Setting these changes the behavior of the search #
# GMSH_DIR - Gmsh directory #
#############################################################
## Try to set GMSH_DIR ##
##########################
if(NOT DEFINED GMSH_DIR)
set(GMSH_DIR $ENV{GMSH_DIR})
endif()
## Includes ##
##############
if(EXISTS "${GMSH_DIR}/include")
set(GMSH_INC "${GMSH_DIR}/include")
else()
message(SEND_ERROR "GMSH includes not found")
endif()
## Library ##
#############
if(EXISTS "${GMSH_DIR}/lib/libgmsh.so")
set(GMSH_LIB "${GMSH_DIR}/lib/libgmsh.so")
elseif(EXISTS "${GMSH_DIR}/lib/libgmsh.a")
set(GMSH_LIB "${GMSH_DIR}/lib/libgmsh.a")
elseif(EXISTS "${GMSH_DIR}/lib/libgmsh.dylib")
set(GMSH_LIB "${GMSH_DIR}/lib/libgmsh.dylib")
else()
message(SEND_ERROR "GMSH library not found")
endif()
## CMake check and done ##
##########################
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gmsh
"GMSH could not be found: be sure to set GMSH_DIR in your environment variables"
GMSH_LIB GMSH_INC GMSH_DIR)