CMake: avoid using -fvisibility on WIN32 since it's useless #716
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.
When compiling the engine for Windows with MinGW-w64, I got thousands of warnings like this one:
The engine is compiled anyways and it is working, but all these messages are quite noisy because they confuse the output on the console a lot.
However, GCC is right because there is no need to set
-fvisibility=hiddenwhen the objects are built.On Windows, all global symbols are always hidden: an export .DEF file or to declaring exported symbols with
dllexportkeyword is required for the purpose.I have seen there is already a point into
neo/CMakeLists.txt.Here, if the target platform is AROS, then the
-fvisibility=hiddenis not added.In my opinion, it would be worth to add also
WIN32here for removing this behaviour.For i686 and x86_64, this is not so critical because you get the executables anyways at the end.
Instead, CMake doesn't work without this fix if you select Aarch64 as target platform.
It prints this message on the console:
At the moment, I don't know why this happens to me.
Probably there is some difference between the cross compilers for Intel and ARM64.
Perhaps, there are some
-Werrorsomewhere that Aarch64 has but i686/x86_64 have not.However, since
-fvisibilityis technically useless on Windows and a test case already exists intoCMakeLists.txt, it should be not a big trouble to fix it. Attached patch shows you the change.I hope that you will find it useful.