Review Request 119300: extra-cmake-modules: Fix using the same variable for camelCase and REQUIRED_HEADERS causes problems.

Andreas Xavier andxav at zoho.com
Tue Jul 15 13:38:01 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/119300/
-----------------------------------------------------------

Review request for KDE Frameworks, Alex Merry and Michael Pyne.


Repository: extra-cmake-modules


Description
-------

First, this is my first attempt at building frameworks, so the problem is most likely on my end.  However, following the instructions at https://community.kde.org/Frameworks/Building/Details I found this problem.

Using the same variable name for camelCase var1 and REQUIRED_HEADERS var2 in the new ecm_generate_headers() syntax, when it is called more than once only exports the headers from the first invokation of ecm_generate_headers(), where var1 and var2 are defined as follows.

ecm_generate_headers(var1
...
REQUIRED_HEADERS var2
)

It doesn't show up in existing builds because cmake doesn't delete old header files, so all accumulated headers remain in the build.

There are some projects in kde-frameworks that use the same variable name for var1 and var2, for example kcoreaddons.

Steps to Replicate Using KCoreAddons as an example:

  1. Delete the existing header files for KCoreAddons and the existing build files.
    rm -r $KF5/KcoreAddons
    rm -r <your kcoreaddons/build directory>
  2. Re-build kcoreaddons from a new build dir
    cmake -DCMAKE_INSTALL_PREFIX=$KF5 ..
  3. Check in $KF5/KcoreAddons and there should only be these headers:
    KAboutData kaboutdata.h kcoreaddons_export.h

Problem:
If the same variable name is used for both var1 and var2 they overwrite each other at the PARENT level and the result is that only one invocation of ecm_generate_headers sticks. 

Solution:  
I assume that the CMakeList writer is intentionally using the same variable name for var1 and var2 and wants to accumulate both the camelCase and the lowercase.h names on the same variable.  If the variable names are the same if accumulates both the camelCase list and the lowercase.h list on the single variable.    

If my assumption is incorrect and var1 and var2 must be different to separate the camelCase and lowercase.h lists, then a new patch should be submitted to generate either a warning or an error message when var1 and var2 are the same name.

This review is linked with https://git.reviewboard.kde.org/r/119275/.  If this review is accepted then https://git.reviewboard.kde.org/r/119275/ is unecessary.


Diffs
-----

  modules/ECMGenerateHeaders.cmake bac5086 

Diff: https://git.reviewboard.kde.org/r/119300/diff/


Testing
-------

make test
Compiled kcoreaddons, checked that all the headers were exported.  Then compiled kauth and checked that it found the exported headers.


Thanks,

Andreas Xavier

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140715/45cd16c4/attachment.html>


More information about the Kde-frameworks-devel mailing list