Wrong include directories in BZip2::BZip2 imported target
I have installed BZip2 in a non-standard location.
In my CMakeLists.txt, I use find_package() to look for my BZip2 installation:
set(CMAKE_PREFIX_PATH "/path/to/libbz2") find_package(BZip2 REQUIRED) target_link_libraries(MyTarget PRIVATE BZip2::BZip2)
However it doesn't work because MyTarget can't include bzip2 header.
I think there is a mistake in FindBZip2.cmake when defining the imported target.
Adding the following just after the find_package() call solves my problem:
set_target_properties(BZip2::BZip2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}")
NB: ${BZIP2_INCLUDE_DIR} != ${BZIP2_INCLUDE_DIRS}