Bug 293030 - po files do not build due to cmake error - FindGettext.cmake bug
Summary: po files do not build due to cmake error - FindGettext.cmake bug
Status: RESOLVED UPSTREAM
Alias: None
Product: buildsystem
Classification: Developer tools
Component: KDE4 (cmake) (show other bugs)
Version: unspecified
Platform: Mageia RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Alexander Neundorf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-01 10:06 UTC by George Kiagiadakis
Modified: 2015-10-19 14:51 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
First try at fixing the multiple targets problem (8.70 KB, text/x-cmake)
2012-02-12 17:35 UTC, Alexander Neundorf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description George Kiagiadakis 2012-02-01 10:06:56 UTC
+++ 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.
Comment 1 Rohan Garg 2012-02-07 19:05:15 UTC
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
Comment 2 George Kiagiadakis 2012-02-07 19:14:22 UTC
Reopening, this is not a proper fix. This affects all applications that are using cmake_minimum_required(VERSION 2.8) together with FindGettext.cmake
Comment 3 Rohan Garg 2012-02-07 19:23:49 UTC
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
Comment 4 Rohan Garg 2012-02-07 19:24:41 UTC
Reopening because of same reasons
Comment 5 Alexander Neundorf 2012-02-09 21:12:03 UTC
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/
Comment 6 Alexander Neundorf 2012-02-09 21:15:42 UTC
Done: http://public.kitware.com/Bug/view.php?id=12952
Comment 7 Alexander Neundorf 2012-02-12 17:35:53 UTC
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.
Comment 8 Alexander Neundorf 2012-02-15 20:26:14 UTC
Can you please give the attached file a try ?

Thanks
Alex
Comment 9 George Kiagiadakis 2012-02-15 20:45:14 UTC
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.
Comment 10 Jekyll Wu 2013-01-03 15:52:30 UTC
Should this report be closed now ?
Comment 11 Rohan Garg 2013-01-03 15:54:29 UTC
Yep