The document discusses CMake, CPack, CTest and CDash which are open source tools for building, testing, packaging and tracking software projects across platforms. CMake is a build system generator that supports languages like C, C++ and Fortran. It generates native build scripts for compilers like Make and MSBuild. CPack can package build outputs into formats like RPM, DEB and NSIS installers. CTest integrates with CMake to run and manage tests. CDash is a web dashboard for aggregating results from CTest runs on multiple platforms.
Deploying Windows Apps to Kubernetes with Draft and Helm
Build System CMake Guide Covers Workflow, Packaging & Testing
1. CMake CPack CTest and CDash
CMake - a cross-platform, open-source build
system
Andreas Schneider <anschneider@suse.de>
Daniel Gollub <dgollub@suse.de>
SUSE Linux Products GmbH
8th July 2008
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
2. CMake CPack CTest and CDash
CMake
1 CMake
About CMake
Workflow
Details
External dependencies
2 CPack
3 CTest and CDash
CTest
CDash
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
3. CMake CPack CTest and CDash
About CMake
CMake - a cross-platform, open-source build system
1 CMake
About CMake
Workflow
Details
External dependencies
2 CPack
3 CTest and CDash
CTest
CDash
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
4. CMake CPack CTest and CDash
About CMake
What is CMake?
CMake is
BSD licensed open-source package
written in C++
tools to build, test and package software
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
5. CMake CPack CTest and CDash
About CMake
More exactly
CMake is a meta-build system
doesn’t do the final build
it generates files for other build systems
Makefiles, KDevelop, Eclipse, XCode, MinGW, Cygwin and
Visual Studio
gives the developer the ability to use the tool they are most
productive with
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
6. CMake CPack CTest and CDash
About CMake
Who is using it
Projects using CMake are
KDE4
libzypp
Qutecom (formly known as WengoPhone)
csync, OpenSync
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
7. CMake CPack CTest and CDash
About CMake
Important features
CMake supports
complex custom commands (qt moc, yacc)
optional component support
shared libraries and DSOs with version support
automatic dependency generation (C, C++, Fortran)
out-of-source builds
cross-compiling support
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
8. CMake CPack CTest and CDash
Workflow
CMake - a cross-platform, open-source build system
1 CMake
About CMake
Workflow
Details
External dependencies
2 CPack
3 CTest and CDash
CTest
CDash
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
9. CMake CPack CTest and CDash
Workflow
Simple example
Hello world!
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
10. CMake CPack CTest and CDash
Workflow
CMake configure process
Read the CMakeCache.txt if it is already there
Read the CMake input files (CMakeLists.txt, ..)
Write the cache back out
Generate the Makefiles
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
11. CMake CPack CTest and CDash
Workflow
CMake Cache
Faster compilation with the cache (KDE4 with cmake in 5
min)
Stores all kind of values you can change
Can be modified via commandline, ccmake, cmake-gui (qt4)
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
12. CMake CPack CTest and CDash
Details
CMake - a cross-platform, open-source build system
1 CMake
About CMake
Workflow
Details
External dependencies
2 CPack
3 CTest and CDash
CTest
CDash
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
13. CMake CPack CTest and CDash
Details
Variables
You don’t have to declare them
simply set(VARNAME arg1 arg2 ...argN)
list() is sometimes better
Use SPERATE ARGUMENTS to split space sparated into
semi-colon spearated
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
14. CMake CPack CTest and CDash
Details
Build types
None (default)
Debug
Release
RelWithDebInfo
MinSizeRel
You can define your own
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
15. CMake CPack CTest and CDash
Details
Build parameters
add definition(-Wall)
CMAKE C FLAGS or CMAKE CXX FLAGS
or it could be CMAKE C FLAGS DEBUG for the Debug build type
For packagers:
CFLAGS="%{optflags} -g -DNDEBUG"
CXXFLAGS="%{optflags} -g -DNDEBUG"
cmake -DCMAKE BUILD TYPE=None /path/to/source
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
16. CMake CPack CTest and CDash
Details
Flow control
if (expression)
...
else (expression)
...
endif (expression)
foreach (loop list)
...
endforeach (loop list)
while (condition)
...
while (condition)
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
17. CMake CPack CTest and CDash
Details
Macros and functions
macro (NAME arg1 arg2 ...argN)
...
command1
command2
...
endmacro (NAME arg1 arg2 ...argN)
They perform text substituions like #define does in C
WARNING: variable name clashing is possible. Prefix your
variables!
Functions have been introduced with CMake 2.6
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
18. CMake CPack CTest and CDash
External dependencies
CMake - a cross-platform, open-source build system
1 CMake
About CMake
Workflow
Details
External dependencies
2 CPack
3 CTest and CDash
CTest
CDash
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
19. CMake CPack CTest and CDash
External dependencies
Find packages
find package(Iniparser REQURIED)
CMake ships approx. 100 FindXXX.cmake modules
You can create your own FindXXX.cmake module
Put them in your source dir and set CMAKE MODULE PATH
Think of find package as an #include
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
20. CMake CPack CTest and CDash
External dependencies
Your own find module
Script: https://dev.csync.org/browser/cmake/
Scripts/generate_findpackage_file
Creates simple FindXXX.cmake module
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
21. CMake CPack CTest and CDash
External dependencies
Important addresses
#cmake @ irc.freenode.net
http://www.cmake.org/
http://www.cmake.org/Wiki/CMake Useful Variables
http://www.cmake.org/Wiki/CMake FAQ
Examples: http://dev.csync.org/browser or
http://opensync.org/browser
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
22. CMake CPack CTest and CDash
CPack
Package Generator
Independent of CMake
Abstracts Packaging
Packaging of sources and builds/binaries
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
23. CMake CPack CTest and CDash
Available Package Generators
TGZ
STGZ
NSIS (Null Soft Installer)
ZIP
TBZ2
TZ
PackageMaker (MacOSX)
OSXX11
CygwinBinary
CygwinSource
DEB
RPM
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
24. CMake CPack CTest and CDash
CPack Example: Release Tarballs
include(CPack)
set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${NAME}-${VERSION}")
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
25. CMake CPack CTest and CDash
CPack
It’s like make dist-check, without -check :(
make package source
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
26. CMake CPack CTest and CDash
CTest
CMake - a cross-platform, open-source build system
1 CMake
About CMake
Workflow
Details
External dependencies
2 CPack
3 CTest and CDash
CTest
CDash
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
27. CMake CPack CTest and CDash
CTest
CTest
Testing driver
Independent of CMake
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
28. CMake CPack CTest and CDash
CTest
Features
Updating from repositories (CVS, SVN ... no GIT support)
Configuration of the project
Building
Running the tests
Performs memory checking
Performs code coverage analyse
Logging (stdout/stderr/time/...)
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
29. CMake CPack CTest and CDash
CTest
Example: CTest standalone
Create DartTestfile.txt and just run ctest:
add_test(TestcaseName1 "command1" "param1" "param2")
add_test(TestcaseName2 "command1" "param1" "param2")
...
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
30. CMake CPack CTest and CDash
CTest
Example: CTest integrated in CMake
include(CTest)
enable_testing()
add_test(TestcaseName1 "command1" "param1" "param2")
add_test(TestcaseName2 "command1" "param1" "param2")
...
This will generate a make target called “test”.
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
31. CMake CPack CTest and CDash
CTest
Test-Model
Nightly
Experimental
Continous
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
32. CMake CPack CTest and CDash
CTest
Test-Mode
Start
Update
Configure
Build
Test
MemCheck
Coverage
Submit
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
33. CMake CPack CTest and CDash
CTest
Why CTest?
Test driven development!
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
34. CMake CPack CTest and CDash
CDash
CMake - a cross-platform, open-source build system
1 CMake
About CMake
Workflow
Details
External dependencies
2 CPack
3 CTest and CDash
CTest
CDash
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
35. CMake CPack CTest and CDash
CDash
CDash
Cross-Platform Dashboard System
PHP & MySQL
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
36. CMake CPack CTest and CDash
CDash
CDash
Retrieves testing logfiles
Summaries testing results
Build warnings/errors
Testcase PASS/FAIL results
Testcase timing results
Code Coverage
Valgrind/Memcheck results
Notifies about regressions (build failures, failed tests, ...)
Supports multiple projects
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
37. CMake CPack CTest and CDash
CDash
CDash
Doesn’t build or test the projects!
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
38. CMake CPack CTest and CDash
CDash
CTest & CDash
”Make it work as one!”
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
39. CMake CPack CTest and CDash
CDash
CTest & CDash
Continous Buildhosts of different platforms
Checking the SCM for updates
Build the projects from scratch
Run tests
Archive results
Report regressions
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
40. CMake CPack CTest and CDash
CDash
CTest & CDash - Benefits
Detect immeditally build breaking commits
Testing on several platforms
Tracking performance regressions
Hopefully increases qualtiy of the project
No time-wasting manual testing
More time for development
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
41. CMake CPack CTest and CDash
CDash
Questions & Answers
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
42. CMake CPack CTest and CDash
CDash
Thanks for listenting
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system