Skip to content

cmake: Don't export symbols if building static library#820

Merged
leethomason merged 1 commit intoleethomason:masterfrom
orudge:fix-symbol-export
Sep 17, 2020
Merged

cmake: Don't export symbols if building static library#820
leethomason merged 1 commit intoleethomason:masterfrom
orudge:fix-symbol-export

Conversation

@orudge
Copy link
Contributor

@orudge orudge commented May 27, 2020

If you build tinyxml2 as a static library on Windows, its symbols are exported from any DLL or EXE you create. This generally shouldn't happen.

@traversaro
Copy link

Instead of having a COMPILE_DEFINITIONS target depends on BUILD_SHARED_LIBS, could it make sense to set directly the DEFINE_SYMBOL of the tinyxml2 target to TINYXML2_EXPORT, as, despite its name DEFINE_SYMBOL specifies a define that is only used when the library is used as shared?

@orudge orudge force-pushed the fix-symbol-export branch from 8c33971 to b341e66 Compare June 1, 2020 13:58
@orudge
Copy link
Contributor Author

orudge commented Jun 1, 2020

Instead of having a COMPILE_DEFINITIONS target depends on BUILD_SHARED_LIBS, could it make sense to set directly the DEFINE_SYMBOL of the tinyxml2 target to TINYXML2_EXPORT, as, despite its name DEFINE_SYMBOL specifies a define that is only used when the library is used as shared?

That looks like a better fix, thanks!

@orudge
Copy link
Contributor Author

orudge commented Jun 16, 2020

I've just seen that #805 also fixes this issue, though I think the change that @traversaro suggested makes this a better fix. It would be good if we could get this change included in the next release though if possible.

@leethomason
Copy link
Owner

Please see #804. There are so many build PRs open I'm not sure the best approach to reconcile them.

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.

4 participants