Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to recompile automatonparse_promela.c at each build (maintainer mode).
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 26 Jun 2012 21:38:03 +0000 (23:38 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 26 Jun 2012 21:38:03 +0000 (23:38 +0200)
buildtools/Cmake/MaintainerMode.cmake

index cc76eba..26d587d 100644 (file)
@@ -9,15 +9,29 @@ if(enable_maintainer_mode AND NOT WIN32)
   mark_as_advanced(LEX_EXE)
 
   if(BISON_EXE AND LEX_EXE)
   mark_as_advanced(LEX_EXE)
 
   if(BISON_EXE AND LEX_EXE)
-    add_custom_target(automaton_generated_src ALL
-      DEPENDS ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.lex
+    add_custom_command(
+      OUTPUT
+      ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/automaton_lexer.yy.c
+      ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.cacc
+      ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.hacc
+
+      DEPENDS
+      ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.lex
       ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.yacc
       ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.yacc
+
       COMMENT "Generating automaton source files"
       COMMAND ${BISON_EXE} --name-prefix=xbt_automaton_parser_ -d parserPromela.yacc
       COMMAND ${LEX_EXE} --prefix=xbt_automaton_parser_ --outfile=automaton_lexer.yy.c parserPromela.lex
       WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/
       )
 
       COMMENT "Generating automaton source files"
       COMMAND ${BISON_EXE} --name-prefix=xbt_automaton_parser_ -d parserPromela.yacc
       COMMAND ${LEX_EXE} --prefix=xbt_automaton_parser_ --outfile=automaton_lexer.yy.c parserPromela.lex
       WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/
       )
 
+    add_custom_target(automaton_generated_src
+      DEPENDS
+      ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/automaton_lexer.yy.c
+      ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.cacc
+      ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.hacc
+      )
+
     SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
       "${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.cacc;${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.hacc;${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/automaton_parse.yy.c"
       )
     SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
       "${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.cacc;${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.tab.hacc;${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/automaton_parse.yy.c"
       )