[CMake] how to define a target that will be run on request only, and always on install?
Timenkov Yuri
ytimenkov at parallels.com
Mon Mar 31 09:43:59 EDT 2008
On Monday 31 March 2008 17:31:56 Crni Gorac wrote:
> On Mon, Mar 31, 2008 at 8:03 AM, Timenkov Yuri <ytimenkov at parallels.com>
wrote:
> > You may try to add install(SCRIPT/CODE) command which ensures that
> > translations are built.
> >
> > install(code "
> > execute_process(
> > COMMAND \${CMAKE_MAKE_PROGRAM} translations
> > WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
> > )
> > FILE(INSTALL
> > DESTINATION translations
> > TYPE FILE
> > FILES \"${CMAKE_CURRENT_BINARY_DIR}/foo.trans\")
> > ")
> >
> > This may work only on linux / or only with make program.
>
> Seems like nice idea, but - if I understand relevant section (it's
> "NOTE:" paragraph at the end of INSTALL command description in CMake
> man page) of CMake documentation, there is no guarantee that "make
> translations", defined as above, will be executed before installing
> "foo.trans" file, right?
Not exactly. I suppose (as I could understand from sources) that relative
order or install(target|files|programs) commands is not defined.
install(code|script) are always placed to the beginning of
cmake_install.cmake file (Look at one in build directory).
Therefore I placed execute_process into install(code "") command. This script
is always executed in order, so you will have built translations after first
statement executed, and the second one - is similar to one cmake puts into
cmake_install.cmake files when generates installation script from install()
commands.
Hard to explain simply :) Better, look into generated cmake_install.cmake
files, this should make problem more clear.
>
> Regards.
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list