Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.1 installs empty directories include/catch2/benchmark/internal and include/catch2/generators/internal #2457

Closed
yurivict opened this issue Jun 13, 2022 · 2 comments
Labels
Building and Packaging Issues affecting build/packaging scripts and utilities

Comments

@yurivict
Copy link

No description provided.

@horenmar
Copy link
Member

This seems to be down to

Catch2/src/CMakeLists.txt

Lines 355 to 363 in d32fca4

install(
DIRECTORY
"${SOURCES_DIR}"
"${CMAKE_BINARY_DIR}/generated-includes/catch2" # Also install the generated header
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING
PATTERN "*.hpp"
)
where CMake's install(DIRECTORY picks up directories that don't contain any copied files (notice the file pattern at the end).

I am not sure if this is the expected behaviour, or if CMake would be willing to change this. Either way I am willing to merge a CMake change that removes the empty dirs as a postprocessing step, but for me personally it is a very low priority change.

@horenmar horenmar added the Building and Packaging Issues affecting build/packaging scripts and utilities label Jun 13, 2022
@ferdnyc
Copy link
Contributor

ferdnyc commented Jun 17, 2022

@horenmar

I am not sure if this is the expected behaviour, or if CMake would be willing to change this.

It definitely is, and they're probably not. It is documented (after a fashion) in the install(DIRECTORY... docs.

It can be worked around, for this particular case, like so:

    # Install the headers
    install(
      DIRECTORY
        "${SOURCES_DIR}"
        "${CMAKE_BINARY_DIR}/generated-includes/catch2" # Also install the generated header
      DESTINATION
        "${CMAKE_INSTALL_INCLUDEDIR}"
      FILES_MATCHING
        PATTERN "*.hpp"
      PATTERN "benchmark/internal" EXCLUDE
      PATTERN "generators/internal" EXCLUDE
    )

With a couple of caveats:

  1. any other empty dirs would have to be explicitly added as well, obviously
  2. slightly less obviously (at least, from a maintenance standpoint), if there ever are any files added to either of those dirs that should be installed, they won't be until the PATTERN ... EXCLUDE is removed.

ferdnyc added a commit to ferdnyc/Catch2 that referenced this issue Jun 17, 2022
ferdnyc added a commit to ferdnyc/Catch2 that referenced this issue Jun 20, 2022
ferdnyc added a commit to ferdnyc/Catch2 that referenced this issue Jun 20, 2022
ferdnyc added a commit to ferdnyc/Catch2 that referenced this issue Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Building and Packaging Issues affecting build/packaging scripts and utilities
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants