martinmoene / span-lite

span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
499 stars 43 forks source link

Fix package imporation/exportation from build tree #39

Closed gracicot closed 3 years ago

gracicot commented 5 years ago

CMake packages can be found in build trees when setting CMAKE_PREFIX_PATH to the project directory of build directory of the project.

With the setup I had, CMake found the package since there was a cmake config file (span-lite-config.cmake) in the build directory, but tried to include span-lite-targets.cmake which was no longer generated.

This patch export the build tree (not globally). It simply enable CMake to use a build tree as a package as if it was installed when setting the path to find it.

There was also an unused option named SPAN_LITE_EXPORT_PACKAGE. I opted for removing the option instead of adding the global exportation back, since it's not considered a good practice anymore.

martinmoene commented 3 years ago

I think this has been addressed in 07035e430da697b517797ec75acbcfa5e672cebe.