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

Installed package not relocatable #101

Open
zmb3 opened this issue Sep 1, 2015 · 3 comments · May be fixed by #535
Open

Installed package not relocatable #101

zmb3 opened this issue Sep 1, 2015 · 3 comments · May be fixed by #535

Comments

@zmb3
Copy link

zmb3 commented Sep 1, 2015

The installed package for libtins is not relocatable (it contains a bunch of absolute paths valid only on the machine in which is was built).

There are several sub-issues here:

  1. CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of CONFIGURE_FILE()
    (see Fix absolute paths in exported CMake config file. #100)
  2. The libtinsTargets-xxx.cmake file(s) that get generated contain hard coded absolute paths to
    dependencies like libpcap.
  3. The libtins.pc pkg-config file contains absolute paths on the build machine instead of paths relative
    to the install prefix.

I'm working on a PR for 1 (not quite there yet). This will remove hard coded paths from libtinsConfig.cmake.

For 2, I believe libtins needs to IMPORT pcap instead of doing target_link_libraries. See http://www.cmake.org/cmake/help/v3.2/manual/cmake-packages.7.html#creating-packages.

Note that it is not advisable to populate any properties which may contain paths, such as INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_LINK_LIBRARIES, with paths relevant to dependencies. That would hard-code into installed packages the include directory or library paths for dependencies as found on the machine the package was made on.

I can't quite figure out how to fix this. I believe instead of target_link_libraries(tgt PCAP) there should be a find_dependency(PCAP) in libtinsConfig.cmake.

I think 3 should be resolved with the same type of solution as 1.

@mfontanini
Copy link
Owner

I've never used the package file generated by CMake so I never came across this issues. But I guess it makes sense not to use hardcoded paths. If you find a way around that, I'll appreciate it :D.

BTW: I think you probably saw it, but it seems like travis.ci build for OSX failed when using CONFIGURE_PACKAGE_CONFIG_FILE on the PR you created yesterday.

@zmb3
Copy link
Author

zmb3 commented Sep 1, 2015

Yes, I have a few fixes to make to the PR. I'm not sure exactly how to fix the hardcoded paths in the targets file. Was hoping you knew more CMake than I do :)

@mfontanini
Copy link
Owner

Oh no, I just know enough CMake to be able to do some simple stuff.

@Faroito Faroito linked a pull request Jul 19, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants