GET_FILENAME_COMPONENT(GMSH_INCLUDE_DIRS_UP ${GMSH_INCLUDE_DIRS} DIRECTORY)
LIST(APPEND GMSH_INCLUDE_DIRS "${GMSH_INCLUDE_DIRS_UP}")
ENDIF()
-FIND_LIBRARY(GMSH_LIBRARIES NAMES Gmsh gmsh gmshd)
+IF(WIN32 AND CMAKE_BUILD_TYPE STREQUAL Debug)
+ FIND_LIBRARY(GMSH_LIBRARIES NAMES gmshd)
+ELSE()
+ FIND_LIBRARY(GMSH_LIBRARIES NAMES Gmsh gmsh gmshd)
+ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMSH REQUIRED_VARS GMSH_INCLUDE_DIRS GMSH_LIBRARIES)