[CMake] CMake and create/install additional files

Stefan Achatz stefan_achatz at web.de
Wed Oct 31 10:54:07 EDT 2007


Ok, this works.
But why do I give it a dependency, and why do I use make, when this target is 
dull generated everytime i call make?

And why does my first attemt not work?
ADD_CUSTOM_COMMAND should generate the file if it is needed somewhere, 
and 'INSTALL FILES' needs it.

But thanks to you and Marcin Gil for the solution.
Stefan

> Try this:
> ADD_CUSTOM_TARGET(BuildDeMo ALL
>   DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/de.mo"
> )
>
> The custom target will build when "all" builds or when you build it
> specifically. The fact that it depends on the output of the custom
> command will cause the custom command to build whenever the target
> builds...
>
> HTH,
> David
>
> On 10/31/07, Stefan Achatz <stefan_achatz at web.de> wrote:
> > Hello,
> > I'm trying to automate the generation and installation of my gettext
> > object files.
> > This is what I came up with first:
> >
> > ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/de.mo
> >     COMMAND msgfmt --output-file=${CMAKE_CURRENT_BINARY_DIR}/de.mo
> > ${CMAKE_CURRENT_SOURCE_DIR}/de.po
> >     DEPENDENCIES ${CMAKE_CURRENT_SOURCE_DIR}/de.po
> > )
> >
> > INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/de.mo
> >     DESTINATION ${LOCALE_PATH}/de/LC_MESSAGES
> >     RENAME foobar.mo
> > )
> >
> > The problem is, that de.mo doesn't get built so install can't find it.
> > I wanted to put these two commands in a foreach loop to work with
> > multiple languages.
> >
> > How do I get ADD_CUSTOM_COMMAND to build de.mo when I call make?
> >
> > Thanks in advance
> > Stefan
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake




More information about the CMake mailing list