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

Incorrect handling of absolute CMAKE_INSTALL_{BIN,INCLUDE,LIB}DIR #40

Open
alexshpilkin opened this issue May 16, 2022 · 0 comments
Open

Comments

@alexshpilkin
Copy link

alexshpilkin commented May 16, 2022

As per title: multiple places in the code assume that INSTALL_{BIN,INCLUDE,LIB}_DIR are relative and yield broken output when they are absolute. That by itself would not be a problem, even if the comments are kind of fuzzy on whether these must or only should be relative (the way the code creates and populates ${PROJECT_NAME}_FULL_INSTALL_{BIN,INCLUDE,LIB}_DIR suggests the latter)—they are private to this build system after all. But if not set explicitly they get populated from the CMake-standard CMAKE_INSTALL_{BIN,INCLUDE,LIB}DIR, which definitely can be absolute. NixOS in particular passes absolute paths there whenever CMake is used and thereby exposes the problem.

A non-exhaustive list of occurrences of this problem is:

  • The pkg-config template in cmake/pkg-config.pc.in (the code nearby in cmake/pkg-config.cmake.in also looks suspect but I can’t really tell what it’s for);
  • The header template in cmake/ecbuild_config.h.in;
  • The clause handling ECBUILD_INSTALL_LIBRARY_HEADERS in cmake/ecbuild_install_project.cmake.

Jan Tojnar’s note linked above has more discussion of this problem in the general case. With the FULL variables already populated, all the tools to fix it here seem to be already in place, except they cannot be referenced from generic templates via @-expansion because their names depend on the name of the project (for reasons I don’t understand and so leave for you to examine).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant