diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9361984c69ee3ef97eed17800c5b427b94c6304f..bd50fe6dc623d4aeb7f01343f680741d25bd74f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,7 +87,6 @@ else()
     set(modcc "${MODCC_BIN}")
     set(use_external_modcc ON BOOL)
 endif()
-message("==== modcc: " ${modcc})
 
 include_directories(${CMAKE_SOURCE_DIR}/tclap/include)
 include_directories(${CMAKE_SOURCE_DIR}/vector)
@@ -99,8 +98,10 @@ if( "${WITH_TBB}" STREQUAL "ON" )
     include_directories(${TBB_INCLUDE_DIRS})
 endif()
 
-# TODO : only compile modcc if it is not provided externally
-add_subdirectory(modcc)
+# only compile modcc if it is not provided externally
+if(use_external_modcc)
+    add_subdirectory(modcc)
+endif()
 add_subdirectory(mechanisms)
 add_subdirectory(src)
 add_subdirectory(tests)
diff --git a/mechanisms/CMakeLists.txt b/mechanisms/CMakeLists.txt
index 80925e24320fe3a01d0c2eee24e5494e58ecd14a..46ee6e6d2683b4abe621169d81318684b7285311 100644
--- a/mechanisms/CMakeLists.txt
+++ b/mechanisms/CMakeLists.txt
@@ -21,7 +21,7 @@ foreach(mech ${mechanisms})
     else()
         add_custom_command(
             OUTPUT "${hpp}"
-            DEPENDS modparser "${mod}"
+            DEPENDS "${mod}"
             WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
             COMMAND ${modcc} ${modcc_flags} ${mod} -o ${hpp}
         )
@@ -31,5 +31,5 @@ foreach(mech ${mechanisms})
 endforeach()
 
 # Fake target to always trigger .mod -> .hpp dependencies because wtf CMake
-add_custom_target(build_all_mods DEPENDS ${all_mod_hpps})
+add_custom_target(build_all_mods DEPENDS ${all_mod_hpps} modcc)