diff --git a/NPLib/TrackReconstruction/CMakeLists.txt b/NPLib/TrackReconstruction/CMakeLists.txt
index f3331bda3ad2bc698c32ecc4e56bcbd0e4985fea..28062a601a3365c72f980b5385bf149a3b00a47d 100644
--- a/NPLib/TrackReconstruction/CMakeLists.txt
+++ b/NPLib/TrackReconstruction/CMakeLists.txt
@@ -4,8 +4,22 @@ add_custom_command(OUTPUT NPClusterDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/
 
 add_custom_command(OUTPUT TrackingDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh Tracking.h TrackingDict.cxx Tracking.rootmap libNPTrackReconstruction.so NPTrackReconstructionLinkDef.h DEPENDS Tracking.h)
 
+## Check if MINUIT2 is installed along with ROOT
+find_library(libMinuit2_FOUND NAMES Minuit2 HINTS "${ROOTSYS}/lib")
+if(libMinuit2_FOUND)
+  message(STATUS "Minuit2 support enabled for TrackReconstruction.")
+  add_definitions(-DHAVE_MINUIT2)
+else()
+  message(STATUS "Minuit2 support disabled for TrackReconstruction.")
+endif()      
+
+
 add_library(NPTrackReconstruction SHARED NPRansac.cxx NPCluster.cxx NPTrack.cxx Tracking.cxx NPRansacDict.cxx NPClusterDict.cxx TrackingDict.cxx NPDCReconstruction.cxx NPDCReconstructionMT.cxx)
 
+if(Minuit2_FOUND)
 target_link_libraries(NPTrackReconstruction ${ROOT_LIBRARIES} -lMinuit2 NPCore)
+else()
+target_link_libraries(NPTrackReconstruction ${ROOT_LIBRARIES} NPCore)
+endif()
 
 install(FILES NPRansac.h NPCluster.h NPTrack.h Tracking.h NPTrackingUtility.h NPDCReconstruction.h NPDCReconstructionMT.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})