Clion Add External Library [verified] May 2026
find_package(SDL2 CONFIG REQUIRED) target_link_libraries(my_game PRIVATE SDL2::SDL2)
When you reload CMake in CLion, it will clone fmt , build it, and link it—all automatically. clion add external library
find_package(PkgConfig REQUIRED) pkg_check_modules(LIBUSB REQUIRED libusb-1.0) target_link_libraries(my_app PRIVATE $LIBUSB_LIBRARIES) target_include_directories(my_app PRIVATE $LIBUSB_INCLUDE_DIRS) Best for: Automatically downloading libraries from GitHub during configuration. it will clone fmt
By Alex Mitchell | Estimated read time: 8 minutes and I’ll help you debug it.
Now go forth and link without fear! Have a library that just won’t cooperate? Drop the error message in the comments, and I’ll help you debug it.