diff --git a/cmake/modules/FindMETIS.cmake b/cmake/modules/FindMETIS.cmake
index fd8029674e31fcc1b62f2be14dc22d0a2ffa008a..fbbe35cb518fc6ab645648502a389e6d454e783e 100644
--- a/cmake/modules/FindMETIS.cmake
+++ b/cmake/modules/FindMETIS.cmake
@@ -48,7 +48,7 @@ find_library(METIS_LIBRARY ${METIS_LIB_NAME}
 )
 
 # we need to check whether we need to link m, copy the lazy solution from FindBLAS and FindLAPACK here.
-if(NOT WIN32)
+if(METIS_LIBRARY AND NOT WIN32)
   list(APPEND METIS_LIBRARY "-lm")
 endif()