HDFGroup / HDFGroup/hdf5

the cmake macro SET_HDF_OUTPUT_DIRS behaves unexpected in subprojects

Open
#6,661 0 comments 0 reactions 1 assignee Claimed by @jhendersonHDF View on GitHub
Dominant language
C
Stars
988
Forks
355
Avg merge
4d 2h
Merged PRs (30d)
12

Description

**Describe the bug**
Adding hdf5 as subproject via add_subdirectory, fetch content or CPM causes the output directory to change to

This is caused by two antipatterns used in that macro:

First CMAKE_* variables should not be set anymore. And never set them in the cache.
Changing this to non cached versions at least directories would limit the propagation.

Then you decide to set those variables, depending on whether ${package_prefix}_EXTERNALLY_CONFIGURED is set, but it's definitely better to change that to HDF5_EXTERNALLY_CONFIGURED, alternatively set all variants of
${package_prefix}_EXTERNALLY_CONFIGURED to OFF, when configuring as subproject.

**Expected behavior**
That no CMAKE_* variables are set by HDF5 in the cache.

**Platform (please complete the following information)**
- HDF5 version: 1.14.6 and develop
- OS and version: All
- Compiler and version: Irrellevant
- Build system (e.g. CMake version) and generator (e.g. XCode, Ninja): CMake 3.27+, ninja-build, ninja-multi-config
- Any configure options you specified:

**Additional context**

Build HDF5 as subproject.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.