Bug 348917

Summary: KF5AuthMacros.cmake error
Product: [Frameworks and Libraries] frameworks-kauth Reporter: Fl@sh <kaperang07>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kevin.kofler, rdieter, sitter
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Fl@sh 2015-06-09 08:05:03 UTC
If builds  KF5 project with current KF5AuthMacros.cmake, then occured this error:
CMake Error at /lib64/cmake/KF5Auth/KF5AuthMacros.cmake:76 (add_custom_target):
  The target name "actions for org.freedesktop.auth.cpufrequtility" is
  reserved or not valid for certain CMake features, such as generator
  expressions, and may result in undefined behavior.

I'm changed target Name "actions for ${HELPER_ID}" to "actions_for_${HELPER_ID}" (with underscores), then project is built.
Maybe this related with target naming:
http://www.cmake.org/cmake/help/v3.0/command/add_custom_target.html

Reproducible: Always

Steps to Reproduce:
Project for example: https://github.com/F1ash/kf5-cpufrequtility
1. build as is
2. edit /lib{?64}/cmake/KF5AuthMacros.cmake line 76 to
add_custom_target("actions_for_${HELPER_ID}" ALL DEPENDS ${_output})
3. build again

Actual Results:  
after step1 occured error:
CMake Error at /lib64/cmake/KF5Auth/KF5AuthMacros.cmake:76 (add_custom_target):
  The target name "actions for org.freedesktop.auth.cpufrequtility" is
  reserved or not valid for certain CMake features, such as generator
  expressions, and may result in undefined behavior.
after step2,3 -- error isn't appear 

Expected Results:  
building without this error
Comment 1 Rex Dieter 2015-06-09 13:10:35 UTC
This error only occurs if one uses:

cmake_minimum_required(VERSION 3.2)

if replaced by

cmake_minimum_required(VERSION 2.8.12)

the error is replaced by a warning:

CMake Warning (dev) at /lib64/cmake/KF5Auth/KF5AuthMacros.cmake:76 (add_custom_target):
  Policy CMP0037 is not set: Target names should not be reserved and should
  match a validity pattern.  Run "cmake --help-policy CMP0037" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  The target name "actions for org.freedesktop.auth.cpufrequtility" is
  reserved or not valid for certain CMake features, such as generator
  expressions, and may result in undefined behavior.
Call Stack (most recent call first):
  src/helper/CMakeLists.txt:22 (kauth_install_actions)
This warning is for project developers.  Use -Wno-dev to suppress it.
Comment 2 Fl@sh 2015-06-09 16:15:19 UTC
with:
        cmake_minimum_required(VERSION 2.8.12)
        cmake_policy(SET CMP0037 OLD)

the problem disappears.
Comment 3 Kevin Kofler 2015-06-10 20:55:05 UTC
I guess you'd also get away with:
cmake_minimum_required(VERSION 3.2)
cmake_policy(SET CMP0037 OLD)

Still, KAuth should not be requiring a CMake policy to be set to OLD.
Comment 4 Harald Sitter 2020-09-03 09:34:09 UTC
Actions for helper id is now a comment, I'm guessing that has solved this problem.