Quick answer: CMake-built game failing link with undefined references involving GLM types? GLM is header-only — missing references mean two compile units saw different inlined definitions.

A game engine library exposes a function taking glm::mat4 by value. The consumer links and gets undefined symbols on the GLM internals. ODR violation from version mismatch.

Make GLM INTERFACE

add_library(glm INTERFACE)
target_include_directories(glm INTERFACE "${GLM_PATH}")
target_link_libraries(engine PUBLIC glm)
target_link_libraries(game PRIVATE engine)

Game and engine both see the same GLM. Header-only libs work via INTERFACE targets.

Single Version

Bundle one GLM version in your repo or pin via vcpkg. Two copies = two ODR-conflicting definitions.

GLM_FORCE_* Flags

Configuration flags (GLM_FORCE_RADIANS, GLM_FORCE_DEPTH_ZERO_TO_ONE) change struct layouts. Use the same flags across all consumers — mismatch produces silent miscompare or ODR breakage.

Verifying

Link succeeds. Run-time tests confirm matrix math gives expected results on both engine and game side.

“Header-only libs need INTERFACE targets + single version + consistent flags.”

Pin GLM as a submodule or vcpkg port at project setup — cross-platform version drift is otherwise inevitable.