Hello! I would like to propose the small UX addition about CMake hints then the user has an error like this:
CMake Error in src/library/utils/CMakeLists.txt:
Target "lib_utils" INTERFACE_INCLUDE_DIRECTORIES property contains
path:
"/home/user/proj/library/src/utils/include"
which is prefixed in the source directory.
This error means that user exports that target and forget to add the $<INSTALL_INTERFACE> generator expression to the target_include_directories(). We could add a hint how to fix this error, and it could helps users to fix this error:
CMake Error in src/library/utils/CMakeLists.txt:
Target "lib_utils" INTERFACE_INCLUDE_DIRECTORIES property contains
path:
"/home/user/proj/library/src/utils/include"
which is prefixed in the source directory.
Hint: Replace the relative path "include" to $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
Hint: Add the $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDE_DIR}> generator expression to adjust the includes path on install stage.
I also think that hint could accurately trim off the similar parts of include dirs (e.g. include/libname should be replaced by ${CMAKE_INSTALL_INCLUDE_DIR}/libname), and this hint could mention the GNUInstallDirs CMake module.
Thanks for your attention!