-include(FindSimGrid.cmake)
-
-#########
-# FLAGS #
-#########
-set(INCLUDE_PATH "-I$ENV{SIMGRID_ROOT}/include -I$ENV{SIMGRID_ROOT}/src -I$ENV{SIMGRID_ROOT}/src/include")
-set(LIB_PATH "-L$ENV{SIMGRID_ROOT}/lib")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${INCLUDE_PATH} ${LIB_PATH}")
+include(FindPCRE.cmake)
+message(STATUS "Looking for lib Simgrid")
+if("$ENV{SIMGRID_ROOT}" STREQUAL "")
+ message(STATUS "Looking for lib Simgrid - Not found")
+ message(FATAL_ERROR "Simgrid not found, reinstall it or set SIMGRID_ROOT")
+else("$ENV{SIMGRID_ROOT}" STREQUAL "")
+ link_directories($ENV{SIMGRID_ROOT}/lib)
+ include_directories($ENV{SIMGRID_ROOT}/include)
+ include_directories($ENV{SIMGRID_ROOT}/src)
+ include_directories($ENV{SIMGRID_ROOT}/src/include)
+ add_library(libsimgrid STATIC IMPORTED)
+ message(STATUS "Looking for lib Simgrid - found")
+endif("$ENV{SIMGRID_ROOT}" STREQUAL "")