On 15.09.10 12:34:43, Nick Davidson wrote:
> Dear List,
> 
> I'm using a file glob to extract a list of xml files to pass to a custom
> target to generate
> a pot file with getttext, most of the heavy lifting is handled by a
> Macro.
> 
> include(FindMsgfmt)
> macro (MakePot BIN_NAME CPP_SOURCES XML_SOURCES)
>      set(CPP_SRCS ${CPP_SOURCES})
>      set(XML_SRCS ${XML_SOURCES})
>      set(POT_FILE ${BIN_NAME}.pot)
>      if (XGETTEXT_FOUND)
>          message(STATUS "Adding Target Potfile: ${POT_FILE}")
>          if (XML_SRCS)
>              add_custom_target(${POT_FILE} ALL
>              COMMAND ${XGETTEXT_EXECUTABLE} --language=C++ --force-po
> -kN_ -kNN_:1,2 -o
>  ${POT_FILE} ${CPP_SRCS}
>              COMMAND ${XGETTEXT_EXECUTABLE} --language=Glade --force-po
> -j -o
>  ${POT_FILE} ${XML_SRCS} )
>          else (XML_SRCS)             add_custom_target(${POT_FILE} ALL
>              COMMAND ${XGETTEXT_EXECUTABLE} --language=C++ --force-po
> -kN_ -kNN_:1,2 -o
>  ${POT_FILE} ${CPP_SRCS})
>          endif(XML_SRCS)
>          add_dependencies(${POT_FILE} ${XML_SOURCES} ${CPP_SRCS})
>      else (XGETTEXT_FOUND)
>          message(STATUS "Cannot find xgettext")
>      endif(XGETTEXT_FOUND)
> endmacro (MakePot POT_NAME) 
> 
> The only problem is, if the list of xml files changes (e.g. a deletion)
> the cmake
> cache doesn't get regenerated and thus the xml files are not reglobbed
> and so the
> custom command fails.
> 
> Any suggestions?

Don't use a glob (list the files individually) or remember to touch the
cmakelists.txt file after adding new files. I don't think there's a way to
have cmake re-run when calling just make within cmakelists.txt.

Andreas

-- 
You will be imprisoned for contributing your time and skill to a bank robbery.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to