Description
Hello, is it intentional to duplicate the project name in the installation layout for the headers?
I see the following when installing the shared/static library (initialized with cmake-init -s /tmp/test-shared
) example:
$ cmake --install build/dev --prefix prefix
-- Install configuration: "Debug"
-- Installing: /tmp/test-shared/prefix/include/test-shared
-- Installing: /tmp/test-shared/prefix/include/test-shared/test-shared
-- Installing: /tmp/test-shared/prefix/include/test-shared/test-shared/test-shared.hpp
-- Up-to-date: /tmp/test-shared/prefix/include/test-shared
-- Up-to-date: /tmp/test-shared/prefix/include/test-shared/test-shared
-- Installing: /tmp/test-shared/prefix/include/test-shared/test-shared/test-shared_export.hpp
-- Installing: /tmp/test-shared/prefix/lib/libtest-shared.a
-- Installing: /tmp/test-shared/prefix/share/test-shared/test-sharedConfig.cmake
-- Installing: /tmp/test-shared/prefix/share/test-shared/test-sharedConfigVersion.cmake
-- Installing: /tmp/test-shared/prefix/share/test-shared/test-sharedTargets.cmake
-- Installing: /tmp/test-shared/prefix/share/test-shared/test-sharedTargets-debug.cmake
Note the line here with duplicate test-shared/test-shared/
directories
-- Installing: /tmp/test-shared/prefix/include/test-shared/test-shared/test-shared.hpp
I would have expected it to read
-- Installing: /tmp/test-shared/prefix/include/test-shared/test-shared.hpp
which is a more compact directory layout while still maintaining directory isolation of the project headers.
I realize I can manually set -DCMAKE_INSTALL_INCLUDEDIR=include
when configuring, but I think the expected behavior should be default for this initializer project.
I also realize that test-sharedTargets.cmake
contains the following
set_target_properties(test-shared::test-shared PROPERTIES
[...]
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/test-shared"
)
which means that an #include <test-shared/test-shared.hpp>
still works from a CMake project that finds the library and uses the target with the duplicate project name directories in the include
directory, but I still would have expected the include
directory layout of the installation to be more compact by default, which would then make this snippet read INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
.
I believe the line(s) responsible for directory duplication are here and removal would produce the expected directory layout by default
Unrelated: I'm not sure whether this kind of post belongs in the Issues
or Discussions
section, so apologies if this is posted in the wrong spot.