|
|
|
You are now on the CMake community wiki.
|
|
|
|
Many pages are now **DEPRECATED** and sometimes even considered bad
|
|
|
|
practice. Those are only kept as reference for previous CMake versions.
|
|
|
|
The documentation for the latest version is available here:
|
|
|
|
[CMake Documentation](https://cmake.org/documentation/).
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
**User Contributed Macros**
|
|
|
|
|
|
|
|
## Find Modules
|
|
|
|
|
|
|
|
Although CMake comes with a whole bunch of FindXXX packages, there is a
|
|
|
|
large number of packages there are not covered. The hope is that these
|
|
|
|
user-contributed macros will eventually make their way into the official
|
|
|
|
distribution. Before contributing, please have your FindXXX package
|
|
|
|
conform to the [CMake Module
|
|
|
|
Guidelines](http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/readme.txt?root=CMake&view=markup).
|
|
|
|
|
|
|
|
1. [Find Autopack](CMakeUserFindAUTOPACK "wikilink")
|
|
|
|
2. [Find ClanLib](CMakeUserFindClanLib "wikilink")
|
|
|
|
3. [Find DirectShow](CMakeUserFindDirectShow "wikilink")
|
|
|
|
4. [Find MySQL](CMakeUserFindMySQL "wikilink")
|
|
|
|
5. [Find ParMetis](CMakeUserFindPARMETIS "wikilink")
|
|
|
|
6. [Find VLD - Visual Leak Debugger](CMakeUserFindVLD "wikilink")
|
|
|
|
7. [Find WIX - Windows Installer XML,v2](CMakeUserFindWix "wikilink")
|
|
|
|
8. [Find LibSVM - A Library for Support Vector
|
|
|
|
Machines](CMakeUserFindLibSVM "wikilink")
|
|
|
|
9. [Find MuParser - High performance math expression parser
|
|
|
|
library](CMakeUserFindMuParser "wikilink")
|
|
|
|
10. [Find Octave - Interpreted language for numerical
|
|
|
|
computations](CMakeUserFindOctave "wikilink")
|
|
|
|
11. [Use Bison - Parser Generator](CMakeUserUseBison "wikilink")
|
|
|
|
12. [Use Flex - Lexer Generator](CMakeUserUseFlex "wikilink")
|
|
|
|
13. [Use LaTeX - Build LaTeX Documents](CMakeUserUseLATEX "wikilink")
|
|
|
|
14. [Use RPM Tools - Build RPM (source or
|
|
|
|
binary)](CMakeUserUseRPMTools "wikilink")
|
|
|
|
15. [Find CTPP2](CMakeUserFindCTPP2 "wikilink") - [C++ Template
|
|
|
|
Engine](http://ctpp.havoc.ru/en/)
|
|
|
|
16. [Find Qwt](CMakeUserFindQwt "wikilink") - [Qt Widgets for Technical
|
|
|
|
Applications](http://qwt.sourceforge.net/)
|
|
|
|
17. [Find QScintilla](CMakeUserFindQScintilla "wikilink") - [port to Qt
|
|
|
|
of Neil Hodgson's Scintilla C++ editor
|
|
|
|
control](http://www.riverbankcomputing.com/software/qscintilla/)
|
|
|
|
|
|
|
|
[Home](CMake "wikilink")
|
|
|
|
[Back](CMake_User_Contributed_Macros "wikilink")
|
|
|
|
|
|
|
|
## Comprehensive Collection of CMake functions/macros
|
|
|
|
|
|
|
|
For CMake 2.8.7 and higher. More complex build scripts might need a
|
|
|
|
larger toolset than is provided by CMake. Here is a tested collection of
|
|
|
|
over 500 CMake functions which you can easily download and use by just
|
|
|
|
including a single file in your CMakeLists.txt.
|
|
|
|
|
|
|
|
Repository: <https://github.com/toeb/oo-cmake> MIT License
|
|
|
|
|
|
|
|
Some features
|
|
|
|
|
|
|
|
- interactive cmake shell
|
|
|
|
- eval
|
|
|
|
- maps (objects without functions)
|
|
|
|
- serialization to and from json
|
|
|
|
- function functions
|
|
|
|
- return values
|
|
|
|
- dynamic call
|
|
|
|
- objects
|
|
|
|
- list tools
|
|
|
|
- slice, splice, filter, map, fold
|
|
|
|
- string tools
|
|
|
|
- slice, splice, ...
|
|
|
|
- semver
|
|
|
|
- parse, compare, constrain semantic versions
|
|
|
|
- shell tools
|
|
|
|
- filesystem
|
|
|
|
- many bash like functions which work on windows and unix
|
|
|
|
systems(ls, touch, fwrite, fread, cd, pwd, pushd, popd, rm, ...)
|
|
|
|
- read_line from console
|
|
|
|
- debugging
|
|
|
|
- breakpoint
|
|
|
|
- print scope
|
|
|
|
- ...
|
|
|
|
|
|
|
|
An up to date full feature list and installation guide is located
|
|
|
|
[here](https://github.com/toeb/oo-cmake#feature-overview)
|
|
|
|
|
|
|
|
## Make Equivalents
|
|
|
|
|
|
|
|
While attempting to convert a gnu makefile to Cmake, there was a need to
|
|
|
|
provide some macros to provide equivalent functionality.
|
|
|
|
|
|
|
|
1. [FILTER_OUT (filter-out)](CMakeMacroFilterOut "wikilink")
|
|
|
|
2. [CREATE_LIBTOOL_FILE (create a libtool archive
|
|
|
|
file)](CMakeMacroLibtoolFile "wikilink")
|
|
|
|
|
|
|
|
[Home](CMake "wikilink")
|
|
|
|
[Back](CMake_User_Contributed_Macros "wikilink")
|
|
|
|
|
|
|
|
## Some helpers along the way
|
|
|
|
|
|
|
|
1. [COPY_IF_DIFFERENT](CMakeCopyIfDifferent "wikilink")
|
|
|
|
2. [MERGE](CMakeMacroMerge "wikilink") --- Merges two sorted lists into
|
|
|
|
a single sorted list. Useful to keep source and header files next to
|
|
|
|
each other.
|
|
|
|
3. [CREATE_FINAL_FILE](CMakeMacroCreateFinalFile "wikilink") --
|
|
|
|
create a KDE style final file, which includes all source files, so
|
|
|
|
that the compilation will be noticable faster.
|
|
|
|
4. [List Operations](CMakeMacroListOperations "wikilink") -- A
|
|
|
|
compilation of some helpful list operations.
|
|
|
|
5. [PARSE_ARGUMENTS](CMakeMacroParseArguments "wikilink") -- A macro
|
|
|
|
to help parse arguments for other macros.
|
|
|
|
6. [ADD_CXXTEST](CMakeMacroAddCxxTest "wikilink") -- A macro to add
|
|
|
|
tests written the CxxTest testing framework.
|
|
|
|
7. [Force Flags](CMakeMacroForceAddFlags "wikilink") -- A macro to
|
|
|
|
force certain arguments for specified flag (similar to a set union).
|
|
|
|
8. [Test Inline](CMakeTestInline "wikilink") -- A test for how your
|
|
|
|
compiler defines inline.
|
|
|
|
9. [COMPARE_VERSION_STRINGS](CMakeCompareVersionStrings "wikilink")
|
|
|
|
-- A macro to help compare arbitrary version strings for less than,
|
|
|
|
equal to, and greater than.
|
|
|
|
|
|
|
|
[Home](CMake "wikilink")
|
|
|
|
[Back](CMake_User_Contributed_Macros "wikilink")
|
|
|
|
|
|
|
|
## Visual Studio generator helpers
|
|
|
|
|
|
|
|
When generating Visual Studio projects, the priorities can be sometimes
|
|
|
|
different than for other generators. These are some VS-specific (and
|
|
|
|
sometimes not-so-specific) macros that could help you generate better VS
|
|
|
|
projects.
|
|
|
|
|
|
|
|
1. [GatherProjectFiles](CMakeMacroGatherProjectFiles "wikilink") --
|
|
|
|
create and cache a list of project files by recursively globbing a
|
|
|
|
directory structure
|
|
|
|
2. [GenerateProject](CMakeMacroGenerateProject "wikilink") -- creates a
|
|
|
|
VS project with subgroups that mimic the directory structure
|
|
|
|
|
|
|
|
[Home](CMake "wikilink")
|
|
|
|
[Back](CMake_User_Contributed_Macros "wikilink")
|
|
|
|
|
|
|
|
----
|
|
|
|
This page was initially populated by conversion from its [original location](https://public.kitware.com/Wiki/CMake_User_Contributed_Macros) in another wiki. |