SlideShare uma empresa Scribd logo
1 de 54
Baixar para ler offline
© Integrated Computer Solutions, Inc. All Rights Reserved
An Introduction to CMake
Jeff Tranter <jtranter@ics.com> February, 2019
1
© Integrated Computer Solutions, Inc. All Rights Reserved
Agenda
What is CMake?
Features
A Simple Example
A More Complex Example
Qt Support
Qt Example
Qt Creator Support
CTest and CPack
Misc. Tips
Summary
Q&A
References
2
© Integrated Computer Solutions, Inc. All Rights Reserved
What is CMake?
• Cross-platform build system
• Sits on top of and leverages native build system
• Funded by KitWare
• Written in C++
• Support for Qt
• Current version 3.13.3
3
© Integrated Computer Solutions, Inc. All Rights Reserved
Features
• Supports:
• in place and out of place builds
• enabling several builds from the same source tree
• cross-compilation
• support for executables, static and dynamic libraries, generated files
• support for common build systems and SDKs
4
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
project(Demo1)
add_executable(Demo1 demo1.cpp)
5
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
demo1.cpp:
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
6
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
In source build:
% cd demo1
% ls
CMakeLists.txt demo1.cpp
7
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
% cmake .
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/demo1
8
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
% make
Scanning dependencies of target Demo1
[ 50%] Building CXX object
CMakeFiles/Demo1.dir/demo1.cpp.o
[100%] Linking CXX executable Demo1
[100%] Built target Demo1
% ./Demo1
Hello, world!
9
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
Generated files:
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
Demo1
Makefile
10
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
Out of source build:
% cd ..
% mkdir build
% cd build
11
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
% cmake ../demo1
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build
12
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
% make
Scanning dependencies of target Demo1
[ 50%] Building CXX object
CMakeFiles/Demo1.dir/demo1.cpp.o
[100%] Linking CXX executable Demo1
[100%] Built target Demo1
% ./Demo1
Hello, world!
13
© Integrated Computer Solutions, Inc. All Rights Reserved
A Simple Example
Using cmake-gui:
% cd demo1
% cmake-gui .
14
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
To add more source files:
add_executable(Demo2 demo2.cpp hello.cpp)
Or if you have many files:
add_executable(Demo2
demo2.cpp
hello.cpp
foo.cpp
bar.cpp
baz.cpp
)
15
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
Add a generated config file, in CMakeLists.txt:
# The version number.
set(Demo2_VERSION_MAJOR 1)
set(Demo2_VERSION_MINOR 0)
# Configure a header file to pass some of the CMake settings to source code
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
# Add the binary tree to the search path for include files
# so that we will find config.h
include_directories("${PROJECT_BINARY_DIR}")
16
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
config.h.in:
// The configured options and settings for Demo2
#define Demo2_VERSION_MAJOR @Demo2_VERSION_MAJOR@
#define Demo2_VERSION_MINOR @Demo2_VERSION_MINOR@
17
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
After running cmake, generated config.h:
// The configured options and settings for Demo2
#define Demo2_VERSION_MAJOR 1
#define Demo2_VERSION_MINOR 0
18
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
hello.h:
void hello();
hello.cpp:
#include <iostream>
void hello()
{
std::cout << "Hello, world!" << std::endl;
}
19
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
demo2.cpp:
#include <iostream>
#include "hello.h"
#include "config.h"
int main()
{
std::cout << "Demo2 version " << Demo2_VERSION_MAJOR
<< "." << Demo2_VERSION_MINOR << std::endl;
hello();
return 0;
}
20
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
Add a shared library:
• create mathlib folder for library functions
• create mathlib/mysqrt.cpp, mathlib/mysqrt.h
mathlib/CMakeLists.txt:
# Build a library of math functions
project(mathlib)
add_library(mathlib SHARED mysqrt.cpp)
21
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
Additions to top level CMakeLists.txt:
# Add library to include path
include_directories("${PROJECT_SOURCE_DIR}/mathlib")
add_subdirectory(mathlib)
# Link with math library
target_link_libraries(Demo2 mathlib)
22
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
Additions to demo2.cpp (highlighted):
#include <iostream>
#include "hello.h"
#include "config.h"
#include "mysqrt.h"
int main()
{
std::cout << "Demo2 version " << Demo2_VERSION_MAJOR << "." << Demo2_VERSION_MINOR <<
std::endl;
hello();
for (double n = 1; n <= 10; n++) {
std::cout << "mysqrt(" << n << ") = " << mysqrt(n) << std::endl;
}
return 0;
}
23
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
Add support for install. Additions to CMakeLists.txt:
# Add the install targets
install(TARGETS Demo2 DESTINATION bin)
install(FILES "${PROJECT_BINARY_DIR}/config.h" DESTINATION include)
Additions to mathlib/CMakeLists.txt:
# Install targets
install(TARGETS mathlib DESTINATION lib)
install(FILES mysqrt.h DESTINATION include)
24
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
Building it (out of source):
% mkdir build
% cd build/
% cmake ../demo2
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build
25
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
% make
Scanning dependencies of target mathlib
[ 20%] Building CXX object mathlib/CMakeFiles/mathlib.dir/mysqrt.cpp.o
[ 40%] Linking CXX shared library libmathlib.so
[ 40%] Built target mathlib
Scanning dependencies of target Demo2
[ 60%] Building CXX object CMakeFiles/Demo2.dir/demo2.cpp.o
[ 80%] Building CXX object CMakeFiles/Demo2.dir/hello.cpp.o
[100%] Linking CXX executable Demo2
[100%] Built target Demo2
26
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
% ./Demo2
Demo2 version 1.0
Hello, world!
mysqrt(1) = 1
mysqrt(2) = 1.41421
mysqrt(3) = 1.73205
mysqrt(4) = 2
mysqrt(5) = 2.23607
mysqrt(6) = 2.44949
mysqrt(7) = 2.64575
mysqrt(8) = 2.82843
mysqrt(9) = 3
mysqrt(10) = 3.16228
27
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
% sudo make install
[ 40%] Built target mathlib
[100%] Built target Demo2
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/Demo2
-- Set runtime path of "/usr/local/bin/Demo2" to ""
-- Installing: /usr/local/include/config.h
-- Installing: /usr/local/lib/libmathlib.so
-- Installing: /usr/local/include/mysqrt.h
28
© Integrated Computer Solutions, Inc. All Rights Reserved
A More Complex Example
% ls
CMakeCache.txt CMakeFiles cmake_install.cmake
config.h Demo2 Makefile mathlib
% ls mathlib
CMakeFiles cmake_install.cmake libmathlib.so Makefile
29
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Support
• Part of standard CMake
• Requires CMake 3.1.0 or later
• Knows how to find Qt libraries
• Knows how to handle moc, UI files, resources
30
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Support
• CMake can find and use Qt 4 and Qt 5 libraries
• Automatically invokes moc, uic, rcc as needed
• AUTOMOC property controls automatic generation of moc
• AUTOUIC property controls automatic invocation of uic for UI files
• AUTORCC property controls automatic invocation of rcc for resource
(.qrc) files
31
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
Simple Qt Creator wizard generated application:
main.cpp mainwindow.cpp mainwindow.h mainwindow.ui
32
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
CMakeLists.txt file:
cmake_minimum_required(VERSION 3.1.0)
project(Demo3)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)
33
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
CMakeLists.txt file (continued):
# Find the QtWidgets library
find_package(Qt5Widgets CONFIG REQUIRED)
# Populate a CMake variable with the sources
set(demo3_SRCS
mainwindow.ui
mainwindow.cpp
main.cpp
)
# Tell CMake to create the Demo3 executable
add_executable(Demo3 WIN32 ${demo3_SRCS})
# Use the Widgets module from Qt 5
target_link_libraries(Demo3 Qt5::Widgets)
34
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
% cmake ../demo3
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build
35
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
% make
Scanning dependencies of target Demo3_autogen
[ 20%] Automatic MOC and UIC for target Demo3
[ 20%] Built target Demo3_autogen
Scanning dependencies of target Demo3
[ 40%] Building CXX object CMakeFiles/Demo3.dir/mainwindow.cpp.o
[ 60%] Building CXX object CMakeFiles/Demo3.dir/main.cpp.o
[ 80%] Building CXX object CMakeFiles/Demo3.dir/Demo3_autogen/mocs_compilation.cpp.o
[100%] Linking CXX executable Demo3
[100%] Built target Demo3
% ./Demo3
36
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
• Larger spreadsheet program
• Qt 5 port of program from C++ GUI Programming with Qt 4 book
• Widget-based, 13 source files, 2 UI files, resource file, 1300 LOC
37
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
Original qmake project file spreadsheet.pro:
lessThan(QT_MAJOR_VERSION, 5): error(This project requires Qt 5 or later)
TEMPLATE = app
QT += widgets
HEADERS = cell.h 
finddialog.h 
gotocelldialog.h 
mainwindow.h 
sortdialog.h 
spreadsheet.h
SOURCES = cell.cpp 
finddialog.cpp 
gotocelldialog.cpp 
main.cpp 
mainwindow.cpp 
sortdialog.cpp 
spreadsheet.cpp
FORMS = gotocelldialog.ui 
sortdialog.ui
RESOURCES = spreadsheet.qrc
38
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
CMakeLists.txt file:
cmake_minimum_required(VERSION 3.1.0)
project(spreadsheet)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)
# Automatically handle resource files
set(CMAKE_AUTORCC ON)
39
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
CMakeLists.txt file (continued):
# Find the QtWidgets library
find_package(Qt5Widgets CONFIG REQUIRED)
# Populate a CMake variable with the sources
set(spreadsheet_SRCS
cell.cpp
finddialog.cpp
gotocelldialog.cpp
main.cpp
mainwindow.cpp
sortdialog.cpp
spreadsheet.cpp
spreadsheet.qrc
)
# Tell CMake to create the spreadsheet executable
add_executable(spreadsheet WIN32 ${spreadsheet_SRCS})
# Use the Widgets module from Qt 5
target_link_libraries(spreadsheet Qt5::Widgets)
40
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
% cmake ~/git/spreadsheet/
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build/work
41
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Example
% make
Scanning dependencies of target spreadsheet_autogen
[ 8%] Automatic MOC, UIC, and RCC for target spreadsheet
[ 8%] Built target spreadsheet_autogen
[ 16%] Generating qrc_spreadsheet.cpp
Scanning dependencies of target spreadsheet
[ 25%] Building CXX object CMakeFiles/spreadsheet.dir/cell.cpp.o
[ 33%] Building CXX object CMakeFiles/spreadsheet.dir/finddialog.cpp.o
[ 41%] Building CXX object CMakeFiles/spreadsheet.dir/gotocelldialog.cpp.o
[ 50%] Building CXX object CMakeFiles/spreadsheet.dir/main.cpp.o
[ 58%] Building CXX object CMakeFiles/spreadsheet.dir/mainwindow.cpp.o
[ 66%] Building CXX object CMakeFiles/spreadsheet.dir/sortdialog.cpp.o
[ 75%] Building CXX object CMakeFiles/spreadsheet.dir/spreadsheet.cpp.o
[ 83%] Building CXX object CMakeFiles/spreadsheet.dir/qrc_spreadsheet.cpp.o
[ 91%] Building CXX object
CMakeFiles/spreadsheet.dir/spreadsheet_autogen/mocs_compilation.cpp.o
[100%] Linking CXX executable spreadsheet
[100%] Built target spreadsheet
42
© Integrated Computer Solutions, Inc. All Rights Reserved
Localization Support
FIND_PACKAGE(Qt5LinguistTools)
# Translation files
SET(TS_FILES
spreadsheet_de.ts
spreadsheet_fr.ts
)
qt5_add_translation(QM_FILES ${TS_FILES})
# Tell CMake to create the spreadsheet executable
add_executable(spreadsheet WIN32 ${spreadsheet_SRCS} ${QM_FILES})
43
© Integrated Computer Solutions, Inc. All Rights Reserved
Localization Support
% cmake ../spreadsheet
...
[ 15%] Generating spreadsheet_fr.qm
Updating '/home/tranter/git/inactive/build/spreadsheet_fr.qm'...
Generated 1 translation(s) (1 finished and 0 unfinished)
Ignored 97 untranslated source text(s)
[ 23%] Generating spreadsheet_de.qm
Updating '/home/tranter/git/inactive/build/spreadsheet_de.qm'...
Generated 1 translation(s) (1 finished and 0 unfinished)
Ignored 97 untranslated source text(s)
...
% LANGUAGE=de ./spreadsheet
44
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Creator Support
• New project wizard can create a non-Qt C++ CMake project, but Qt-based
projects all default to qmake
• You can open an existing CMake-based project and use it
• Can edit CMake variables in project settings pane
• Keeps it's settings in a CMakeLists.txt.user file (similar to .pro.user files
with qmake)
• Make sure you enable the CMakeProjectManager plugin in Qt Creator
• Also check settings under Tools / Options... Kits/ CMake
45
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Creator Support
46
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Creator Support
47
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Creator Support
48
© Integrated Computer Solutions, Inc. All Rights Reserved
CTest
• CMake has support for defining and running unit tests
• Uses the ctest program
• See the documentation for details
49
© Integrated Computer Solutions, Inc. All Rights Reserved
CPack
• Support for packaging applications via the "cpack" program and
associated configuration files
• See the documentation for details
50
© Integrated Computer Solutions, Inc. All Rights Reserved
Misc. Tips
• For more verbose output when building: make VERBOSE=1
• Example of a sub-directories only project:
cmake_minimum_required(VERSION 3.0)
add_subdirectory(demo1)
add_subdirectory(demo2)
add_subdirectory(demo3)
51
© Integrated Computer Solutions, Inc. All Rights Reserved
Summary
• Use of CMake is increasing
• May be Qt's build system in Qt 6
• Relatively easy to use with Qt projects and Qt Creator
52
© Integrated Computer Solutions, Inc. All Rights Reserved
References
• https://en.wikipedia.org/wiki/CMake
• https://cmake.org/
• https://cmake.org/cmake-tutorial/
• https://cmake.org/cmake/help/latest/index.html
• https://cmake.org/download/
• https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#manual:
cmake-qt(7)
• http://doc.qt.io/qt-5/cmake-manual.html
• http://doc.qt.io/qtcreator/creator-project-cmake.html
• https://github.com/tranter/webinars/tree/master/CMake
• https://wiki.qt.io/CMake_Port
53
© Integrated Computer Solutions, Inc. All Rights Reserved
Q&A
• Questions?
• Any tips to share?
54

