Skip to content

Commit

Permalink
Document the include path for packagers
Browse files Browse the repository at this point in the history
See #43 for further details why the include path is modified this way.

Closes: #74
Co-authored-by: Anders Wind <[email protected]>
  • Loading branch information
friendlyanon and anders-wind committed Oct 22, 2022
1 parent 7a4c594 commit e8d868e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmake-init/templates/common/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ target_link_libraries(
{= name =}::{= name =}
)
```

### Note to packagers

The `CMAKE_INSTALL_INCLUDEDIR` is set to a path other than just `include` if
the project is configured as a top level project to avoid indirectly including
other libraries when installed to a common prefix. Please review the
[install-rules.cmake](cmake/install-rules.cmake) file for the full set of
install rules.
{% end %}
[1]: https://cmake.org/download/
[2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#install-a-project{% if not exe %}
Expand Down
5 changes: 4 additions & 1 deletion cmake-init/templates/common/cmake/install-rules.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% if not exe %}if(PROJECT_IS_TOP_LEVEL)
set(CMAKE_INSTALL_INCLUDEDIR include/{= name =} CACHE PATH "")
set(
CMAKE_INSTALL_INCLUDEDIR "include/{= name =}-${PROJECT_VERSION}"
CACHE PATH ""
)
endif(){% if header %}

# Project is configured with no languages, so tell GNUInstallDirs the lib dir
Expand Down

0 comments on commit e8d868e

Please sign in to comment.