Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow ns3 to be idempotent if correctly patched
[simgrid.git] / tools / cmake / Modules / FindNS3.cmake
index 7154c2b..12722f9 100644 (file)
@@ -126,8 +126,18 @@ else()
   endforeach()
 endif()
 
+set(SIMGRID_HAVE_NS3_GetNextEventTime FALSE)
 if(SIMGRID_HAVE_NS3)
-  message(STATUS "ns-3 found (v${NS3_VERSION}; minor:${NS3_MINOR_VERSION}; patch:${NS3_PATCH_VERSION}; libpath: ${NS3_LIBRARY_PATH}).")
+  try_compile(compile_ns3 ${CMAKE_BINARY_DIR} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_ns3.cpp
+              LINK_LIBRARIES "${NS3_LIBRARIES}"
+              OUTPUT_VARIABLE compile_ns3_output)
+  if(NOT compile_ns3)
+    message(STATUS "ns-3 does not have the ns3::Simulator::GetNextEventTime patch. The ns-3 model will not be idempotent. Compilation output:\n ${compile_ns3_output}")
+  else()
+    set(SIMGRID_HAVE_NS3_GetNextEventTime TRUE)
+  endif()
+  file(REMOVE ${CMAKE_BINARY_DIR}/prog_ns3)
+  message(STATUS "ns-3 found (v${NS3_VERSION}; minor ver:${NS3_MINOR_VERSION}; patch ver:${NS3_PATCH_VERSION}; GetNextEventTime patch: ${SIMGRID_HAVE_NS3_GetNextEventTime}; libpath: ${NS3_LIBRARY_PATH}).")
   link_directories(${NS3_LIBRARY_PATH})
   include_directories(${NS3_INCLUDE_DIR})
 else()