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

Do not modify CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES on Windows #189

Merged
merged 2 commits into from
Nov 29, 2021

Conversation

traversaro
Copy link
Contributor

@traversaro traversaro commented Oct 26, 2021

🦟 Bug fix

Summary

CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES are variables that are used by
CMake to change the behaviour of the find_library calls. Changing CMAKE_FIND_LIBRARY_SUFFIXES to .lib;.dll in the CMake config file of every ignition project affect silently any downstream project that calls find_package(ignition-<pkg>), even if transitevely, leading to subtle bugs, such as the one investigate in conda-forge/libignition-gazebo-feedstock#30 (comment) .

I tried to investigate why that code was there in the first place, and I tracked it back to c9beb6b#diff-ca85e9f4b24c567606682737f2466b715279730d7960ab5a5dd2a140f6ba2907R39 on the ign-cmake side, and back to gazebosim/gz-common@a0d286d#diff-c4216ffdb6192d9b0e30753bc4b385b7a38716c1dd6d73439e9b4f3c9b51fdddR37 on the ign-common side from which the ign-cmake code was copied. It seems that this was more a leftover rather then something that was actually fixing something, but I may be missing something fyi @nkoenig @mxgrey .

If a change in CMAKE_FIND_LIBRARY_SUFFIXES is actually needed, it should be done close to the actual affected find_library call, and the previous value of CMAKE_FIND_LIBRARY_SUFFIXES should be restored as soon as possible.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@github-actions github-actions bot added Gazebo 1️1️ Dependency of Gazebo classic version 11 🌱 garden Ignition Garden 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🏰 citadel Ignition Citadel 🔮 dome Ignition Dome labels Oct 26, 2021
…IXES on Windows

`CMAKE_FIND_LIBRARY_PREFIXES` and `CMAKE_FIND_LIBRARY_SUFFIXES` are variables that are used by
CMake to change the behaviour of the `find_library` call. Changing them to `.lib;.dll` in the CMake config
file of every ignition project affect silently any downstream project that calls `find_package(ignition-<pkg>)`,
even if transitevely, leading to subtle bugs.

Signed-off-by: Silvio <[email protected]>
@j-rivero
Copy link
Contributor

If a change in CMAKE_FIND_LIBRARY_SUFFIXES is actually needed, it should be done close to the actual affected find_library call, and the previous value of CMAKE_FIND_LIBRARY_SUFFIXES should be restored as soon as possible.

Agree. We need to evaluate what changes this PR will bring and the impact of them in the current use cases or distributions of the libraries. Does these changes modify the filenames of the produced libraries?

Let's start by running a testing build of ign-gazebo6 (Fortress) with custom gazebodistro with this PR in cmake2 Build Status.

@traversaro
Copy link
Contributor Author

Does these changes modify the filenames of the produced libraries?

As long as I am aware of, no. I checked directly on CMake source code to be sure, and the only use (excluding Find<>.cmake scripts, tests and Platform files) of that variables is indeed in the find_library implementation:

So I think we can safely exclude that in some way this change should affect the file name of the libraries.

Let's start by running a testing build of ign-gazebo6 (Fortress) with custom gazebodistro with this PR in cmake2 Build Status.

Cool, that's a great way to test this.

@traversaro
Copy link
Contributor Author

Let's start by running a testing build of ign-gazebo6 (Fortress) with custom gazebodistro with this PR in cmake2 Build Status.

Cool, that's a great way to test this.

The test is failing but I guess it is related to gazebosim/gz-sim#990 ? As an alternative test, I also backported this change in conda-forge (conda-forge/libignition-cmake0-feedstock#20) to fix conda-forge/libignition-gazebo-feedstock#30, I can re-build a few ignition libraries and see if there are problems.

@adlarkin adlarkin changed the title To not modify CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES on Windows Do not modify CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES on Windows Oct 27, 2021
@chapulina chapulina added the Windows Windows support label Nov 8, 2021
@j-rivero
Copy link
Contributor

Another try Build Status

@j-rivero
Copy link
Contributor

Another try Build Status

The build failed due to a bug in cmake for an old vcpkg snapshot. Seems like the change is not afffecting in anyway the procedure to find dependencies. Sounds good enough to me to go.

@j-rivero j-rivero merged commit a8b56e1 into gazebosim:ign-cmake2 Nov 29, 2021
@osrf-triage
Copy link

This pull request has been mentioned on Gazebo Community. There might be relevant details there:

https://community.gazebosim.org/t/new-ignition-releases-2022-01-10/1228/1

srmainwaring pushed a commit to srmainwaring/gz-cmake that referenced this pull request Mar 1, 2022
…IXES on Windows (gazebosim#189)

`CMAKE_FIND_LIBRARY_PREFIXES` and `CMAKE_FIND_LIBRARY_SUFFIXES` are variables that are used by
CMake to change the behaviour of the `find_library` call. Changing them to `.lib;.dll` in the CMake config
file of every ignition project affect silently any downstream project that calls `find_package(ignition-<pkg>)`,
even if transitevely, leading to subtle bugs.

Signed-off-by: Silvio <[email protected]>

Co-authored-by: Jose Luis Rivero <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel 🔮 dome Ignition Dome 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🌱 garden Ignition Garden Gazebo 1️1️ Dependency of Gazebo classic version 11 Windows Windows support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants