[CMake] qt4_create_translation and add_dependencies

Clinton Stimpson clinton at elemtech.com
Tue Oct 14 12:13:35 EDT 2008


Try something like this:

add_subdirectory(app_library)

file (GLOB TRANSLATIONS_FILES translations/*.ts)
qt4_create_translation(QM_FILES ${FILES_TO_TRANSLATE} $ 
{TRANSLATIONS_FILES})
add_custom_target (translations_target DEPENDS ${QM_FILES})

add_subdirectory(app_executable)


On Oct 14, 2008, at 1:02 AM, Paul Harris wrote:

> 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
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list