Bug 351287

Summary: kdelibs (v4.14.10-19-g8e81797) fails to configure with -DKDE4_BUILD_TESTS=false
Product: [Developer tools] buildsystem Reporter: RJVB <rjvbertin>
Component: KDE4 (cmake)Assignee: Stephen Kelly <steveire>
Status: RESOLVED FIXED    
Severity: major CC: heiko.becker, rakuco
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: All   
URL: https://launchpad.net/~rjvbertin/+archive/ubuntu/kde-git/+build/7796321/+files/buildlog_ubuntu-trusty-amd64.kde4libs_4%3A4.14.git20150812.10-8e81797%7Eubuntu14.04%7Eppa20150813_BUILDING.txt.gz
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description RJVB 2015-08-14 11:40:53 UTC
A recent commit to kdelibs (sometime after b6c557e from May this year) introduced a change to the build system that causes the configure step to fail when cmake is invoked with -DKDE4_BUILD_TESTS=false .

Reproducible: Always

Steps to Reproduce:
1. fetch kdelibs (commit 8e81797)
2. mkdir build
3. (cd build ; cmake .. -Wno-dev -DKDE4_BUILD_TESTS=false)

Actual Results:  
multiple copies of this error:

CMake Error at cmake/modules/KDE4Macros.cmake:941 (add_custom_target):
  add_custom_target cannot create target "buildtests" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory
  ".../kdelibs/kl-test/nepomuk/test".  See
  documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  kdecore/sonnet/tests/CMakeLists.txt:18 (kde4_add_unit_test)
  kdecore/sonnet/tests/CMakeLists.txt:23 (SONNET_UNIT_TESTS)


Expected Results:  
Configure without error

This error disappears when not disabling test builds.

I'm classifying this as a major error because it makes the build process significantly more expensive, possibly breaking it on platforms other than Linux on which certain tests might fail (disabling tests is a known (least-resistance) workaround for several projects on OS X).
Comment 1 Heiko Becker 2015-08-16 14:55:45 UTC
(In reply to RJVB from comment #0)
> CMake Error at cmake/modules/KDE4Macros.cmake:941 (add_custom_target):
>   add_custom_target cannot create target "buildtests" because another target
>   with the same name already exists.  The existing target is a custom target
>   created in source directory
>   ".../kdelibs/kl-test/nepomuk/test".  See
>   documentation for policy CMP0002 for more details.
> Call Stack (most recent call first):
>   kdecore/sonnet/tests/CMakeLists.txt:18 (kde4_add_unit_test)
>   kdecore/sonnet/tests/CMakeLists.txt:23 (SONNET_UNIT_TESTS)

I see similar errors when building with -DKDE4_ENABLE_HTMLHANDBOOK=TRUE:

CMake Error at cmake/modules/KDE4Macros.cmake:315 (add_custom_target):
  add_custom_target cannot create target "htmlhandbook" because another
  target with the same name already exists.  The existing target is a custom
  target created in source directory
  "/var/tmp/paludis/build/kde-kdelibs-4.14.11/work/kdelibs-4.14.11/doc/kioslave/data".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  doc/kioslave/webdav/CMakeLists.txt:2 (kde4_create_handbook)

CMake version is 3.3.1
Comment 2 Heiko Becker 2015-11-08 15:44:17 UTC
Git commit eaf92b8d2f5a058fbf575d733f0924c446eb93ee by Heiko Becker.
Committed on 08/11/2015 at 15:40.
Pushed by heikobecker into branch 'KDE/4.14'.

Give each htmlhandbook target a unique name

Since the CMP0002 warnings have been turned into errors it was
impossible to build kdelibs with -DKDE4_ENABLE_HTMLHANDBOOK:BOOL=TRUE:

"CMake Error at cmake/modules/KDE4Macros.cmake:315 (add_custom_target):
add_custom_target cannot create target "htmlhandbook" because another
target with the same name already exists...."

The bug below is more about the similar error with -DKDE4_BUILD_TESTS
but since it's still open (and I commented there about the htmlhandbook
error ;-) I included it here.
REVIEW: 125983

M  +3    -1    cmake/modules/KDE4Macros.cmake

http://commits.kde.org/kdelibs/eaf92b8d2f5a058fbf575d733f0924c446eb93ee