Skip to content

Conversation

bartgol
Copy link
Contributor

@bartgol bartgol commented Aug 19, 2025

Motivation

When installing ekat, I noticed the following lines in EkatConfig.cmake:

  if () 
    find_dependency(yaml-cpp REQUIRED QUIET HINTS )
  else()

This is not valid cmake, as the if command requires at least one arg. The problem stems from the fact that we used <PKGNAME>_FOUND in EkatConfig.cmake.in, but these vars are LOCAL to the scope where find_package(...) was called. To overcome this, let's use some helper cache variables, which we set to ON/OFF depending on whether Ekat builds the tpl or not.

Testing

I verified that the generated EkatConfig.cmake file is indeed valid. As a TODO item, we may want to create a dummy cmake project (perhaps inside ekat's repo) that links against ekat. and that we can use in our CI to verify that the ekat installation logic works as expected.

The vars <PKGNAME>_FOUND are LOCAL to the scope where
find_package was called, so we cannot use them inside the
EkatConfig.cmake.in file. Instead, rely on internal cache
entries which we set to ON/OFF depending on whether we
manually build the TPL or not
@bartgol bartgol merged commit e82ef36 into master Aug 19, 2025
4 checks passed
@bartgol bartgol deleted the bartgol/fix-config-file branch August 19, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants