Reputation: 14472
I'm trying to wrap around Poco library. And it contains code like this:
#if defined(POCO_OS_FAMILY_UNIX)
#include "Path_UNIX.cpp"
#elif defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
#if defined(_WIN32_WCE)
#include "Path_WINCE.cpp"
#else
#include "Path_WIN32U.cpp"
#endif
#elif defined(POCO_OS_FAMILY_WINDOWS)
#include "Path_WIN32.cpp"
#endif
But Bazel complains about Path_*.cpp
files because I don't mention them in srcs
section. What is a proper section to mention these files: they are private, sources, and shouldn't be compiled on their own?
My current workaround is to put them into data
section, but it doesn't match conceptually.
actually data
section doesn't work.
Upvotes: 0
Views: 570
Reputation: 637
You want to use the hdrs
attribute. Also if these files are required by dependent libraries you can add it to textual_hdrs
.
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.textual_hdrs
If you need to hide these files from dependent rules you'll need to use a genrule (or patch command at the repository level) to copy the files to a .h extension and modify the source file that includes the files.
Upvotes: 1