Mais conteúdo relacionado

Mais procurados

Introduction to GNU Make Programming Language
Introduction to GNU Make Programming LanguageIntroduction to GNU Make Programming Language
Introduction to GNU Make Programming LanguageShih-Hsiang Lin
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to gitEmanuele Olivetti
 
Conan.io - The C/C++ package manager for Developers
Conan.io - The C/C++ package manager for DevelopersConan.io - The C/C++ package manager for Developers
Conan.io - The C/C++ package manager for DevelopersUilian Ries
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programmingsudhir singh yadav
 
Git, CMake, Conan - How to ship and reuse our C++ projects?
Git, CMake, Conan - How to ship and reuse our C++ projects?Git, CMake, Conan - How to ship and reuse our C++ projects?
Git, CMake, Conan - How to ship and reuse our C++ projects?Mateusz Pusz
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeTeerapat Khunpech
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
GitHub - Présentation
GitHub - PrésentationGitHub - Présentation
GitHub - PrésentationDavid RIEHL
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in LinuxAdrian Huang
 
makefiles tutorial
makefiles tutorialmakefiles tutorial
makefiles tutorialvsubhashini
 
Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...
 Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion... Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...
Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...Codemotion
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in LinuxAnu Chaudhry
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examplesabclearnn
 

Mais procurados (20)

Introduction to GNU Make Programming Language
Introduction to GNU Make Programming LanguageIntroduction to GNU Make Programming Language
Introduction to GNU Make Programming Language
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 
Introduction to Makefile
Introduction to MakefileIntroduction to Makefile
Introduction to Makefile
 
Conan.io - The C/C++ package manager for Developers
Conan.io - The C/C++ package manager for DevelopersConan.io - The C/C++ package manager for Developers
Conan.io - The C/C++ package manager for Developers
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Git, CMake, Conan - How to ship and reuse our C++ projects?
Git, CMake, Conan - How to ship and reuse our C++ projects?Git, CMake, Conan - How to ship and reuse our C++ projects?
Git, CMake, Conan - How to ship and reuse our C++ projects?
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTree
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git commands
Git commandsGit commands
Git commands
 
Git basic
Git basicGit basic
Git basic
 
GitHub - Présentation
GitHub - PrésentationGitHub - Présentation
GitHub - Présentation
 
Toolchain
ToolchainToolchain
Toolchain
 
Introduction to Makefile
Introduction to MakefileIntroduction to Makefile
Introduction to Makefile
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in Linux
 
makefiles tutorial
makefiles tutorialmakefiles tutorial
makefiles tutorial
 
Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...
 Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion... Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...
Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in Linux
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 

Semelhante a An Introduction to CMake

Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt UsersICS
 
LOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdfLOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdfThninh2
 
pyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdfpyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdfAsher Sterkin
 
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021Altinity Ltd
 
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuXPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuThe Linux Foundation
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2 Adil Khan
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 
Effective Linux Development Using PetaLinux Tools 2017.4
Effective Linux Development Using PetaLinux Tools 2017.4Effective Linux Development Using PetaLinux Tools 2017.4
Effective Linux Development Using PetaLinux Tools 2017.4Zach Pfeffer
 
embeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxembeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxsangeetaSS
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
Ese 2008 RTSC Draft1
Ese 2008 RTSC Draft1Ese 2008 RTSC Draft1
Ese 2008 RTSC Draft1drusso
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with VoltaDaniel Fisher
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)Alexandre Gouaillard
 
SECCOM 2017 - Conan.io o gerente de pacote para C e C++
SECCOM 2017 - Conan.io o gerente de pacote para C e C++SECCOM 2017 - Conan.io o gerente de pacote para C e C++
SECCOM 2017 - Conan.io o gerente de pacote para C e C++Uilian Ries
 
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and CloudAltinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and CloudAltinity Ltd
 
Scaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington MeetupScaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington MeetupChris Shenton
 
RunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edgeRunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edgeStefano Stabellini
 

Semelhante a An Introduction to CMake (20)

Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt Users
 
Introduction to cython
Introduction to cythonIntroduction to cython
Introduction to cython
 
LOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdfLOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdf
 
pyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdfpyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdf
 
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021
Building ClickHouse and Making Your First Contribution: A Tutorial_06.10.2021
 
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuXPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 
Ddev workshop t3dd18
Ddev workshop t3dd18Ddev workshop t3dd18
Ddev workshop t3dd18
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Effective Linux Development Using PetaLinux Tools 2017.4
Effective Linux Development Using PetaLinux Tools 2017.4Effective Linux Development Using PetaLinux Tools 2017.4
Effective Linux Development Using PetaLinux Tools 2017.4
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
embeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxembeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptx
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Ese 2008 RTSC Draft1
Ese 2008 RTSC Draft1Ese 2008 RTSC Draft1
Ese 2008 RTSC Draft1
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
 
SECCOM 2017 - Conan.io o gerente de pacote para C e C++
SECCOM 2017 - Conan.io o gerente de pacote para C e C++SECCOM 2017 - Conan.io o gerente de pacote para C e C++
SECCOM 2017 - Conan.io o gerente de pacote para C e C++
 
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and CloudAltinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
 
Scaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington MeetupScaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington Meetup
 
RunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edgeRunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edge
 

Mais de ICS

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Practical Advice for FDA’s 510(k) Requirements.pdf
Practical Advice for FDA’s 510(k) Requirements.pdfPractical Advice for FDA’s 510(k) Requirements.pdf
Practical Advice for FDA’s 510(k) Requirements.pdfICS
 
Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...
Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...
Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...ICS
 
Overcoming CMake Configuration Issues Webinar
Overcoming CMake Configuration Issues WebinarOvercoming CMake Configuration Issues Webinar
Overcoming CMake Configuration Issues WebinarICS
 
Enhancing Quality and Test in Medical Device Design - Part 2.pdf
Enhancing Quality and Test in Medical Device Design - Part 2.pdfEnhancing Quality and Test in Medical Device Design - Part 2.pdf
Enhancing Quality and Test in Medical Device Design - Part 2.pdfICS
 
Designing and Managing IoT Devices for Rapid Deployment - Webinar.pdf
Designing and Managing IoT Devices for Rapid Deployment - Webinar.pdfDesigning and Managing IoT Devices for Rapid Deployment - Webinar.pdf
Designing and Managing IoT Devices for Rapid Deployment - Webinar.pdfICS
 
Quality and Test in Medical Device Design - Part 1.pdf
Quality and Test in Medical Device Design - Part 1.pdfQuality and Test in Medical Device Design - Part 1.pdf
Quality and Test in Medical Device Design - Part 1.pdfICS
 
Creating Digital Twins Using Rapid Development Techniques.pdf
Creating Digital Twins Using Rapid Development Techniques.pdfCreating Digital Twins Using Rapid Development Techniques.pdf
Creating Digital Twins Using Rapid Development Techniques.pdfICS
 
Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up ICS
 
Cybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdfCybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdfICS
 
MDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical DevicesMDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical DevicesICS
 
How to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management SolutionHow to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management SolutionICS
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsICS
 
IoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with AzureIoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with AzureICS
 
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...ICS
 
Qt Installer Framework
Qt Installer FrameworkQt Installer Framework
Qt Installer FrameworkICS
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsICS
 
Overcome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case StudyOvercome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case StudyICS
 
User Experience Design for IoT
User Experience Design for IoTUser Experience Design for IoT
User Experience Design for IoTICS
 
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdfSoftware Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdfICS
 

Mais de ICS (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Practical Advice for FDA’s 510(k) Requirements.pdf
Practical Advice for FDA’s 510(k) Requirements.pdfPractical Advice for FDA’s 510(k) Requirements.pdf
Practical Advice for FDA’s 510(k) Requirements.pdf
 
Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...
Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...
Accelerating Development of a Safety-Critical Cobot Welding System with Qt/QM...
 
Overcoming CMake Configuration Issues Webinar
Overcoming CMake Configuration Issues WebinarOvercoming CMake Configuration Issues Webinar
Overcoming CMake Configuration Issues Webinar
 
Enhancing Quality and Test in Medical Device Design - Part 2.pdf
Enhancing Quality and Test in Medical Device Design - Part 2.pdfEnhancing Quality and Test in Medical Device Design - Part 2.pdf
Enhancing Quality and Test in Medical Device Design - Part 2.pdf
 
Designing and Managing IoT Devices for Rapid Deployment - Webinar.pdf
Designing and Managing IoT Devices for Rapid Deployment - Webinar.pdfDesigning and Managing IoT Devices for Rapid Deployment - Webinar.pdf
Designing and Managing IoT Devices for Rapid Deployment - Webinar.pdf
 
Quality and Test in Medical Device Design - Part 1.pdf
Quality and Test in Medical Device Design - Part 1.pdfQuality and Test in Medical Device Design - Part 1.pdf
Quality and Test in Medical Device Design - Part 1.pdf
 
Creating Digital Twins Using Rapid Development Techniques.pdf
Creating Digital Twins Using Rapid Development Techniques.pdfCreating Digital Twins Using Rapid Development Techniques.pdf
Creating Digital Twins Using Rapid Development Techniques.pdf
 
Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up
 
Cybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdfCybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdf
 
MDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical DevicesMDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical Devices
 
How to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management SolutionHow to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management Solution
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory Teams
 
IoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with AzureIoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with Azure
 
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
 
Qt Installer Framework
Qt Installer FrameworkQt Installer Framework
Qt Installer Framework
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory Teams
 
Overcome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case StudyOvercome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case Study
 
User Experience Design for IoT
User Experience Design for IoTUser Experience Design for IoT
User Experience Design for IoT
 
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdfSoftware Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdf
 

Último

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 

Último (20)

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

An Introduction to CMake

  • 1. © Integrated Computer Solutions, Inc. All Rights Reserved An Introduction to CMake Jeff Tranter <jtranter@ics.com> February, 2019 1
  • 2. © Integrated Computer Solutions, Inc. All Rights Reserved Agenda What is CMake? Features A Simple Example A More Complex Example Qt Support Qt Example Qt Creator Support CTest and CPack Misc. Tips Summary Q&A References 2
  • 3. © Integrated Computer Solutions, Inc. All Rights Reserved What is CMake? • Cross-platform build system • Sits on top of and leverages native build system • Funded by KitWare • Written in C++ • Support for Qt • Current version 3.13.3 3
  • 4. © Integrated Computer Solutions, Inc. All Rights Reserved Features • Supports: • in place and out of place builds • enabling several builds from the same source tree • cross-compilation • support for executables, static and dynamic libraries, generated files • support for common build systems and SDKs 4
  • 5. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example CMakeLists.txt: cmake_minimum_required(VERSION 3.0) project(Demo1) add_executable(Demo1 demo1.cpp) 5
  • 6. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example demo1.cpp: #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; } 6
  • 7. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example In source build: % cd demo1 % ls CMakeLists.txt demo1.cpp 7
  • 8. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example % cmake . -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/demo1 8
  • 9. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example % make Scanning dependencies of target Demo1 [ 50%] Building CXX object CMakeFiles/Demo1.dir/demo1.cpp.o [100%] Linking CXX executable Demo1 [100%] Built target Demo1 % ./Demo1 Hello, world! 9
  • 10. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example Generated files: CMakeCache.txt CMakeFiles/ cmake_install.cmake Demo1 Makefile 10
  • 11. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example Out of source build: % cd .. % mkdir build % cd build 11
  • 12. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example % cmake ../demo1 -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build 12
  • 13. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example % make Scanning dependencies of target Demo1 [ 50%] Building CXX object CMakeFiles/Demo1.dir/demo1.cpp.o [100%] Linking CXX executable Demo1 [100%] Built target Demo1 % ./Demo1 Hello, world! 13
  • 14. © Integrated Computer Solutions, Inc. All Rights Reserved A Simple Example Using cmake-gui: % cd demo1 % cmake-gui . 14
  • 15. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example To add more source files: add_executable(Demo2 demo2.cpp hello.cpp) Or if you have many files: add_executable(Demo2 demo2.cpp hello.cpp foo.cpp bar.cpp baz.cpp ) 15
  • 16. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example Add a generated config file, in CMakeLists.txt: # The version number. set(Demo2_VERSION_MAJOR 1) set(Demo2_VERSION_MINOR 0) # Configure a header file to pass some of the CMake settings to source code configure_file( "${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/config.h" ) # Add the binary tree to the search path for include files # so that we will find config.h include_directories("${PROJECT_BINARY_DIR}") 16
  • 17. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example config.h.in: // The configured options and settings for Demo2 #define Demo2_VERSION_MAJOR @Demo2_VERSION_MAJOR@ #define Demo2_VERSION_MINOR @Demo2_VERSION_MINOR@ 17
  • 18. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example After running cmake, generated config.h: // The configured options and settings for Demo2 #define Demo2_VERSION_MAJOR 1 #define Demo2_VERSION_MINOR 0 18
  • 19. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example hello.h: void hello(); hello.cpp: #include <iostream> void hello() { std::cout << "Hello, world!" << std::endl; } 19
  • 20. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example demo2.cpp: #include <iostream> #include "hello.h" #include "config.h" int main() { std::cout << "Demo2 version " << Demo2_VERSION_MAJOR << "." << Demo2_VERSION_MINOR << std::endl; hello(); return 0; } 20
  • 21. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example Add a shared library: • create mathlib folder for library functions • create mathlib/mysqrt.cpp, mathlib/mysqrt.h mathlib/CMakeLists.txt: # Build a library of math functions project(mathlib) add_library(mathlib SHARED mysqrt.cpp) 21
  • 22. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example Additions to top level CMakeLists.txt: # Add library to include path include_directories("${PROJECT_SOURCE_DIR}/mathlib") add_subdirectory(mathlib) # Link with math library target_link_libraries(Demo2 mathlib) 22
  • 23. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example Additions to demo2.cpp (highlighted): #include <iostream> #include "hello.h" #include "config.h" #include "mysqrt.h" int main() { std::cout << "Demo2 version " << Demo2_VERSION_MAJOR << "." << Demo2_VERSION_MINOR << std::endl; hello(); for (double n = 1; n <= 10; n++) { std::cout << "mysqrt(" << n << ") = " << mysqrt(n) << std::endl; } return 0; } 23
  • 24. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example Add support for install. Additions to CMakeLists.txt: # Add the install targets install(TARGETS Demo2 DESTINATION bin) install(FILES "${PROJECT_BINARY_DIR}/config.h" DESTINATION include) Additions to mathlib/CMakeLists.txt: # Install targets install(TARGETS mathlib DESTINATION lib) install(FILES mysqrt.h DESTINATION include) 24
  • 25. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example Building it (out of source): % mkdir build % cd build/ % cmake ../demo2 -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build 25
  • 26. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example % make Scanning dependencies of target mathlib [ 20%] Building CXX object mathlib/CMakeFiles/mathlib.dir/mysqrt.cpp.o [ 40%] Linking CXX shared library libmathlib.so [ 40%] Built target mathlib Scanning dependencies of target Demo2 [ 60%] Building CXX object CMakeFiles/Demo2.dir/demo2.cpp.o [ 80%] Building CXX object CMakeFiles/Demo2.dir/hello.cpp.o [100%] Linking CXX executable Demo2 [100%] Built target Demo2 26
  • 27. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example % ./Demo2 Demo2 version 1.0 Hello, world! mysqrt(1) = 1 mysqrt(2) = 1.41421 mysqrt(3) = 1.73205 mysqrt(4) = 2 mysqrt(5) = 2.23607 mysqrt(6) = 2.44949 mysqrt(7) = 2.64575 mysqrt(8) = 2.82843 mysqrt(9) = 3 mysqrt(10) = 3.16228 27
  • 28. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example % sudo make install [ 40%] Built target mathlib [100%] Built target Demo2 Install the project... -- Install configuration: "" -- Installing: /usr/local/bin/Demo2 -- Set runtime path of "/usr/local/bin/Demo2" to "" -- Installing: /usr/local/include/config.h -- Installing: /usr/local/lib/libmathlib.so -- Installing: /usr/local/include/mysqrt.h 28
  • 29. © Integrated Computer Solutions, Inc. All Rights Reserved A More Complex Example % ls CMakeCache.txt CMakeFiles cmake_install.cmake config.h Demo2 Makefile mathlib % ls mathlib CMakeFiles cmake_install.cmake libmathlib.so Makefile 29
  • 30. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Support • Part of standard CMake • Requires CMake 3.1.0 or later • Knows how to find Qt libraries • Knows how to handle moc, UI files, resources 30
  • 31. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Support • CMake can find and use Qt 4 and Qt 5 libraries • Automatically invokes moc, uic, rcc as needed • AUTOMOC property controls automatic generation of moc • AUTOUIC property controls automatic invocation of uic for UI files • AUTORCC property controls automatic invocation of rcc for resource (.qrc) files 31
  • 32. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example Simple Qt Creator wizard generated application: main.cpp mainwindow.cpp mainwindow.h mainwindow.ui 32
  • 33. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example CMakeLists.txt file: cmake_minimum_required(VERSION 3.1.0) project(Demo3) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed set(CMAKE_AUTOMOC ON) # Create code from a list of Qt designer ui files set(CMAKE_AUTOUIC ON) 33
  • 34. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example CMakeLists.txt file (continued): # Find the QtWidgets library find_package(Qt5Widgets CONFIG REQUIRED) # Populate a CMake variable with the sources set(demo3_SRCS mainwindow.ui mainwindow.cpp main.cpp ) # Tell CMake to create the Demo3 executable add_executable(Demo3 WIN32 ${demo3_SRCS}) # Use the Widgets module from Qt 5 target_link_libraries(Demo3 Qt5::Widgets) 34
  • 35. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example % cmake ../demo3 -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build 35
  • 36. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example % make Scanning dependencies of target Demo3_autogen [ 20%] Automatic MOC and UIC for target Demo3 [ 20%] Built target Demo3_autogen Scanning dependencies of target Demo3 [ 40%] Building CXX object CMakeFiles/Demo3.dir/mainwindow.cpp.o [ 60%] Building CXX object CMakeFiles/Demo3.dir/main.cpp.o [ 80%] Building CXX object CMakeFiles/Demo3.dir/Demo3_autogen/mocs_compilation.cpp.o [100%] Linking CXX executable Demo3 [100%] Built target Demo3 % ./Demo3 36
  • 37. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example • Larger spreadsheet program • Qt 5 port of program from C++ GUI Programming with Qt 4 book • Widget-based, 13 source files, 2 UI files, resource file, 1300 LOC 37
  • 38. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example Original qmake project file spreadsheet.pro: lessThan(QT_MAJOR_VERSION, 5): error(This project requires Qt 5 or later) TEMPLATE = app QT += widgets HEADERS = cell.h finddialog.h gotocelldialog.h mainwindow.h sortdialog.h spreadsheet.h SOURCES = cell.cpp finddialog.cpp gotocelldialog.cpp main.cpp mainwindow.cpp sortdialog.cpp spreadsheet.cpp FORMS = gotocelldialog.ui sortdialog.ui RESOURCES = spreadsheet.qrc 38
  • 39. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example CMakeLists.txt file: cmake_minimum_required(VERSION 3.1.0) project(spreadsheet) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed set(CMAKE_AUTOMOC ON) # Create code from a list of Qt designer ui files set(CMAKE_AUTOUIC ON) # Automatically handle resource files set(CMAKE_AUTORCC ON) 39
  • 40. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example CMakeLists.txt file (continued): # Find the QtWidgets library find_package(Qt5Widgets CONFIG REQUIRED) # Populate a CMake variable with the sources set(spreadsheet_SRCS cell.cpp finddialog.cpp gotocelldialog.cpp main.cpp mainwindow.cpp sortdialog.cpp spreadsheet.cpp spreadsheet.qrc ) # Tell CMake to create the spreadsheet executable add_executable(spreadsheet WIN32 ${spreadsheet_SRCS}) # Use the Widgets module from Qt 5 target_link_libraries(spreadsheet Qt5::Widgets) 40
  • 41. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example % cmake ~/git/spreadsheet/ -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/tranter/git/jtranter/webinars/CMake/build/work 41
  • 42. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Example % make Scanning dependencies of target spreadsheet_autogen [ 8%] Automatic MOC, UIC, and RCC for target spreadsheet [ 8%] Built target spreadsheet_autogen [ 16%] Generating qrc_spreadsheet.cpp Scanning dependencies of target spreadsheet [ 25%] Building CXX object CMakeFiles/spreadsheet.dir/cell.cpp.o [ 33%] Building CXX object CMakeFiles/spreadsheet.dir/finddialog.cpp.o [ 41%] Building CXX object CMakeFiles/spreadsheet.dir/gotocelldialog.cpp.o [ 50%] Building CXX object CMakeFiles/spreadsheet.dir/main.cpp.o [ 58%] Building CXX object CMakeFiles/spreadsheet.dir/mainwindow.cpp.o [ 66%] Building CXX object CMakeFiles/spreadsheet.dir/sortdialog.cpp.o [ 75%] Building CXX object CMakeFiles/spreadsheet.dir/spreadsheet.cpp.o [ 83%] Building CXX object CMakeFiles/spreadsheet.dir/qrc_spreadsheet.cpp.o [ 91%] Building CXX object CMakeFiles/spreadsheet.dir/spreadsheet_autogen/mocs_compilation.cpp.o [100%] Linking CXX executable spreadsheet [100%] Built target spreadsheet 42
  • 43. © Integrated Computer Solutions, Inc. All Rights Reserved Localization Support FIND_PACKAGE(Qt5LinguistTools) # Translation files SET(TS_FILES spreadsheet_de.ts spreadsheet_fr.ts ) qt5_add_translation(QM_FILES ${TS_FILES}) # Tell CMake to create the spreadsheet executable add_executable(spreadsheet WIN32 ${spreadsheet_SRCS} ${QM_FILES}) 43
  • 44. © Integrated Computer Solutions, Inc. All Rights Reserved Localization Support % cmake ../spreadsheet ... [ 15%] Generating spreadsheet_fr.qm Updating '/home/tranter/git/inactive/build/spreadsheet_fr.qm'... Generated 1 translation(s) (1 finished and 0 unfinished) Ignored 97 untranslated source text(s) [ 23%] Generating spreadsheet_de.qm Updating '/home/tranter/git/inactive/build/spreadsheet_de.qm'... Generated 1 translation(s) (1 finished and 0 unfinished) Ignored 97 untranslated source text(s) ... % LANGUAGE=de ./spreadsheet 44
  • 45. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Creator Support • New project wizard can create a non-Qt C++ CMake project, but Qt-based projects all default to qmake • You can open an existing CMake-based project and use it • Can edit CMake variables in project settings pane • Keeps it's settings in a CMakeLists.txt.user file (similar to .pro.user files with qmake) • Make sure you enable the CMakeProjectManager plugin in Qt Creator • Also check settings under Tools / Options... Kits/ CMake 45
  • 46. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Creator Support 46
  • 47. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Creator Support 47
  • 48. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Creator Support 48
  • 49. © Integrated Computer Solutions, Inc. All Rights Reserved CTest • CMake has support for defining and running unit tests • Uses the ctest program • See the documentation for details 49
  • 50. © Integrated Computer Solutions, Inc. All Rights Reserved CPack • Support for packaging applications via the "cpack" program and associated configuration files • See the documentation for details 50
  • 51. © Integrated Computer Solutions, Inc. All Rights Reserved Misc. Tips • For more verbose output when building: make VERBOSE=1 • Example of a sub-directories only project: cmake_minimum_required(VERSION 3.0) add_subdirectory(demo1) add_subdirectory(demo2) add_subdirectory(demo3) 51
  • 52. © Integrated Computer Solutions, Inc. All Rights Reserved Summary • Use of CMake is increasing • May be Qt's build system in Qt 6 • Relatively easy to use with Qt projects and Qt Creator 52
  • 53. © Integrated Computer Solutions, Inc. All Rights Reserved References • https://en.wikipedia.org/wiki/CMake • https://cmake.org/ • https://cmake.org/cmake-tutorial/ • https://cmake.org/cmake/help/latest/index.html • https://cmake.org/download/ • https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#manual: cmake-qt(7) • http://doc.qt.io/qt-5/cmake-manual.html • http://doc.qt.io/qtcreator/creator-project-cmake.html • https://github.com/tranter/webinars/tree/master/CMake • https://wiki.qt.io/CMake_Port 53
  • 54. © Integrated Computer Solutions, Inc. All Rights Reserved Q&A • Questions? • Any tips to share? 54