[CMake] qt4_create_translation and add_dependencies

Paul Harris harris.pc at gmail.com
Tue Oct 14 03:02:27 EDT 2008


Hi,

I am trying to get cmake to execute the translations command without
success...

Originally I just had an install(FILES etc) command (see below) but make
would complain:

> make ...
build build build...
Install the project...
-- Install configuration: "Debug"
CMake Error at cmake_install.cmake:36 (FILE):
  file INSTALL cannot find file
  "/builddir/app_fr.qm" to
  install.

So I tried to add in dependencies to force the command to execute:


I have a root CMakeLists.txt:
---------------------------------
set (FILES_TO_TRANSLATE )
add_custom_target (translations_target)

add_subdirectory(app_library)
add_subdirectory(app_executable)

file (GLOB TRANSLATIONS_FILES translations/*.ts)
qt4_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
add_dependencies(translations_target ${QM_FILES})
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/translations)
---------------------------------

and in app_library/CMakeLists.txt
---------------------
file (GLOB CPPFILES *.cpp)
set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${CPPFILES} PARENT_SCOPE)
------------------

and in app_executable/CMakeLists.txt
----------------
add_executable(myapp main.cpp)
add_dependencies(myapp translations_target)
--------------

The FILES_TO_TRANSLATE has the right files once it gets to the
qt4_create_translation() command.

It seems that the lrelease command is never executed, the .qm file is never
generated and thus there is no .qm file to install.

any ideas on how I can figure this out?

thanks,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081014/1b272142/attachment.htm>


More information about the CMake mailing list