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

Make package relocatable (fixes #101) #107

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Make package relocatable (fixes #101) #107

wants to merge 7 commits into from

Conversation

zmb3
Copy link

@zmb3 zmb3 commented Oct 20, 2015

These changes remove absolute paths from the package files installed by CMake.

Use CONFIGURE_PACKAGE_CONFIG_FILE instead of CONFIGURE_FILE.
This avoids hard-coded paths in the generated config file,
resulting in a package that is relocatable.

See
http://www.cmake.org/cmake/help/v3.0/module/CMakePackageConfigHelpers.html
When checking for x64 Windows, check OS first, then check for 64-bit.
This resolves an issue with some cross compiler toolchains that
don't play nice with SMAKE_SIZEOF_VOID_P.
Remove @only (not applicable for CONFIGURE_PACKAGE_CONFIG_FILE) and
add PUBLIC keyword to link libraries.
Update the project to use libpcap as an imported target.
This eliminates a hard coded path to libpcap, which is a problem
when cross compiling.
Use pkg-config's 'pcfiledir' variable to specify paths in the
generated libtins.pc file.  This allows us to specify paths
relative to the .pc file instead of absolute paths - resulting
in a .pc file that is fully relocatable.
@zmb3
Copy link
Author

zmb3 commented Oct 20, 2015

Looks like the Linux builds fail because we need CMake >= 2.8.8 for CMakePackageConfigHelpers. The Linux environment on travis has CMake 2.8.7 (while the Mac OS environment has 3.0.2).

I can update CMAKE_MINIMUM_REQUIRED, but is there any way to tell Travis to use a newer version? CMake 2.8.8 was released 3.5 years ago, so it's not like we're looking for bleeding edge features.

CMakePackageConfigHelpers was introduced in CMake 2.8.8 (April 2012).
@tfar
Copy link

tfar commented May 8, 2016

AFAIK travis doesn't provide an easy way to have a newer CMake. But you should be able to download the CMake linux package from cmake.org, install it to a local prefix and adjust the PATH environment variable.

@mfontanini
Copy link
Owner

I just found this. Trusty has cmake 2.8.12.2 so that should work. I'll see if this doesn't have any drawbacks (just skimmed through the doc) and that it works.

There are issues with this PR though, as in, the Windows build failing because some libpcap variable is not set properly.

@zmb3
Copy link
Author

zmb3 commented May 15, 2016

I just got this all up and running on a Windows box with VS 2015 community and CMake 3.5.2 and everything built and linked to PCAP just fine.

libtins\build>cmake.exe .. -G "Visual Studio 14 Win64" -DPCAP_ROOT_DIR=C:\WpdPack -DLIBTINS_BUILD_SHARED=0 -DLIBTINS_ENABLE_WPA2=0 

I see the appveyor.yml should be building for VS 2013 and 2015, but it I look at the failed builds I only see them running with VS 2013.

Is anyone able to reproduce these PCAP errors on Windows?

@mfontanini
Copy link
Owner

I re-triggered the build yesterday and apparently it's happening on both vs2013 and 2015. At the time you made the initial PR, it was only building on vs2013 on appveyor.

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 this pull request may close these issues.

None yet

3 participants