README
cmake-fedora consist a set of cmake modules that provides
helper macros and targets for fedora developers.

= Motivation =
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, on the other hand, need some 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.

cmake-fedora provides a set of helper modules that aim to automate the
chores.

= Install =
cmake-fedora can be installed in either way:
 * As normal rpm package
 * Extract it in a sub-directory (e.g cmake-modules) of an existing
   project and add the path of cmake modules (files with cmake suffix)
   to variable CMAKE_MODULE_PATH, like:
   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} cmake-modules/src)

= Work flow =
There are 3 important files:
 * CMakeLists.txt: cmake build instruction file.
   Edit it as you normally do with CMake projects.
   Note that project persistent information like project name, authors,
   licenses and project summary should also be written here.
 * RELEASE_NOTES.txt (or other name you prefer): Release note.
   Information for certain release, like version, change summary, and change
   items.
 * SPECS/project.spec.in: RPM SPEC template.
   You can tailor your rpm building need with this file.

CMakeLists.txt and SPECS/project.spec.in are meant to be persistent, so no
need to change them after the initial setup.
RELEASE_NOTES.txt, however, do need to be updated on each release.

== Apply cmake-fedora to a package ==
Assuming the CMakeLists.txt is valid and able to build,
and cmake-fedora is installed in the sub-directory cmake-modules.

Following steps are recommended:
 1. Define project base information with CMakeLists.txt
    a. SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} cmake-modules)
    b. Use LOAD_RELEASE_FILE() to load the release information.
    c. Use PACK_SOURCE() to pack source.
       cmake-fedora has sane default for file exclusion, but you add
       your own excluding file patterns by appending then to
       PACK_SOURCE_IGNORE_FILES
    d. Use PACK_RPM(), USE_FEDPKG(), and USE_BODHI() for rpm, fedpkg and
       bodhi support.

 2. Define release information in In RELEASE_NOTES.txt:
    a. Define version as PRJ_VER
    b. Define change summary as SUMMARY
    c. Write change log beneath [Changes] section.

 3. Refresh the project using
    cmake .
    cmake-fedora targets like rpm, rpmlint should be available for now.

== Release a new version with cmake-fedora ==
 1. Update RELEASE_NOTES.txt for latest release information.
 2. make pack_src to generate tarball
 3. make rpm to generate rpm.
 4. make rpmlint to run rpmlint on newly generated rpms.
 5. make fedpkg_scratch_build to do the koji scratch build on every
    supported dist tags.
 6. make fedpkg_submit to commit the change to supported dist tags.
 7. make fedpkg_build to build on supported dist tags.
 8. Use either make fedpkg_update or make bodhi_new to send the new release
    to bodhi