-#IF YOU HAVE INSTALL SIMGRID IN A SPECIAL DIRECTORY
-#YOU CAN SPECIFY SIMGRID_ROOT OR GRAS_ROOT
-
-# TO CALL THIS FILE USE
- #set(CMAKE_MODULE_PATH
- #${CMAKE_MODULE_PATH}
- #${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules
- #)
-
-find_library(HAVE_SIMGRID_LIB
- NAME simgrid
- HINTS
- $ENV{LD_LIBRARY_PATH}
- $ENV{GRAS_ROOT}
- $ENV{SIMGRID_ROOT}
- PATH_SUFFIXES lib64 lib
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
+# Cmake macro to search for the SimGrid library.
+
+# Copyright (c) 2016. The SimGrid Team (version 20161210).
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the license (GNU LGPL) which comes with this package.
+
+# The user can hint a path using the SimGrid_PATH option.
+#
+# Once done, the following will be defined:
+#
+# SimGrid_INCLUDE_DIR - the SimGrid include directories
+# SimGrid_LIBRARY - link your simulator against it to use SimGrid
+#
+# Afterward, you should probably do the following:
+#
+# include_directories("${SimGrid_INCLUDE_DIR}" SYSTEM)
+# target_link_libraries(your-simulator ${SimGrid_LIBRARY})
+#
+# This could be improved in many ways (patches welcome):
+# - Not finding SimGrid is fatal. But who would want to
+# overcome such a desperate situation anyway? ;)
+# - No way to specify a minimal version
+# - No proper find_package() integration
+
+set(SimGrid_PATH ${SimGrid_PATH} CACHE PATH "Path to SimGrid library and include")
+find_path(SimGrid_INCLUDE_DIR
+ NAMES simgrid_config.h
+ HINTS ${SimGrid_PATH}/include /usr/include /usr/local/include /opt/simgrid/include