Code Snippets CMake

Short texts CMake 🧑‍💻 Code snippets CMake ✍️ Reading lists CMake 👀

CMakeLists for OpenCV that installed using Vcpkg

cmake_minimum_required( VERSION 3.0 ) set( CMAKE_TOOLCHAIN_FILE “C:/vcpkg/scripts/buildsystems/vcpkg.cmake” ) # Create Project project( solution ) add_executable( project main.cpp ) # Set OpenCVConfig.cmake Search Directory set( OpenCV_DIR ) if( NOT CMAKE_CL_64 ) set( OpenCV_DIR “C:/vcpkg/installed/x86-windows/share/opencv” ) else() set( OpenCV_DIR “C:/vcpkg/installed/x64-windows/share/opencv” ) endif() # Find Package find_package( OpenCV REQUIRED ) if( OpenCV_FOUND ) # Additional Include Directories include_directories( […]


# This CMakeLists file is for SiLabs EFM32PG12 MCU development # and is based off of the CMakeLists file for STM MCU development found here: cmake_minimum_required(VERSION 3.17) set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_VERSION 1) # specify cross compilers and tools # Note that you will have to add the path to the ARM toolchain to $PATH set(CMAKE_C_COMPILER […]

CMake and GTK+ 3

# Thanks to @danger89 and @Ilothar for updating the gist. # Set the name and the supported language of the project project(hello-world C CXX) # Set the minimum version of cmake required to build this project cmake_minimum_required(VERSION 3.10) # Use the package PkgConfig to detect GTK+ headers/library files find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED gtkmm-3.0) add_executable(hello main.cpp) […]

Find all CMake targets declared in a directory (recursively)

function(print_all_targets DIR) get_property(TGTS DIRECTORY “${DIR}” PROPERTY BUILDSYSTEM_TARGETS) foreach(TGT IN LISTS TGTS) message(STATUS “Target: ${TGT}”) # TODO: Do something about it endforeach() get_property(SUBDIRS DIRECTORY “${DIR}” PROPERTY SUBDIRECTORIES) foreach(SUBDIR IN LISTS SUBDIRS) print_all_targets(“${SUBDIR}”) endforeach() endfunction() print_all_targets(.)

llvm on Ubuntu 16.04.7 LTS – Homebrew build logs

Homebrew build logs for llvm on Ubuntu 16.04.7 LTS Build date: 2021-10-04 02:54:12 HOMEBREW_VERSION: 3.2.14-51-g1909d89 ORIGIN: HEAD: 1909d89d003bdf1f34775faf81b8c0529729013f Last commit: 2 days ago Core tap ORIGIN: Core tap HEAD: 7f9d28a9ce0d7274e81a94a550cafdbbc33006b8 Core tap last commit: 5 hours ago Core tap branch: master HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew HOMEBREW_CASK_OPTS: [] HOMEBREW_EDITOR: nvim HOMEBREW_FORCE_BREWED_CURL: set HOMEBREW_GITHUB_API_TOKEN: set HOMEBREW_MAKE_JOBS: 8 […]