+++ This bug was initially created as a clone of Bug #292593 +++ Version: unspecified (using KDE 4.8.0) OS: Linux Hi, FindGettext.cmake has a macro called "GETTEXT_PROCESS_PO_FILES" which adds a custom target called "pofiles". The standard create_tarball.rb script from kdesdk which copies .po files into tarballs and generates the relevant CMakeLists.txt, generates one CMakeLists.txt per language folder and calls this macro for every language. This creates a problem with the latest cmake, since it doesn't accept having targets with the same name in different places. The errors look like this: CMake Error at /usr/share/apps/cmake/modules/FindGettext.cmake:232 (ADD_CUSTOM_TARGET): add_custom_target cannot create target "pofiles" because another target with the same name already exists. The existing target is a custom target created in source directory "/home/mikala/rpm/BUILD/ktp-presence-applet-0.3.0/po/cs". See documentation for policy CMP0002 for more details. Call Stack (most recent call first): po/pt_BR/CMakeLists.txt:2 (GETTEXT_PROCESS_PO_FILES) CMake Error at /usr/share/apps/cmake/modules/FindGettext.cmake:232 (ADD_CUSTOM_TARGET): add_custom_target cannot create target "pofiles" because another target with the same name already exists. The existing target is a custom target created in source directory "/home/mikala/rpm/BUILD/ktp-presence-applet-0.3.0/po/cs". See documentation for policy CMP0002 for more details. Call Stack (most recent call first): po/sv/CMakeLists.txt:2 (GETTEXT_PROCESS_PO_FILES) CMake Error at /usr/share/apps/cmake/modules/FindGettext.cmake:232 (ADD_CUSTOM_TARGET): add_custom_target cannot create target "pofiles" because another target with the same name already exists. The existing target is a custom target created in source directory "/home/mikala/rpm/BUILD/ktp-presence-applet-0.3.0/po/cs". See documentation for policy CMP0002 for more details. Call Stack (most recent call first): po/uk/CMakeLists.txt:2 (GETTEXT_PROCESS_PO_FILES) CMake Error at /usr/share/apps/cmake/modules/FindGettext.cmake:232 (ADD_CUSTOM_TARGET): add_custom_target cannot create target "pofiles" because another target with the same name already exists. The existing target is a custom target created in source directory "/home/mikala/rpm/BUILD/ktp-presence-applet-0.3.0/po/cs". See documentation for policy CMP0002 for more details. Call Stack (most recent call first): po/zh_CN/CMakeLists.txt:2 (GETTEXT_PROCESS_PO_FILES) CMake Error at /usr/share/apps/cmake/modules/FindGettext.cmake:232 (ADD_CUSTOM_TARGET): add_custom_target cannot create target "pofiles" because another target with the same name already exists. The existing target is a custom target created in source directory "/home/mikala/rpm/BUILD/ktp-presence-applet-0.3.0/po/cs". See documentation for policy CMP0002 for more details. Call Stack (most recent call first): po/zh_TW/CMakeLists.txt:2 (GETTEXT_PROCESS_PO_FILES) The known workaround is to use cmake_policy(SET CMP0002 OLD), but this is not a proper solution.
Git commit eaf09e1242408ac8652ba3ffd1d698326e4b2360 by Rohan Garg. Committed on 07/02/2012 at 19:49. Pushed by garg into branch 'master'. Do not use CMake 2.8 just yet CMake 2.8 has some scope issues which cause the pofile target to interfere while building translations in the tarball releases. Not requiring CMake 2.8 fixes the build issue. Related: bug 292593 M +0 -2 CMakeLists.txt http://commits.kde.org/telepathy-contact-applet/eaf09e1242408ac8652ba3ffd1d698326e4b2360
Reopening, this is not a proper fix. This affects all applications that are using cmake_minimum_required(VERSION 2.8) together with FindGettext.cmake
Git commit bea0030301dde993d2990571ec559bc9f1ca48bf by Rohan Garg. Committed on 07/02/2012 at 19:49. Pushed by garg into branch 'kde-telepathy-0.3'. Do not use CMake 2.8 just yet CMake 2.8 has some scope issues which cause the pofile target to interfere while building translations in the tarball releases. Not requiring CMake 2.8 fixes the build issue. Related: bug 292593 M +0 -2 CMakeLists.txt http://commits.kde.org/telepathy-contact-applet/bea0030301dde993d2990571ec559bc9f1ca48bf
Reopening because of same reasons
This is policy CMP0002 . FindKDE4Internal.cmake sets it to OLD, which allows duplicate target names. If somebody does afterwards a cmake_minimum_required(VERSION 2.8) this policy is set to as it is in 2.8, i.e. NEW. What scope issues do you mean ? I am not aware of any bugs in cmake related to this. If you think there is a bug in cmake, please report it in the cmake bu g tracker: http://public.kitware.com/Bug/
Done: http://public.kitware.com/Bug/view.php?id=12952
Created attachment 68732 [details] First try at fixing the multiple targets problem This version of FindGettext.cmake should fix the problem with the multiple targets with the same name. Please give it a try.
Can you please give the attached file a try ? Thanks Alex
Sorry, I noticed the patch the other day but then forgot about it. I just tested it and it seems to be working properly, without doing any other modification to the previously failing package. Thanks for the fix.
Should this report be closed now ?
Yep