-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add option to install only BUILD_SHARED_LIBS-matching files #3081
Add option to install only BUILD_SHARED_LIBS-matching files #3081
Conversation
Adding the option BUILD_SHARED_LIBS explicitly is redundant and harmful and must never be done. This just breaks all projects that add the current project as subproject and doesn't add the option explicitly, which is described in the mentioned documentation.
Also, see the last paragraph at #2696 (comment), which seems to be relevant. If you prefer, another option can be added that installs only shared/static libraries if the option is enabled. |
The documentation explicitly mentions that projects often define this as an But sure, can not introduce this if absolutely undesired.
Then they likely shouldn't be installed in the first place. If you're keeping them around to facilitate linking of the static tdjson, where the dependencies must be available & provided when linking against it, then maybe it would make sense to make them object libraries and only link them into one final user-available static library at the end?
Even when
If always linking both variants is a requirement, then that would be a compromise I'm okay with. |
The documentation mentions this because other projects must be aware, that doing so can break building of the outer project, unless the outer project does the same. Hence, if you are forced to include such harmful subproject, then you must also become a harmful project. Otherwise, everything works by default correctly without any explicit options.
They are needed for native C++ interface and
Object libraries can't be used in target_link_libraries() before CMake 3.12. Therefore, this can't be done without dropping support for older CMake versions and corresponding operating systems. Someday, this will be done, but not yet.
No, it doesn't mean this. As any other options BUILD_SHARED_LIBS is false by default, hence, it means "build static libraries by default". It tells nothing about libraries like
The option can remove static/shared target libraries also, but this will take neglible effect on the build time. |
20eea4f
to
502d330
Compare
TD_ENABLE_FILTERED_INSTALL allows limiting installed libraries & supporting files to only those matching BUILD_SHARED_LIBS.
502d330
to
f14ab44
Compare
I've introduced an option Listing of installed files for each relevant option combination
|
Thank you, @OPNA2608! I will merge the changes, despite I don't like that combination of options is required to achieve behavior changes and that the standard option Also, it is odd that behavior of I will fix both issues myself after merging the commit. |
I replaced the option |
For Debian, I've been asked to get rid of the non-shared libraries that get installed by tdlib. This was previously mentioned in #1810, with the TL;DR there being "
libtdjson_static
must be static, the rest are internal and maybe shouldn't be installed".Here is a shot at resolving this by:
option()
calledTD_ENABLE_FILTERED_INSTALL
(defaultOFF
) to control if the installed libraries & library-supporting files should be limited to matchBUILD_SHARED_LIBS