Assuming you're building a dissector plugin, the libraries that your plugin will link with is set by the target_link_libraries() statement in the CMakeList.txt for your plugin. Normally this will include epan which is the link to libwireshark. If you have anything odd here, you'll have to fix that.