-
Notifications
You must be signed in to change notification settings - Fork 380
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
feature request: add an option and support for build, use, and install a dynamic library too #85
Comments
This request has great value proposition. Creating libraries that can be built as both static and shared is something that a lot of people get wrong. Recently, I had to correct some Boost people in the cpplang slack regarding this topic, so this issue affects developers of every skill level. The reason for this is simply that the language itself and the surrounding systems are two entirely separate worlds. @TheLartians I have a repository that is a sort of tutorial to show how creating such a library that can be built as both static and shared has to take into consideration and what code has to be present in the CML of the project. You can find this project here: https://github.com/friendlyanon/cxx-static-shared-example |
One thing I worry about if the extra complexity is actually worth it for "regular" projects built using the starter or if this is more a "niche" feature. From my personal experience (which may be completely off ¯\_(ツ)_/¯), shared libraries are used very far down the line and not usually a requirement relevant to 99% of new projects or single-purpose libraries. I feel that too much initial complexity could make the starter unattractive to new users. That said, it seems like something that should be made as easy as possible to add later on and that would be useful to be documented somewhere in the starter. |
Echoing what I said in TheLartians/PackageProject.cmake#19 (comment), I would add a function to this project that generates the export header and sets up the target with the necessary properties, and maybe that function could interact in a nice way with |
Maybe it would be best to create two templates? Based on my experience the requirements for a cpp starter template to create an executable are quite different to building a library. For a library:
For an exectuable:
I just think the requirements are rather different and it's best to create two templates |
That is indeed correct. One of the reasons I created cmake-init, among many other things. |
Oh that's quite nice! I think this is the right step in the right direction. An init script allows the flexibility one needs with cmake! |
How I can you cmake-init for existing project like libsodium? |
concept is shown at https://crascit.com/2019/10/16/cppcon-2019-deep-cmake-for-library-authors/
for a demo implementations see #83
The text was updated successfully, but these errors were encountered: