SlideShare a Scribd company logo
CMake introduction
1- PRINCIPLES AND POTENTIALS 
1.1- INTRO 
1.2- WORKFLOW 
2- CROSSPLATEFORM USAGES 
2.1- USEFUL VARIABLES AND USE 
2.2- GUI AND CACHE 
3- FIND PACKAGE 
4- ADVANCED AND MORE 
5- INSTALLATION, EXPORT, PACKAGE 
(NOT PRESENTED HERE) 
jerome.esnault@inria.fr 02 July 2014 - 2
1- Principles and potentials 
1.1- Intro 
• Objectif : 
Crossplateform toolbox (linux/windows/mac) to help to the build / creation / 
compilation of C/C++ projects. 
• Usage : 
Hight level of script language 
• Generation : 
Files which are used for the chosen developement environnement in the current 
platform 
• Developped by KitWare in open source version and started in 1999 for ITK 
projects then used by VTK project. 
• At this moment at 3.0 version and used by many big projects like OGRE, 
OpenSceneGraph… 
http://www.ohloh.net/p/cmake?ref=sample 
jerome.esnault@inria.fr 02 July 2014 - 3
1- Principles and potentials 
CMake / Ctest / CPack 
Compiler 
jerome.esnault@inria.fr 02 July 2014 - 4 
Modules 
CMake 
[*.cmake] 
[*.in] 
Sources C/C++/Java CMakeLists.txt / Ctest scripts 
CMakeCache.txt 
Native build system files [MakeFiles, sln…] 
Targets [executables, libraries, plugins] 
1.2- Workflow
2- CROSSPLATEFORM USAGES 
Cmake [options] <path-to-source> 
$ cd projectName 
$ mkdir build && cd build 
$ cmake .. 
$ make install 
$ cd projectName 
$ mkdir build && cd build 
$ cmake-gui .. 
$ make install 
Generators / IDE compatibilities : 
• Borland 
• MinGW 
• Nmake 
• Unix 
• Visual Studio 6/7/8/9/10/11 
• Xcode 
• codeBlocks 
• Eclipse 
• QtCreator 
3 tree structures : 
• CMAKE_SOURCE_DIR 
• CMAKE_BINARY_DIR 
• CMAKE_INSTALL_PREFIX 
OR 
jerome.esnault@inria.fr 02 July 2014 - 5
2- CROSSPLATEFORM USAGES 
2.1- Useful variables and use CMake_presentation 
CMAKE_SOURCE_DIR CMAKE_BINARY_DIR CMAKE_INSTALL_PREFIX 
rootFolder 
CMakeLists.txt 
Cmake_minimum_required(VERSION 2.8) 
Project(foo) 
… 
Add_subdirectory(subFolder1) 
… 
subFolder1 
CMakeLists.txt 
build 
Same structure 
but with generated 
or temp files 
Project(bar) 
… 
Add_executable(myApp mySources) 
subFolder2 
CMakeLists.txt 
CMAKE_CURRENT_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR 
(=subFolder2) 
CMakeFiles 
Structure defined by 
‘install()’ cmake 
instruction 
jerome.esnault@inria.fr 02 July 2014 - 6
2- CROSSPLATEFORM USAGES 
2.1- Useful variables and use CMake_Useful_Variables 
CMAKE_SOURCE_DIR 
(=path to rootFolder) 
CMAKE_BINARY_DIR 
(=path to build) 
CMAKE_PROJECT_NAME (=foo) CMAKE_LIBRARY_OUTPUT_DIRECTORY 
CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
CMAKE_RUNTIME_OUTPUT_DIRECTORY 
PROJECT_NAME (=bar) 
UNIX WIN32 APPLE 
MSVC 
jerome.esnault@inria.fr 02 July 2014 - 7 
bool 
Place where target name will be generated, see: 
Add_executable(name sources) 
Add_library(name srouces [STATIC|SHARED])
2- CROSSPLATEFORM USAGES 
2.1- Useful variables and use 
CMake instructions act on : 
• new project / sub-project creations 
CMake_Wiki 
• cmake variables and list (cached or not) 
(content of a cmake variableis ${myCmakeVar}) 
• system file manipulation 
• building out of source, installation and packaging an installer 
• the « automatique » research of dependencies package 
and files 
• the cmake function and macros creation (for reusable code) 
• the customization of target properties 
or systeme file properties 
Project(…) 
Add_subdirectory(…) 
Add_dependencies(…) 
Include_directories(…) 
Target_link_libraries(…) 
Set(…) – unset(…) 
List(…) 
Option(…) 
Foreach() … endforeach() 
If() … else() … endif() 
File(…) - String(…) 
Configure_file(…) 
Install(…) 
Find_package(…) 
Find_library(…) 
Find_file(…) – Find_path(…) 
Include(…) 
Function()…endfunction() 
Macro()…endmacro() 
Add_definition(…) 
Define_property(…) 
jerome.esnault@inria.fr 02 July 2014 - 8
2- CROSSPLATEFORM USAGES 
2.2- GUI and CACHE 
CMAKE_BINARY_DIR 
(=path to build) 
CMakeCache.txt 
Foo.sln 
Cmake generated 
or temp files 
jerome.esnault@inria.fr 02 July 2014 - 9
2- CROSSPLATEFORM USAGES 
QUESTION ? 
EXAMPLES with current IBR projects, 
Showing differences between 
spixel_warp 
Ulrvr 
Ibr_common 
jerome.esnault@inria.fr 02 July 2014 - 10
3- Find Package 
3.1- How to use 
CMake_find 
find_package(<package> [version] [EXACT] [QUIET] 
[REQUIRED] [[COMPONENTS] [components...]] 
[CONFIG|NO_MODULE] 
[NO_POLICY_SCOPE] 
[NAMES name1 [name2 ...]] 
[CONFIGS config1 [config2 ...]] 
[HINTS path1 [path2 ... ]] 
[PATHS path1 [path2 ... ]] 
[PATH_SUFFIXES suffix1 [suffix2 ...]] 
[NO_DEFAULT_PATH] 
[NO_CMAKE_ENVIRONMENT_PATH] 
[NO_CMAKE_PATH] 
[NO_SYSTEM_ENVIRONMENT_PATH] 
[NO_CMAKE_PACKAGE_REGISTRY] 
[NO_CMAKE_BUILDS_PATH] 
[NO_CMAKE_SYSTEM_PATH] 
[NO_CMAKE_SYSTEM_PACKAGE_REGISTRY] 
[CMAKE_FIND_ROOT_PATH_BOTH | 
ONLY_CMAKE_FIND_ROOT_PATH | 
NO_CMAKE_FIND_ROOT_PATH]) 
2 ways : 
1. With a Find<package>.cmake module file 
2. With a cmake config file provided by the dependency 
jerome.esnault@inria.fr 02 July 2014 - 11
3- Find Package 
3.1- How to use 
CMake_find 
2 ways : 
1. With a Find<package>.cmake module file 
find_package (foo) Will look for Findfoo.cmake into : 1- CMAKE_MODULE_PATH list of dirs if not empty 
2- ${CMAKE_ROOT}/Modules 
The objective of a Findfoo.cmake try to locate libraries and includes files (and executables) to 
let user then use cmake variable to abstract paths and names whatever is the platform. 
Findfoo.cmake may use : 
find_library (<VAR> name1 [path1 path2 ...]) 
find_path (<VAR> name1 [path1 path2 ...]) 
find_file (<VAR> name1 [path1 path2 ...]) 
find_program (<VAR> name1 [path1 path2 ...]) 
FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> 
Paths may be set using : 
* foo_DIR cmake variable 
* $ENV{name} cmake variable 
* [HKEY_LOCAL_MACHINE …] 
(DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) 
For find_* cmake instructions, some additional global list of dirs may be set with : 
CMAKE_INCLUDE_PATH 
CMAKE_LIBRARY_PATH 
CMAKE_PREFIX_PATH 
jerome.esnault@inria.fr 02 July 2014 - 12
3- Find Package 
3.1- How to use 
CMake_find 
2 ways : 
1. With a Find<package>.cmake module file 
Inside Findfoo.cmake, we have some ‘ready to use’ cmake variable according to the 
arguments passed to the find_package(…), for example : 
foo_FIND_REQUIRED if REQUIRED was given 
foo_FIND_COMPONENTS list if COMPONENTS was given with list of modules to find 
EXAMPLES OR QUESTION ? 
See standard FindOpenAL.cmake or FindGDAL.cmake 
for simple examples. 
See standard FindBoost.cmake or FindQt4.cmake for 
complexe examples. 
jerome.esnault@inria.fr 02 July 2014 - 13
3- Find Package 
3.1- How to use 
CMake_find 
2 ways : 
2. With a cmake config file provided by the dependency 
The 3rdParty project may provide a cmake config file which was generated by 
cmake on installation time (using the EXPORT command) 
On your side, if no Findfoo.cmake was found, cmake try to locate instead : 
fooConfig.cmake or foo-config.cmake file (as you need at least to provide foo_DIR 
which point to this file). 
For advanced cmake user, 
Should be discussed latter. 
jerome.esnault@inria.fr 02 July 2014 - 14
4- ADVANCED AND MORE 
For compiler command line: 
CMAKE_CXX_FLAGS cmake var 
For preprocessors : 
add_definitions(-DFOO -DBAR ...) 
configure_file(<input> <output> 
For more examples: 
suitesparse-metis-for-windows 
[COPYONLY] [ESCAPE_QUOTES] [@ONLY] 
[NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) 
For custom targets : 
add_custom_target(Name [ALL] [command1 [args1...]] 
[COMMAND command2 [args2...] ...] 
[DEPENDS depend depend depend ... ] 
[WORKING_DIRECTORY dir] 
[COMMENT comment] [VERBATIM] 
[SOURCES src1 [src2...]]) 
For installation (see doxygen example) : 
Install(…) (multiples signatures) 
jerome.esnault@inria.fr 02 July 2014 - 15
5-INSTALLATION, EXPORT, PACKAGE 
TIPS here 
And here 
jerome.esnault@inria.fr 02 July 2014 - 16
ANDROID && iOS toolchain 
• ANDROID : https://github.com/taka-no-me/android-cmake 
• iOS : https://code.google.com/p/ios-cmake/ 
• Global integration with Qt and QtCreator topic : 
(http://qt-project.org/forums/viewthread/36359) 
jerome.esnault@inria.fr 02 July 2014 - 17

More Related Content

PDF
CMake Tutorial
PDF
CMake - Introduction and best practices
PDF
Effective CMake
PPTX
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
PDF
CMake: Improving Software Quality and Process
PDF
CMake Talk 2008
PDF
Cmake kitware
CMake Tutorial
CMake - Introduction and best practices
Effective CMake
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CMake: Improving Software Quality and Process
CMake Talk 2008
Cmake kitware

What's hot (19)

PPTX
C++ for the Web
ODP
Autotools
PPT
Introduction to Makefile
ODP
PDF
Introducing DeploYii 0.5
PPSX
Sunil phani's take on windows powershell
PPTX
Powershell alias
PDF
Makefile
PDF
Introduction to GNU Make Programming Language
ODP
Introduction To Makefile
PDF
$ make install
PDF
PM : code faster
PDF
Sql Injection 0wning Enterprise
ODP
ZopeSkel & Buildout packages
PPT
Why and How Powershell will rule the Command Line - Barcamp LA 4
PDF
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
C++ for the Web
Autotools
Introduction to Makefile
Introducing DeploYii 0.5
Sunil phani's take on windows powershell
Powershell alias
Makefile
Introduction to GNU Make Programming Language
Introduction To Makefile
$ make install
PM : code faster
Sql Injection 0wning Enterprise
ZopeSkel & Buildout packages
Why and How Powershell will rule the Command Line - Barcamp LA 4
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
Ad

Similar to short_intro_to_CMake_(inria_REVES_team) (20)

PDF
CMake_Tutorial.pdf
PDF
CMake best practices
PDF
cmake.pdf
PPTX
Consuming Libraries with CMake
PDF
Basic Cmake for Qt Users
 
PDF
Overcoming CMake Configuration Issues Webinar
 
PDF
An Introduction to CMake
 
PDF
C make tutorial
PDF
Introduction to CMake
PDF
Gnubs pres-foss-cdac-sem
PDF
Gnubs-pres-foss-cdac-sem
PDF
Build Systems with autoconf, automake and libtool [updated]
PDF
Basicsof c make and git for a hello qt application
PPTX
PDF
LOSS_C11- Programming Linux 20221006.pdf
PDF
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
PPTX
Cscope and ctags
PPT
Autoconf&Automake
PPTX
Autotools pratical training
PDF
makefiles tutorial
CMake_Tutorial.pdf
CMake best practices
cmake.pdf
Consuming Libraries with CMake
Basic Cmake for Qt Users
 
Overcoming CMake Configuration Issues Webinar
 
An Introduction to CMake
 
C make tutorial
Introduction to CMake
Gnubs pres-foss-cdac-sem
Gnubs-pres-foss-cdac-sem
Build Systems with autoconf, automake and libtool [updated]
Basicsof c make and git for a hello qt application
LOSS_C11- Programming Linux 20221006.pdf
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
Cscope and ctags
Autoconf&Automake
Autotools pratical training
makefiles tutorial
Ad

Recently uploaded (20)

PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PDF
AI in Product Development-omnex systems
PDF
System and Network Administration Chapter 2
PPTX
history of c programming in notes for students .pptx
PDF
medical staffing services at VALiNTRY
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Design an Analysis of Algorithms I-SECS-1021-03
Nekopoi APK 2025 free lastest update
AI in Product Development-omnex systems
System and Network Administration Chapter 2
history of c programming in notes for students .pptx
medical staffing services at VALiNTRY
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Design an Analysis of Algorithms II-SECS-1021-03
Upgrade and Innovation Strategies for SAP ERP Customers
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Operating system designcfffgfgggggggvggggggggg
wealthsignaloriginal-com-DS-text-... (1).pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Reimagine Home Health with the Power of Agentic AI​
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Navsoft: AI-Powered Business Solutions & Custom Software Development

short_intro_to_CMake_(inria_REVES_team)

  • 2. 1- PRINCIPLES AND POTENTIALS 1.1- INTRO 1.2- WORKFLOW 2- CROSSPLATEFORM USAGES 2.1- USEFUL VARIABLES AND USE 2.2- GUI AND CACHE 3- FIND PACKAGE 4- ADVANCED AND MORE 5- INSTALLATION, EXPORT, PACKAGE (NOT PRESENTED HERE) jerome.esnault@inria.fr 02 July 2014 - 2
  • 3. 1- Principles and potentials 1.1- Intro • Objectif : Crossplateform toolbox (linux/windows/mac) to help to the build / creation / compilation of C/C++ projects. • Usage : Hight level of script language • Generation : Files which are used for the chosen developement environnement in the current platform • Developped by KitWare in open source version and started in 1999 for ITK projects then used by VTK project. • At this moment at 3.0 version and used by many big projects like OGRE, OpenSceneGraph… http://www.ohloh.net/p/cmake?ref=sample jerome.esnault@inria.fr 02 July 2014 - 3
  • 4. 1- Principles and potentials CMake / Ctest / CPack Compiler jerome.esnault@inria.fr 02 July 2014 - 4 Modules CMake [*.cmake] [*.in] Sources C/C++/Java CMakeLists.txt / Ctest scripts CMakeCache.txt Native build system files [MakeFiles, sln…] Targets [executables, libraries, plugins] 1.2- Workflow
  • 5. 2- CROSSPLATEFORM USAGES Cmake [options] <path-to-source> $ cd projectName $ mkdir build && cd build $ cmake .. $ make install $ cd projectName $ mkdir build && cd build $ cmake-gui .. $ make install Generators / IDE compatibilities : • Borland • MinGW • Nmake • Unix • Visual Studio 6/7/8/9/10/11 • Xcode • codeBlocks • Eclipse • QtCreator 3 tree structures : • CMAKE_SOURCE_DIR • CMAKE_BINARY_DIR • CMAKE_INSTALL_PREFIX OR jerome.esnault@inria.fr 02 July 2014 - 5
  • 6. 2- CROSSPLATEFORM USAGES 2.1- Useful variables and use CMake_presentation CMAKE_SOURCE_DIR CMAKE_BINARY_DIR CMAKE_INSTALL_PREFIX rootFolder CMakeLists.txt Cmake_minimum_required(VERSION 2.8) Project(foo) … Add_subdirectory(subFolder1) … subFolder1 CMakeLists.txt build Same structure but with generated or temp files Project(bar) … Add_executable(myApp mySources) subFolder2 CMakeLists.txt CMAKE_CURRENT_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR (=subFolder2) CMakeFiles Structure defined by ‘install()’ cmake instruction jerome.esnault@inria.fr 02 July 2014 - 6
  • 7. 2- CROSSPLATEFORM USAGES 2.1- Useful variables and use CMake_Useful_Variables CMAKE_SOURCE_DIR (=path to rootFolder) CMAKE_BINARY_DIR (=path to build) CMAKE_PROJECT_NAME (=foo) CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_RUNTIME_OUTPUT_DIRECTORY PROJECT_NAME (=bar) UNIX WIN32 APPLE MSVC jerome.esnault@inria.fr 02 July 2014 - 7 bool Place where target name will be generated, see: Add_executable(name sources) Add_library(name srouces [STATIC|SHARED])
  • 8. 2- CROSSPLATEFORM USAGES 2.1- Useful variables and use CMake instructions act on : • new project / sub-project creations CMake_Wiki • cmake variables and list (cached or not) (content of a cmake variableis ${myCmakeVar}) • system file manipulation • building out of source, installation and packaging an installer • the « automatique » research of dependencies package and files • the cmake function and macros creation (for reusable code) • the customization of target properties or systeme file properties Project(…) Add_subdirectory(…) Add_dependencies(…) Include_directories(…) Target_link_libraries(…) Set(…) – unset(…) List(…) Option(…) Foreach() … endforeach() If() … else() … endif() File(…) - String(…) Configure_file(…) Install(…) Find_package(…) Find_library(…) Find_file(…) – Find_path(…) Include(…) Function()…endfunction() Macro()…endmacro() Add_definition(…) Define_property(…) jerome.esnault@inria.fr 02 July 2014 - 8
  • 9. 2- CROSSPLATEFORM USAGES 2.2- GUI and CACHE CMAKE_BINARY_DIR (=path to build) CMakeCache.txt Foo.sln Cmake generated or temp files jerome.esnault@inria.fr 02 July 2014 - 9
  • 10. 2- CROSSPLATEFORM USAGES QUESTION ? EXAMPLES with current IBR projects, Showing differences between spixel_warp Ulrvr Ibr_common jerome.esnault@inria.fr 02 July 2014 - 10
  • 11. 3- Find Package 3.1- How to use CMake_find find_package(<package> [version] [EXACT] [QUIET] [REQUIRED] [[COMPONENTS] [components...]] [CONFIG|NO_MODULE] [NO_POLICY_SCOPE] [NAMES name1 [name2 ...]] [CONFIGS config1 [config2 ...]] [HINTS path1 [path2 ... ]] [PATHS path1 [path2 ... ]] [PATH_SUFFIXES suffix1 [suffix2 ...]] [NO_DEFAULT_PATH] [NO_CMAKE_ENVIRONMENT_PATH] [NO_CMAKE_PATH] [NO_SYSTEM_ENVIRONMENT_PATH] [NO_CMAKE_PACKAGE_REGISTRY] [NO_CMAKE_BUILDS_PATH] [NO_CMAKE_SYSTEM_PATH] [NO_CMAKE_SYSTEM_PACKAGE_REGISTRY] [CMAKE_FIND_ROOT_PATH_BOTH | ONLY_CMAKE_FIND_ROOT_PATH | NO_CMAKE_FIND_ROOT_PATH]) 2 ways : 1. With a Find<package>.cmake module file 2. With a cmake config file provided by the dependency jerome.esnault@inria.fr 02 July 2014 - 11
  • 12. 3- Find Package 3.1- How to use CMake_find 2 ways : 1. With a Find<package>.cmake module file find_package (foo) Will look for Findfoo.cmake into : 1- CMAKE_MODULE_PATH list of dirs if not empty 2- ${CMAKE_ROOT}/Modules The objective of a Findfoo.cmake try to locate libraries and includes files (and executables) to let user then use cmake variable to abstract paths and names whatever is the platform. Findfoo.cmake may use : find_library (<VAR> name1 [path1 path2 ...]) find_path (<VAR> name1 [path1 path2 ...]) find_file (<VAR> name1 [path1 path2 ...]) find_program (<VAR> name1 [path1 path2 ...]) FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> Paths may be set using : * foo_DIR cmake variable * $ENV{name} cmake variable * [HKEY_LOCAL_MACHINE …] (DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) For find_* cmake instructions, some additional global list of dirs may be set with : CMAKE_INCLUDE_PATH CMAKE_LIBRARY_PATH CMAKE_PREFIX_PATH jerome.esnault@inria.fr 02 July 2014 - 12
  • 13. 3- Find Package 3.1- How to use CMake_find 2 ways : 1. With a Find<package>.cmake module file Inside Findfoo.cmake, we have some ‘ready to use’ cmake variable according to the arguments passed to the find_package(…), for example : foo_FIND_REQUIRED if REQUIRED was given foo_FIND_COMPONENTS list if COMPONENTS was given with list of modules to find EXAMPLES OR QUESTION ? See standard FindOpenAL.cmake or FindGDAL.cmake for simple examples. See standard FindBoost.cmake or FindQt4.cmake for complexe examples. jerome.esnault@inria.fr 02 July 2014 - 13
  • 14. 3- Find Package 3.1- How to use CMake_find 2 ways : 2. With a cmake config file provided by the dependency The 3rdParty project may provide a cmake config file which was generated by cmake on installation time (using the EXPORT command) On your side, if no Findfoo.cmake was found, cmake try to locate instead : fooConfig.cmake or foo-config.cmake file (as you need at least to provide foo_DIR which point to this file). For advanced cmake user, Should be discussed latter. jerome.esnault@inria.fr 02 July 2014 - 14
  • 15. 4- ADVANCED AND MORE For compiler command line: CMAKE_CXX_FLAGS cmake var For preprocessors : add_definitions(-DFOO -DBAR ...) configure_file(<input> <output> For more examples: suitesparse-metis-for-windows [COPYONLY] [ESCAPE_QUOTES] [@ONLY] [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) For custom targets : add_custom_target(Name [ALL] [command1 [args1...]] [COMMAND command2 [args2...] ...] [DEPENDS depend depend depend ... ] [WORKING_DIRECTORY dir] [COMMENT comment] [VERBATIM] [SOURCES src1 [src2...]]) For installation (see doxygen example) : Install(…) (multiples signatures) jerome.esnault@inria.fr 02 July 2014 - 15
  • 16. 5-INSTALLATION, EXPORT, PACKAGE TIPS here And here jerome.esnault@inria.fr 02 July 2014 - 16
  • 17. ANDROID && iOS toolchain • ANDROID : https://github.com/taka-no-me/android-cmake • iOS : https://code.google.com/p/ios-cmake/ • Global integration with Qt and QtCreator topic : (http://qt-project.org/forums/viewthread/36359) jerome.esnault@inria.fr 02 July 2014 - 17

Editor's Notes

  • #18: http://qt-project.org/forums/viewthread/36359