This is the version 61e93adaef8b66d8de58d880 from 2022-01-20 10:35:06 comment: 'find'
cmake ed
- sigh*
Basics ed
- project
project(<project>)
# or
project(<project> VERSION 1.0)
cmake_minimum_required(VERSION 3.10)
# c++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
- PROJECT_<project>
- PROJECT_<version>
- CMAKE_PROJECT_<project>
- executable
add_executable(<target> a.cpp b.cpp ...)
- link
target_link_libraries(<target> <PRIVATE|PUBLIC|INTERFACE> <item>...)
- library target name or
- library full path
- "plain name" foo -> -lfoo
- linker flags...?
- PUBLIC link AND part of interface
- PRIVATE link but NOT part of interface
- INTERFACE only part of interface
- configure file
configure_file(config.h.in config.h)
- include
include(<file>)
# or
include(<module>)
- stops and processes the sub CMakeLists.txt
- subdirectory
add_subdirectory(<source-dir>)
# or
add_subdirectory(<source-dir> <binary-output-dir>)
- stops and processes the sub CMakeLists.txt
find ed
- file
find_file(<var> NAMES <file1> ... [PATHS <dir1> ...] [REQUIRED])
- looks for a file with possible (base)names in some directories
- sets variable to full path or <var>-NOTFOUND
- library
find_library(<var> NAMES <file1> ... [PATHS <dir1>] ... [REQUIRED])
- looks for a library file with possible (base)names in some directories
- extension???
- sets variable to full path or <var>-NOTFOUND
- package
find_package(<package> [REQUIRED] [QUIET])
- creates variable <package>_FOUND
Categories: Programmieren