[CMake-Promote] Cmake Book
Bill Hoffman
bill.hoffman at kitware.com
Tue Feb 5 14:30:33 EST 2008
Andrew Manson wrote:
> Anyone know if that boat made its target? starting a software project (
> potentially big ) very soon and what it to use cmake, but i'm not quite
> sure if i know enough about it. sorry if i seem impatient, i am just
> trying to weigh up my options right now and i like cmake.
>
The 4th edition CMake books have arrived and you can order them from
http://kitware.com/products/cmakebook.html They should show up on Amazon
in the near future as well. A summary table of contents is included below.
CHAPTER 1 WHY CMAKE? 1
1.1 The History of CMake 3
1.2 Why Not Use Autoconf? 3
1.3 Why Not Use JAM, qmake, SCons, or ANT? 4
1.4 Why Not Script It Yourself? 4
1.5 On What Platforms Does CMake Run? 5
CHAPTER 2 GETTING STARTED 7
2.1 Getting and Installing CMake on Your Computer 7
2.2 UNIX and Mac Binary Installations 7
2.3 Windows Binary Installation: 8
2.4 Building CMake Yourself 8
2.5 Basic CMake Usage and Syntax 8
2.6 Hello World for CMake 9
2.7 How to Run CMake? 11
2.8 Editing CMakeLists Files 18
2.9 Setting Initial Values for CMake 19
CHAPTER 3 KEY CONCEPTS 21
3.1 Main Structures 21
3.2 Targets 24
3.3 Source Files 25
3.4 Directories, Generators, Tests, and Properties 26
3.5 Variables and Cache Entries 27
3.6 Build Configurations 30
CHAPTER 4 WRITING CMAKELISTS FILES 33
4.1 CMake Syntax 33
4.2 Basic Commands 34
4.3 Flow Control 34
4.4 Regular Expressions 41
4.5 Checking Versions of CMake 43
4.6 Using Modules 44
4.7 Specifying Optimized or Debug Libraries with a Target 49
4.8 Shared Libraries and Loadable Modules 50
4.9 Shared Library Versioning 55
4.10 Installing Files 56
4.11 Advanced Commands 66
CHAPTER 5 PACKAGING WITH CPACK 69
5.1 CPack Basics 69
5.2 CPack Source Packages 74
5.3 CPack Installer commands 74
5.4 CPack for Windows Installer NSIS 76
5.5 CPack for Cygwin Setup 83
5.6 CPack for Apple OSX PackageMaker 86
5.7 CPack for OSX X11 applications 89
5.8 CPack for Debian packages 91
5.9 CPack for RPM 92
5.10 CPack files 93
CHAPTER 6 CONVERTING EXISTING SYSTEMS TO CMAKE 95
6.1 Source Code Directory Structures 95
6.2 Build Directories 97
6.3 Useful CMake Commands when Converting Projects 99
6.4 Converting UNIX Makefiles 100
6.5 Converting Autoconf Based Projects 101
6.6 Converting Windows Based Workspaces 103
CHAPTER 7 SYSTEM INSPECTION 105
7.1 Using Header Files and Libraries 105
7.2 System Properties 107
7.3 Built-in Find Modules 113
7.4 How to Pass Parameters to a Compilation? 115
7.5 How to Configure a Header File 116
7.6 Creating a <Package>Config.cmake File 118
CHAPTER 8 CUSTOM COMMANDS AND TARGETS 125
8.1 Portable Custom Commands 125
8.2 Using add_custom_command on a Target 127
8.3 Using add_custom_command to Generate a File 129
8.4 Adding a Custom Target 130
8.5 Specifying Dependencies and Outputs 133
8.6 When There Isn't One Rule for One Output 134
CHAPTER 9 CROSS COMPILING WITH CMAKE 137
9.1 Toolchain files 138
9.2 System inspection 142
9.3 Running executables built in the project itself 144
9.4 Cross compiling Hello world 147
9.5 Cross compiling for a microcontroller 152
9.6 Cross compiling an existing project 154
9.7 Cross compiling a complex project - VTK 157
9.8 Some tips and tricks 158
CHAPTER 10 AUTOMATION & TESTING WITH CMAKE 161
10.1 Automating and Testing with CMake and CTest 161
10.2 How does CMake Facilitate Testing? 162
10.3 Testing Using CTest 163
10.4 Additional Test Properties 166
10.5 Using CTest to Drive Complex Tests 167
10.6 Handling a Large Number of Tests 168
10.7 Producing Test Dashboards 169
10.8 Setting up Automated Dashboard Clients 178
10.9 Advanced CTest Scripting 185
10.10 Setting up a Dashboard Server 191
CHAPTER 11 PORTING CMAKE TO NEW PLATFORMS AND LANGUAGES 197
11.1 The Determine System Process 197
11.2 The Enable Language Process 198
11.3 Porting to a New Platform 200
11.4 Adding a New Language 202
11.5 Rule Variable Listing 202
11.6 Compiler and Platform Examples 204
11.7 Extending CMake 206
CHAPTER 12 TUTORIALS 211
12.1 A Basic Starting Point (Step 1) 211
12.2 Adding a Library (Step 2) 213
12.3 Installing and Testing (Step 3) 216
12.4 Adding System Introspection (Step 4) 218
12.5 Adding a Generated File and Generator (Step 5) 218
12.6 Building an Installer (Step 6) 223
12.7 Adding Support for a Dashboard (Step 7) 224
APPENDIX A - VARIABLES 225
Variables That Change Behavior 225
Variables That Describe the System 228
Variables for Languages 230
Variables that Control the Build 233
Variables that Provide Information 235
Variables In CMakeBackwardCompatibilityC.cmake 241
Variables in CMakeBackwardCompatibilityCXX.cmake 243
System Environment Variables That Affect CMake 243
APPENDIX B - CMAKE COMMAND REFERENCE 245
CMake Command-Line Options 245
CMake Generators 250
CTest Command-Line Options 251
CPack Command-Line Options 257
Listfile Commands 258
Extra CTest Listfile Commands 308
Compatibility Listfile Commands 310
APPENDIX C - CMAKE MODULES 317
Standard CMake Modules 317
APPENDIX D - PROPERTIES 367
Global Properties 367
Directory Properties 368
Target Properties 369
Test Properties 374
Sourcefile Properties 375
INDEX 381
More information about the CMake-Promote
mailing list