From 15585340c38df8b764f4d51897a2e884cbb5d326 Mon Sep 17 00:00:00 2001
From: bcumming <bcumming@cscs.ch>
Date: Tue, 4 Oct 2016 10:26:10 +0200
Subject: [PATCH] fixed modcc->hpp dependencies

---
 CMakeLists.txt            | 7 ++++---
 mechanisms/CMakeLists.txt | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9361984c..bd50fe6d 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 80925e24..46ee6e6d 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)
 
-- 
GitLab