You can integrate cglm into your CMake project in two ways:
This requires no building or installation of cglm. Use the cglm_headers target.
2. As a compiled library
This links against the compiled cglm library using the cglm target.
In both cases, you must use add_subdirectory pointing to the cglm source directory.
# Header-only integration
cmake_minimum_required(VERSION 3.8.2)
project(<Your Project Name>)
add_executable(${PROJECT_NAME} src/main.c)
target_link_libraries(${PROJECT_NAME} PRIVATE cglm_headers)
add_subdirectory(external/cglm/ EXCLUDE_FROM_ALL)
# --- OR ---
# Compiled library integration
cmake_minimum_required(VERSION 3.8.2)
project(<Your Project Name>)
add_executable(${PROJECT_NAME} src/main.c)
target_link_libraries(${PROJECT_NAME} PRIVATE cglm)
add_subdirectory(external/cglm/)