All,
This is a fun one. In trying to help a user of a library I help maintain, he was having all sorts of issues at CMake time. After a day or so of puzzling over --trace --debug-find
output, I finally realized the issue was that he had .
in his PATH
. This library simply builds a few sublibraries with add_subdirectory()
in order.
And since find_package()
is really good at finding things on a system, it was finding a half-baked .cmake
file in a subdirectory under the build dir and not, say, the “real” one that would be installed in the install step.
Now, I never run with dot-in-PATH as I learned long ago that is trouble. And the other devs I consulted on this also don’t have dot-in-PATH so they couldn’t replicate either. So I was wondering, does anyone know a good way to maybe have CMake search $PATH
for it? I figure list(FIND)
could do it but I’d need to convert $ENV{PATH}
to a list somehow?
Thanks,
Matt
Note: I know a “better” solution might be to add NO_SYSTEM_ENVIRONMENT_PATH
in to the find_package()
calls that are being done, but I keep fearing dot-in-PATH might come back to haunt me.
Note2: I suppose even better is moving to ExternalProject_Add, but that’s future me issue.