On 12/27/2010 12:32 PM, edA-qa mort-ora-y wrote:
> I'm using lupdate/lrelease in QT and trying to have a generated file
> installed. I've hit a few problems that I'm not clear on how they should
> be resolved.
>
> To produce the file I have a chain of commands that ends with:
>
> add_custom_command(
> OUTPUT English.qm
> COMMAND lrelease ${LANG_DIR}/MasterTypes.ts -qm English.qm
> DEPENDS ${LANG_DIR}/MasterTypes.ts
> )
>
> To directly produce this file I add the following target:
>
> add_custom_target( language
> DEPENDS English.qm )
>
> Now "make language" produces the file(s) as I want. I now however need
> to install them. install files won't take a relative path so I've
> specified the following:
>
> install( FILES ${CMAKE_BINARY_DIR}/src/gui/English.qm DESTINATION data/ )
>
> I thought there might be some way to refer to the relative "English.qm"
> file. Is there?
INSTALL(FILES ...) does take relative paths, but they're interpreted
w.r.t. to the current source directory. Regarding files generated at
build time in the binary directories, one should use absolute paths
right from the beginning, e.g.:
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/English.qm
COMMAND lrelease ${LANG_DIR}/MasterTypes.ts
-qm ${CMAKE_CURRENT_BINARY_DIR}/English.qm
DEPENDS ${LANG_DIR}/MasterTypes.ts
)
...
add_custom_target( language
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/English.qm )
> That aside, I need that the install command checks the dependencies on
> the file. As specified it does not, and I don't see a DEPENDS clause for
> install. How do I ensure that the installation updates the file as
> required?
You might use the ALL option of ADD_CUSTOM_TARGET() to incorporate the
language target in CMake's "all" target which, in turn, is built as a
prerequisite of the "install" target. Alternatively, if the language
file should be installed only if the language target has been built
before, you might use the OPTIONAL flag of the INSTALL(FILES ...)
command to avoid the fatal error due to a missing file.
Regards,
Michael
_______________________________________________
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