pcre2 provides CMake targets: find_package(pcre2 CONFIG REQUIRED) target_link_libraries(main PRIVATE PCRE2::8BIT PCRE2::16BIT PCRE2::32BIT PCRE2::POSIX) pcre2 provides pkg-config modules: # PCRE2 - Perl compatible regular expressions C library (2nd API) with 16 bit character support libpcre2-16 # PCRE2 - Perl compatible regular expressions C library (2nd API) with 32 bit character support libpcre2-32 # PCRE2 - Perl compatible regular expressions C library (2nd API) with 8 bit character support libpcre2-8 # Posix compatible interface to libpcre2-8 libpcre2-posix