Fix compilation and loading of shared libraries on Windows #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #6 .
There are three kind of fixes, listed in the following. If useful, I can split them in separate commits and/or PRs:
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLSto ensure that the libraries export all their symbols, as done in Linux and macOS..libimport library used in linking (that are installed in$CMAKE_INSTALL_PREFIX/lib), and the.dlllibrary used in loading ($CMAKE_INSTALL_PREFIX/bin). The current cmake code installs both of them in$CMAKE_INSTALL_PREFIX/lib, creating runtime problems (see Apriltag detector does not work on Windows as it installs dll in wrong path RoboStack/ros-jazzy#70). Since CMake 3.16 (the minimum version supported here) the easiest solution to install libraries in the correct locations is just to remove theDESTINATIONargument frominstall(TARGETS, as the default locations are the correct ones: https://cmake.org/cmake/help/v3.16/command/install.html#installing-files .