Skip to content

Support nested build directories in sibling search#6961

Open
hakonhagland wants to merge 1 commit intoOPM:masterfrom
hakonhagland:sibling_search
Open

Support nested build directories in sibling search#6961
hakonhagland wants to merge 1 commit intoOPM:masterfrom
hakonhagland:sibling_search

Conversation

@hakonhagland
Copy link
Copy Markdown
Contributor

See description in the companion PR in opm-common: OPM/opm-common#5091

The inline sibling search logic used get_filename_component(NAME)
to extract the build directory name, which only returned the last
path component. This broke sibling discovery for nested build
directories like "builds/debug" — the search would look for
"../opm-common/debug" instead of "../opm-common/builds/debug".

Use file(RELATIVE_PATH) to compute the full relative path from
PROJECT_SOURCE_DIR to PROJECT_BINARY_DIR, then apply that same
relative path to the sibling module's source tree. This correctly
handles build directories at any depth. The previous strategies
(prefix-based naming and common build root) are kept as fallbacks
for out-of-source builds.

This is the inline copy of the logic in
opm-common/cmake/Modules/OpmSiblingSearch.cmake, duplicated
here because opm-common must be located before its cmake
modules become available via find_package.
@hakonhagland hakonhagland added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants