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

CMake relocation / cross compile support is broken #1192

Open
herbrechtsmeier opened this issue Jun 25, 2019 · 7 comments
Open

CMake relocation / cross compile support is broken #1192

herbrechtsmeier opened this issue Jun 25, 2019 · 7 comments

Comments

@herbrechtsmeier
Copy link

The current CMake implementation doesn’t support cross compile via Yocto. CMake supports the relocation of its installation by default. The generated CMake build files breaks this feature because they contaminate the CMake targets with absolute paths. The find package modules should provide targets to forward the include directories and libraries to the CMake build targets. The CMake build targets should use these imported targets and the CMake package config should call find package on all required external libraries to provide all needed targets.

  • Create imported libraries in ‘Find$(use.project:c).cmake’ files
  • Add ‘find_package($(use.project) REQUIRED)’ calls for all ‘use’ items to the ‘Config.cmake.in’ file guarded by ‘@$(PROJECT.PREFIX)WITH$(USE.PROJECT)@’ if ‘use.optional’ is not 0
  • Use targets inside OPTIONAL_LIBRARIES variable
@bluca
Copy link
Member

bluca commented Jun 25, 2019

Could you please send a PR to fix it?

@herbrechtsmeier
Copy link
Author

@bluca Could we update CMake minimum required version to 3.6 or higher? Many distributions have a higher version as 3.6. This version will allow use to use the IMPORTED_TARGET argument of pkg_check_modules to create a target per dependency.

@bluca
Copy link
Member

bluca commented Aug 26, 2019

that's quite a big jump from 2.8 - can it be made optional by checking which version of cmake is being used? Then users with old versions won't have support removed

@herbrechtsmeier
Copy link
Author

The list of not supported distributions between 3.0 and 3.5 isn't that big. The 3.6 is a problem and CentOS is restricted to 2.8.12.

We have to check the code from the FindPkgConfig module and try to backport it.

@bluca
Copy link
Member

bluca commented Aug 26, 2019

couldn't there simply be a check for the CMAKE version to use that feature? if it's new enough use it, if not don't

@herbrechtsmeier
Copy link
Author

Do you mean we should fix the issue only for newer CMake versions and otherwise fall back to the current behaviour?

@bluca
Copy link
Member

bluca commented Aug 27, 2019

Yes - the problem in Yocto will be fixed, and we avoid breaking compatibility with CentOS/RHEL

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

2 participants