MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0014904 | CMake | Modules | public | 2014-05-05 10:16 | 2016-06-10 14:31 |
Reporter | Aurélien Gâteau | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | OS | OS Version | |||
Product Version | CMake 2.8.12.2 | ||||
Target Version | Fixed in Version | ||||
Summary | 0014904: Gettext module does not allow installing .po files with the same name from different directories | ||||
Description | I have the following directory hierarchy: app/ src/ po/ es/ app.po fr/ app.po CMakeLists.txt I would like to have all code handling the translation files in the top-level CMakeLists.txt file so that new translations can be added inside the "po" directory without adding any CMake code. app/CMakeLists.txt looks like this: find_package(Gettext REQUIRED) foreach(lang fr es) gettext_process_po_files(${lang} ALL INSTALL_DESTINATION share/locale PO_FILES po/${lang}/test.po) endforeach() But this does not work. Running CMake outputs the following error: CMake Error: Attempt to add a custom rule to output "(...)/app/build/app.gmo.rule" which already has a custom rule. | ||||
Steps To Reproduce | - Unpack attached test-case - Run cmake | ||||
Additional Information | I worked around that bug by copying the code from gettext_process_po_files() in my project and adjusting it like this: diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 6a1e36e..4b3ada7 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -203,7 +203,7 @@ function(GETTEXT_PROCESS_PO_FILES _lang) foreach(_current_PO_FILE ${_parsedArguments_PO_FILES}) get_filename_component(_name ${_current_PO_FILE} NAME) string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) - set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}-${_basename}.gmo) add_custom_command(OUTPUT ${_gmoFile} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" @@ -211,7 +211,7 @@ function(GETTEXT_PROCESS_PO_FILES _lang) ) if(_parsedArguments_INSTALL_DESTINATION) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_ + install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES endif() list(APPEND _gmoFiles ${_gmoFile}) endforeach() Not sure if this is the best fix, though. | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | cmake-gettext-pofile-name.tar.bz2 (506) 2014-05-05 10:16 https://public.kitware.com/Bug/file/5141/cmake-gettext-pofile-name.tar.bz2 | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2014-05-05 10:16 | Aurélien Gâteau | New Issue | |||
2014-05-05 10:16 | Aurélien Gâteau | File Added: cmake-gettext-pofile-name.tar.bz2 | |||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042543 | |||
2016-06-10 14:29 | Kitware Robot | Status | new => resolved | ||
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|