Skip to content

Instantly share code, notes, and snippets.

@dadencukillia
Created July 5, 2025 13:54
Show Gist options
  • Select an option

  • Save dadencukillia/6124bfe5ae02db95df38b8ab57feef11 to your computer and use it in GitHub Desktop.

Select an option

Save dadencukillia/6124bfe5ae02db95df38b8ab57feef11 to your computer and use it in GitHub Desktop.
Useful preferences for CMake
# Autocompletition for clangd
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Locate libraries in binary directory
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# Release/Debug build mode
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE Debug)
# Compile static libraries
set(BUILD_SHARED_LIBS false)
# Use C++17
set(CMAKE_CXX_STANDARD 17)
# Put all libraries in the "libs" directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/libs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment