Difference between revisions of "CMake User Contributed Macros"

From KitwarePublic
Jump to navigationJump to search
(Replace content with link to new CMake community wiki)
Line 1: Line 1:
'''User Contributed Macros'''
This page has moved [https://gitlab.kitware.com/cmake/community/wikis/Contrib here].
== 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 [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/readme.txt?root=CMake&view=markup CMake Module Guidelines].
#[[CMakeUserFindAUTOPACK | Find Autopack]]
#[[CMakeUserFindClanLib | Find ClanLib]]
#[[CMakeUserFindDirectShow | Find DirectShow]]
#[[CMakeUserFindMySQL | Find MySQL]]
#[[CMakeUserFindPARMETIS | Find ParMetis]]
#[[CMakeUserFindVLD| Find VLD - Visual Leak Debugger]]
#[[CMakeUserFindWix| Find WIX - Windows Installer XML,v2]]
#[[CMakeUserFindLibSVM| Find LibSVM - A Library for Support Vector Machines]]
#[[CMakeUserFindMuParser| Find MuParser - High performance math expression parser library]]
#[[CMakeUserFindOctave| Find Octave - Interpreted language for numerical computations]]
#[[CMakeUserUseBison| Use Bison - Parser Generator]]
#[[CMakeUserUseFlex| Use Flex - Lexer Generator]]
#[[CMakeUserUseLATEX| Use LaTeX - Build LaTeX Documents]]
#[[CMakeUserUseRPMTools| Use RPM Tools - Build RPM (source or binary)]]
#[[CMakeUserFindCTPP2| Find CTPP2]] - [http://ctpp.havoc.ru/en/ C++ Template Engine]
#[[CMakeUserFindQwt| Find Qwt]] - [http://qwt.sourceforge.net/ Qt Widgets for Technical Applications]
#[[CMakeUserFindQScintilla| Find QScintilla]] - [http://www.riverbankcomputing.com/software/qscintilla/ port to Qt of Neil Hodgson's Scintilla C++ editor control]
[[CMake|Home]]  [[CMake_User_Contributed_Macros|Back]]
== 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 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 [[https://github.com/toeb/oo-cmake#feature-overview here]]
== Make Equivalents ==
While attempting to convert a gnu makefile to Cmake, there was
a need to provide some macros to provide equivalent functionality.
#[[CMakeMacroFilterOut | FILTER_OUT (filter-out)]]
#[[CMakeMacroLibtoolFile | CREATE_LIBTOOL_FILE (create a libtool archive file)]]
[[CMake|Home]]  [[CMake_User_Contributed_Macros|Back]]
== Some helpers along the way ==
#[[CMakeCopyIfDifferent | COPY_IF_DIFFERENT]]
#[[CMakeMacroMerge | MERGE]] --- Merges two sorted lists into a single sorted list. Useful to keep source and header files next to each other.
#[[CMakeMacroCreateFinalFile | CREATE_FINAL_FILE]] -- create a KDE style final file, which includes all source files, so that the compilation will be noticable faster.
#[[CMakeMacroListOperations | List Operations]] -- A compilation of some helpful list operations.
#[[CMakeMacroParseArguments | PARSE_ARGUMENTS]] -- A macro to help parse arguments for other macros.
#[[CMakeMacroAddCxxTest | ADD_CXXTEST]] -- A macro to add tests written the CxxTest testing framework.
#[[CMakeMacroForceAddFlags | Force Flags]] -- A macro to force certain arguments for specified flag (similar to a set union).
#[[CMakeTestInline | Test Inline]] -- A test for how your compiler defines inline.
#[[CMakeCompareVersionStrings | COMPARE_VERSION_STRINGS]] -- A macro to help compare arbitrary version strings for less than, equal to, and greater than.
See also the list of all macros in the [[:Category:CMakeMacro | CMake Macro category]].
== 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.
#[[CMakeMacroGatherProjectFiles | GatherProjectFiles]] -- create and cache a list of project files by recursively globbing a directory structure
#[[CMakeMacroGenerateProject | GenerateProject]] -- creates a VS project with subgroups that mimic the directory structure
[[CMake|Home]]  [[CMake_User_Contributed_Macros|Back]]

Latest revision as of 11:41, 30 April 2018

The CMake community Wiki has moved to the Kitware GitLab Instance.

This page has moved here.