Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Tag Archives: cmake

cmake-fedora-2.5.0 is released

  • Enhancement:
    • New Target: changelog_no_force: Does not update ChangeLog if RELEASE-NOTES.txt is newer than ChangeLog.
  • Fixed:
    • MANAGE_ZANATA: Error message that missing right bracket.
      Thanks ChangZhu Chen for pointing it out.
    • Bug 1295278 – cmake-fedora: failed to update version when CMakeCache.txt is newer than RELEASE-NOTES.txt

cmake-fedora-2.4.3 is released

cmake-fedora consists CMake modules and scripts that simplify and automate the release process for software package, especially for Fedora and EPEL.

Even if you are not using CMake on your packages, you can still using following scripts to simplify your package chores. For examples, if you want your packages to be build in koji and submit to bodhi in all active branches like rawhide, f23, f22, f21, simply run

cmake-fedora-fedpkg <SRPM>

It builds the SRPM on all the active branches, skip the already built ones, then submit them to bodhi.

cmake-fedora-1.0.5 is released

Change from 1.0.2:


  • Fedora 18 support.
  • Source tarball filename is changed back to name-version-Source.tar.gz to avoid confusion between source generate by cmake-fedora (which contains ChangeLog? and projectName.pot) and tarball generation service from hosting site (which does not contain generated files)
  • koji-build-scratch: rawhide build target does not always have suffix -candidate.
  • README updated.
  • TODO updated.


  • Source tarball filename is now name-version.tar.gz instead of name-version-Source.tar.gz
  • after_release_commit depends rpm_changelog_prev_update if RPM supported enabled.
  • Corrected the ‘FORCE’ of cmake CACHE
  • Update the error messages when cmake-fedora is not installed.
  • Fixed target: zanata_push_trans.
  • Fixed zanata arguments.
  • fedpkg clone is now triggered if the clone directory does not exist when doing the fedpkg_commit, it no longer the listed OUTPUT of an ADD_CUSTOM_COMMAND.
  • Add target: translations as an universal easy target to generate/update translation files.

cmake-fedora 整骨完畢

cmake-fedora 1.0.2 終於生出來了。


  1. 程式設計
  2. 巨集以及函式呼叫。
  3. 模組名稱更加合理


  1. 若是沒有必須的Dependency只會給出[Off] (停用)警告
  2. 若是不想看到這些警告可以  -DCMAKE_FEDORA_ENABLE_FEDORA_BUILD=0,直接跳過相關模組。
  3. 要更追求「純淨的話可以把 ManageRPM 和 ManageReleaseFedora 刪除。



Generate JUnit XML format for Jenkins from CMake CTest

In JUnit XML Skeleton fits for Hudson., I showed the minimal JUnit XML for showing  meaningful results in Hudson/Jenkins.

But how to generate the JUnit XML from cmake and ctest?

I got the inspiration from How to get CTest results in Hudson / Jenkins in StackOverflow and create following  CTest2JUnit.xsl.

To use the xsl, you may either use the I provide in the same directory, or following command in Linux:

xsltproc CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml

cmake-fedora 0.8.1 released

What has changed:

  • Fixed Bug 738958 – cmake-fedora: remove excessive quotation marks for Precompile definition
  • Fixed Bug 733540 – cmake-fedora: "" should be read as empty string
  • ManageEnvironment: Now defined cmake_policy won't get overridden.
  • ManageString: STRING_UNQUOTE is now merely remove quote marks in the beginning and end of string. The string will not be changed otherwise.
  • UseUninstall has renamed as ManageUninstall
  • ManageMaintainerTargets: Reveal MAINTAINER_UPLOAD_COMMAND
  • ManageTranslation: Adopt zanata python client 1.3, arguments are redesigned.
    • Change target: from "translations" to "gmo_files"
    • Add targets: zanata_push, zanata_push_trans, zanata_pull_trans
    • Add argument: OPTIONS for passing arguments.
  • ManageReleaseOnFedora: Now default to build against candidate repos,
    unless _CANDIDATE_PREFERRED is set to "0".


Were you ever bored by the following release chores:

  • Verifying the consistence of versioning in program, tarball, git tags, RPMs, ChangeLog, and whatever place that need to know current version?
  • Pasting change summaries and details in submission messages, ChangeLog, RPM ChangeLog, bodhi notes, and the hosting website?
  • Forget to rpmlint again?
  • Having to scratch build, commit, build, and submitting to bodhi in for each dist you intent to support?
  • Embarrassed by inconsistency amongst source tarballs and RPMs?
  • Need to manually upload source tarball to hosting service providers?
  • Manually to copy the COPYING and fill the information in COPYING?

I do, thus the birth of the cmake-fedora, which automates many chores describe above.

CMake is a powerful cross-platform build system, it is considered faster and easier to understand than autotools. However, there are some gotchas for novice packagers.

For example, without setting CPACK_SOURCE_IGNORE_FILES, novices might notice the tarball grow geometrically each time they pack, because the old tarballs are not excluded.

Advance developers also benefit from these convenient macros and targets for project release chores like writing the same release information to ChangeLog, RPM spec file, source control tags, koji build and bodhi submission.

What does cmake-fedora do exactly? (Feature List)

  • Edit once in RELEASE-NOTES.txt, applied everywhere, such as:
    • ChangeLog
    • Source tarball generation
    • RPM
    • koji scratch build
    • fedpkg scratch build, commit, build, update
    • bodhi submission, the Change is applied as note.
    • Uploading to hosting services like FedoraHosted, SourceForge, GitHub, Google Project hosting (the last three is under development)
  • A script to generate templates of build files and documents, such as
    • CMakeLists.txt
    • SPECS/
  • Helper macros and targets to:
    • Build
    • Pack source tarball
    • Build rpm, srpm
    • rpmlint
    • Submit to fedpkg, koji, and bodhi
    • Clean older builds
    • uninstall

Project’s home page is at here.

CMake String regex match annoyance (aftermath)

Bill Hoffman kindly informed me that I can use “” to protect the semicolon.

For example, to get value of variable “_line” should be written as “${_line}”.

Thanks, Bill.

CMake Introduction slides

I’ve just made slides to introduce CMake.

Please download the slides and example programs from:
if you are interested.

[CMake] [CPack] Preprocess or postprocess for make package* targets

CPack can pack source and binary accourding to

CMake then produce targets like package, package_source, however,
CMake itself does not recognize the these targets. So we cannot associate and
depend any targets by either ADD_CUSTOM_COMMAND() or

, in other words, CMake does not recognize package, package_source itself.

But what if you do want to associate some commands and targets before or after the package is built?
Here is some quick hack: Use a target: pack_src for package_source,
just like:

    COMMAND make package_source
    COMMENT "Packaging Source files"
    DEPENDS other_dependency 

Note that I have to add package_source, as CMake does not recognize package_source, and I need to call it explicitly.