How to make a header-only library with cmake?

How to make a header-only library with cmake?

Like this:

add_library(project INTERFACE)
target_include_directories(project INTERFACE .)

Then in the target that uses the library:

target_link_libraries(dependee
    PUBLIC/INTERFACE/PRIVATE # pick one
    project)

and include the header like this:

#include <project/folder1/file.hpp>

Leave a Comment

techhipbettruvabetnorabahisbahis forumuedueduseduseduedueduseduedusedusedus