cmake: Fix dependencies for code generation. (#2524)
authorMathias Preiner <mathias.preiner@gmail.com>
Tue, 25 Sep 2018 01:42:32 +0000 (18:42 -0700)
committerAndres Noetzli <andres.noetzli@gmail.com>
Tue, 25 Sep 2018 01:42:32 +0000 (18:42 -0700)
src/base/CMakeLists.txt
src/expr/CMakeLists.txt
src/theory/CMakeLists.txt

index 0b0da4eee6e5877557d526501be660e6c5679fe4..94ef981263901f70c31aca93c6a950adf7bd2412 100644 (file)
@@ -73,15 +73,17 @@ file(GLOB_RECURSE source_files
      ${PROJECT_SOURCE_DIR}/src/*.g)
 string(REPLACE ";" " " source_files_list "${source_files}")
 
-add_custom_command(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
+# Note: {Debug,Trace}_tags.tmp are targets since we always want to generate
+# the temporary tag files in order to check if anything changed.
+add_custom_target(
+  Debug_tags.tmp
   COMMAND
     ${gentmptags_script} ${CMAKE_CURRENT_LIST_DIR} Debug ${source_files_list}
   DEPENDS mktags
 )
 
-add_custom_command(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
+add_custom_target(
+  Trace_tags.tmp
   COMMAND
     ${gentmptags_script} ${CMAKE_CURRENT_LIST_DIR} Trace ${source_files_list}
   DEPENDS mktags
@@ -90,13 +92,13 @@ add_custom_command(
 add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags
   COMMAND ${gentags_script} Debug
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
+  DEPENDS Debug_tags.tmp
 )
 
 add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags
   COMMAND ${gentags_script} Trace
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
+  DEPENDS Trace_tags.tmp
 )
 
 add_custom_command(
index 6a06bc8ed24a7768d571ce8bd6ca143bb8068894..35ef34dfa585dc90e72218731c89e2e93ee1abc9 100644 (file)
@@ -77,7 +77,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/kind_template.h
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/kind.h
-  DEPENDS mkkind kind_template.h
+  DEPENDS mkkind kind_template.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -87,7 +87,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/kind_template.cpp
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/kind.cpp
-  DEPENDS mkkind kind_template.cpp kind.h
+  DEPENDS mkkind kind_template.cpp kind.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -97,7 +97,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/type_properties_template.h
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/type_properties.h
-  DEPENDS mkkind type_properties_template.h
+  DEPENDS mkkind type_properties_template.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -107,7 +107,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/metakind_template.h
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/metakind.h
-  DEPENDS mkmetakind metakind_template.h
+  DEPENDS mkmetakind metakind_template.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -117,7 +117,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/metakind_template.cpp
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/metakind.cpp
-  DEPENDS mkmetakind metakind_template.cpp metakind.h
+  DEPENDS mkmetakind metakind_template.cpp metakind.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -127,7 +127,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/expr_template.h
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/expr.h
-  DEPENDS mkexpr expr_template.h kind.h
+  DEPENDS mkexpr expr_template.h kind.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -137,7 +137,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/expr_template.cpp
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/expr.cpp
-  DEPENDS mkexpr expr_template.cpp expr.h
+  DEPENDS mkexpr expr_template.cpp expr.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -147,7 +147,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/expr_manager_template.h
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/expr_manager.h
-  DEPENDS mkexpr expr_manager_template.h expr.h
+  DEPENDS mkexpr expr_manager_template.h expr.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -157,7 +157,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/expr_manager_template.cpp
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/expr_manager.cpp
-  DEPENDS mkexpr expr_manager_template.cpp expr_manager.h
+  DEPENDS mkexpr expr_manager_template.cpp expr_manager.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -167,7 +167,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/type_checker_template.cpp
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/type_checker.cpp
-  DEPENDS mkexpr type_checker_template.cpp
+  DEPENDS mkexpr type_checker_template.cpp ${KINDS_FILES}
 )
 
 add_custom_target(gen-expr
index 028cb35040ba135fac356172064a9cf46b94e077..4c2f66a0e54a125db7245976e4426aea0fce47db 100644 (file)
@@ -14,7 +14,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/rewriter_tables_template.h
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/rewriter_tables.h
-  DEPENDS mkrewriter rewriter_tables_template.h
+  DEPENDS mkrewriter rewriter_tables_template.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -24,7 +24,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/theory_traits_template.h
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/theory_traits.h
-  DEPENDS mktheorytraits theory_traits_template.h
+  DEPENDS mktheorytraits theory_traits_template.h ${KINDS_FILES}
 )
 
 add_custom_command(
@@ -34,7 +34,7 @@ add_custom_command(
     ${CMAKE_CURRENT_LIST_DIR}/type_enumerator_template.cpp
     ${KINDS_FILES}
     > ${CMAKE_CURRENT_BINARY_DIR}/type_enumerator.cpp
-  DEPENDS mktheorytraits type_enumerator_template.cpp
+  DEPENDS mktheorytraits type_enumerator_template.cpp ${KINDS_FILES}
 )
 
 add_custom_target(gen-theory