This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CppCMakeScripts is a library of reusable CMake modules consumed as a subdirectory (typically a git submodule at cmake/) by C++ projects. It has no build of its own — there is no CMakeLists.txt, no tests, and no lint target. Changes are validated by consuming projects that include() these .cmake files.
Two kinds of modules live in the repo root:
-
Configuration modules — included by a consumer's
CMakeLists.txtfor side effects (setting flags, defining options, registering targets):SetCompilerFeatures.cmake— setsCMAKE_CXX_STANDARD 23, libc++ on Clang, MSYS/MinGW static linking, MSVC/bigobj/utf-8/Zc:__cplusplus, Unix pthreads.SetCompilerWarnings.cmake— turns-Wall -Werror(or/W4 /WXon MSVC) on, then exposesPEDANTIC_COMPILE_FLAGSandCOMMON_COMPILE_FLAGSfor per-target use.SetPlatformFeatures.cmake— adds Windows platformadd_definitions(WIN32_LEAN_AND_MEAN,_WIN32_WINNT=0x0A00, SDK version, etc.).CodeCoverage.cmake— gated on-DCODE_COVERAGE=ON; adds--coverage -O0, writesCTestCustom.cmaketo scope coverage toinclude/andsource/, and defines acoverage-gcovrcustom target whengcovris on PATH. MSVC is rejected withFATAL_ERROR.SystemInformation.cmake— prints identification info; no side effects beyondmessage().
-
Find<Pkg>.cmakemodules —find_path+find_libraryfor libraries CMake doesn't ship finders for:Crypt(Windows crypt32),DbgHelp,LibBFD,LibDL,LibRT,LibUUID,RPC,Userenv,WinSock. Each sets<PKG>_FOUND,<PKG>_INCLUDE_DIR,<PKG>_LIBRARIESand usesFindPackageHandleStandardArgs. Some (e.g.FindCrypt.cmake) alsoadd_definitions(-D<PKG>_SUPPORT)when found and append toCMAKE_*_STANDARD_LIBRARIESunder MinGW.
- Keep modules side-effect-explicit and standalone — a consumer does
include(cmake/SetCompilerWarnings.cmake)and expects exactly the documented globals/targets, nothing else. - Cross-compiler branching follows
MSVC/MINGW/MSYS/APPLE/UNIX/CMAKE_CXX_COMPILER_ID STREQUAL "Clang"|"GNU". Match this style when adding flags. SetCompilerWarnings.cmakedeliberately preserves originals intoCMAKE_*_FLAGS_ORIGINbefore mutatingCMAKE_*_FLAGS. Don't remove that backup.CodeCoverage.cmakeusesgcov -l -pon purpose: without-p, same-basename headers from different directories (e.g. projectthread.hvs libc++__thread/thread.h) collide and CTest mis-maps system-header line counts to project files. The inline comment explains this — leave it in place if you touch the file.- The
CTestCustom.cmakeexclusion list inCodeCoverage.cmakeassumes a consumer layout withinclude/andsource/as the only "real" code dirs; everything else (tests/,examples/,performance/,plugins/,modules/,bin/,build/,temp/,documents/,images/,cmake/) is excluded. Add new exclusions here rather than in consumer projects.
There is nothing to build or test in this repo directly. To verify a change, run a consuming project's CMake configure + build + (if relevant) ctest -T Coverage / cmake --build . --target coverage-gcovr.