44 lines
1.7 KiB

cmake_minimum_required(VERSION 3.18)
# This is a small experiment in figuring out which compilers I want to use for
# the complition. There's no reason to use Clang over GCC, but I was curious how
# you specified that in the configuration.
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
# Packages are libraries that provide definitions for how to compile
# well-known packages. The XCB package is often installed someplace
# peculiar, and the ECM (Extra CMake Modules) package knows how to
# find it, but there are no modules to import from it, just the finder.
find_package(XCB REQUIRED)
# There are the definitions of the libraries needed to build the executable.
# The `list(APPEND ...` command does, well, it takes an existing string and
# append new stuff to it.
list(APPEND CMAKE_CXX_FLAGS "${CXXMAKE_C_FLAGS} -std=c++17 -I../src/include/ -g")
# This is the final executable and the list of source files that are responsible
# for building that executable. There can be multiple executables, and it can be
# possible to describe which one you want from the command line.
add_executable(xrandr src/xrandr.cpp)
# Define the libraries that are necessary to link a binary. The link happens
# only if it's a target mentioned in `add_executable()` (TK: Are there others
# that provide executables?) Note that this has to come *after* the executable
# target is provided, or CMake will complain that the target hasn't been found.
target_link_libraries(xrandr ${X11_XCB_LIBRARIES})