skills/modern-cmake/SKILL.md
Use when creating, refactoring, cleaning up, structurally analyzing, or diagnosing CMake projects, CMakePresets, target-based modern CMake, custom functions/macros, dependency discovery, C++ compiler errors, CUDA language support, nvcc errors, toolchains, install/export rules, or cross-platform build configuration.
npx skillsauth add miaodi/llm_config modern-cmakeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build, repair, parse, and clean up CMake-based C++ and CUDA projects using target-based modern CMake, precise compiler diagnostics, and project-consistent structure.
Use for CMakeLists.txt, *.cmake, CMakePresets.json, toolchain files, package config files, install/export rules, dependency integration, C++ compilation errors, CUDA/nvcc compilation errors, custom CMake functions or macros, or whole-project CMake cleanup/rework.
CMakeLists.txt, relevant subdirectory CMakeLists.txt files, included *.cmake modules, presets, and toolchain file.ninja -C build -v <target>cmake --build build --target <target> --verbosemake VERBOSE=1 <target>When the request is to understand, clean up, modernize, or rework CMake, first build a project map:
CMakeLists.txt, *.cmake, preset file, toolchain file, package config template, generated-code rule, vendored dependency entry point, and CI configure/build command.include_directories, add_definitions, link_directories, cache variables, policies, options, and variables that affect subdirectories.find_package, FetchContent, add_subdirectory vendoring, package managers, environment variables, and manually supplied paths.Use this mode only when the user asks to clean up, modernize, refactor, reorganize, or rework project CMake.
cmake_parse_arguments, target names as inputs, documented side effects through code shape rather than comments.project(... LANGUAGES CXX CUDA) when CUDA is a first-class language, not ad hoc nvcc custom commands.add_library / add_executable with target_sources, target_include_directories, target_compile_features, target_compile_definitions, target_compile_options, and target_link_libraries.PUBLIC, PRIVATE, and INTERFACE deliberately:
PRIVATE: needed only to build the target.PUBLIC: needed by the target and consumers.INTERFACE: needed only by consumers of an interface target.find_package (Pkg::Lib) over raw include directories and library paths.INTERFACE targets.CMakePresets.json for repeatable local and CI configure/build/test workflows.target_compile_features(target PUBLIC cxx_std_20) or the narrowest appropriate scope..cpp / .hpp for host-only code that calls CUDA runtime APIs, toolkit libraries, or existing host-callable kernel wrappers; do not introduce .cu files or CUDA language enablement merely because code uses CUDA-adjacent APIs or existing kernels..cu sources and CUDA language compilation only when implementing or refactoring kernel/device code, such as kernel or device definitions, device lambdas, separable compilation, or an established project convention for CUDA-only implementation files..cu compilation; use find_package(CUDAToolkit) for toolkit libraries such as CUDA::cudart, CUDA::cublas, or CUDA::cusparse.CUDA_STANDARD, CUDA_STANDARD_REQUIRED, and target_compile_features.$<COMPILE_LANGUAGE:CUDA> generator expressions for CUDA-only options and $<COMPILE_LANG_AND_ID:CUDA,NVIDIA> when nvcc-specific behavior matters.CMAKE_CUDA_HOST_COMPILER, CMAKE_CUDA_COMPILER, toolkit version, and target architecture.CMAKE_CUDA_ARCHITECTURES or target property CUDA_ARCHITECTURES; avoid hard-coding obsolete -gencode flags unless the project already does.__host__ / __device__ annotations, wrong lambda annotations, and host-only APIs used in device code.CUDA_SEPARABLE_COMPILATION and CUDA_RESOLVE_DEVICE_SYMBOLS only when needed.cmake_parse_arguments and fail with actionable message(FATAL_ERROR ...) text.target_include_directories(provider PUBLIC include) if consumers need headers; otherwise PRIVATE.target_compile_definitions to the target that owns the requirement.target_compile_features or target standard properties with the narrowest correct scope.PUBLIC or INTERFACE from the library whose public headers require it.target_link_libraries with targets; check symbol ownership, static library order, visibility, and ABI mismatch.PUBLIC or INTERFACE usage requirements?include_directories, add_definitions, or CMAKE_CXX_FLAGS changes unless the project already centralizes configuration that way..cu files exist; verify language enablement and toolkit discovery..cpp CUDA integration code to .cu unless it is becoming kernel/device implementation code or the project already requires that convention.Provide:
development
Use when creating C++ learning notes or minimal experiments for low-level computational, numerical, CPU/GPU, compiler, and hardware concepts such as false sharing, floating point, registers, caches, SIMD, atomics, numerical stability, and benchmarking pitfalls.
development
Use when configuring, diagnosing, or compiling LaTeX projects, especially multi-file reports, theses, books, chapter-based projects, Overleaf exports, latexmk/arara/Makefile workflows, bibliography/index/glossary passes, or projects that require pdflatex, xelatex, lualatex, latex->dvips, biber, or bibtex.
development
Use when working with graph traversals (BFS, DFS, level-order), minimum spanning trees, strongly connected components, topological sort, graph coloring, bipartite detection, elimination trees, level-set extraction, parallel graph algorithms, task-tree parallelism, sparse graph representations, and exploiting graph structure for parallel sparse computations.
testing
Use when planning or executing Git branch workflows, especially merge/rebase across branches, conflict resolution, safe history rewriting, and recovery from mistakes.