updated 2024-09-20
Version 2409? (Build 16.0.17928.20148)
| cmake_minimum_required(VERSION 3.5) | |
| project(example LANGUAGES CXX) | |
| set(CMAKE_CXX_STANDARD 11) | |
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
| find_package(GTest REQUIRED) | |
| include_directories(${GTEST_INCLUDE_DIRS}) |
For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.
After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft
| #include <iostream> | |
| #include <memory> | |
| struct A | |
| { | |
| virtual ~A() {} | |
| }; | |
| struct B : public A | |
| { |
| PY_VER="3.3.3" | |
| # Update | |
| apt-get update && apt-get dist-upgrade -y | |
| # Install required packages | |
| apt-get install -y build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev zlib1g-dev libssl-dev libgdbm-dev libreadline-dev libc6-dev | |
| # Get, compile and install python3 | |
| cd /usr/local/src |