-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Enhance cmake script #1197
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
Enhance cmake script #1197
Conversation
but LIB_TYPE corresponds to shared/static.
@dota17 , we are using this great library as a submodule in our project (https://github.com/domoticz/domoticz)
https://travis-ci.org/github/domoticz/domoticz/builds/707882330 I tried adding the following lines at the top of our CMakeList.txt file, but it did not make a difference:
Could you tell us what to add ? Maybe the option names could use a slight name change like BUILD_JSONCPP_STATIC_LIBS ? Thanks in advance! |
@gizmocuz Thank you for your timely feedback! It seems that you only need the static library, that ok, but we don't need to change the option name, cause I find real problem, I will fix it today. |
@dota17 , thanks for your fast reply and fix ! Appreciated very much !!! |
@dota17 , unfortunately this change only builds the shared library not the static library I also tried adding the following lines at the top of our CMakeList.txt file, but no luck.... option(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF) There is a small discussion about it here: We are building from source following this tutorial: |
This is strange, in my local compile, when I turned off I think you should forced to set the option |
This PR will break projects relying on CMake imported target, which was |
This PR don't aim to let users use both of them at the same time, but provide these packages, as available choices. |
Correct, but what about breaking change regarding CMake imported target? |
@SpaceIm , if you have an important fix, please submit it. @dota17, of course we appreciate the help, but in general I avoid touching the cmake crap at all. I have found it nearly impossible to maintain with all the versions of cmake's history and all the crazy usage patterns. Cmake maintenance was far more time-consuming than the sum of all other issues. I concentrate on Meson, and I simply accept Cmake patches from users if they seem to know what they're doing.
I disagree with this. In UNIX, it is normal to have something like |
Yes, it's normal to have the same name for static/shared library packages, it is easy to fix, I'll fix it later :-) |
Please submit a PR with a revert, or work with the users on #1271 which has been merged. We honestly have no opinion on cmake changes. But I can tell you that supporting cmake is a never-ending problem. Most issues relate to cmake. It's unbelievable. If you submit a fix and the tests pass, we'll merge it, even if it's a revert. |
User @AMDmi3 put forward a requirement in issue #1170 , that is to use cmake to compile both static and shared libraries. After some investigation, I found that this is a very practical usage scenario. At the same time, I also know a common software usage scenario: In a large software system, the JSON parsing library(like JsonCpp) is the basic library of the system. Client may only need the
xxx.o
files of these basic libraries, and then link them into a shared library(yyy.so
file) to use. Therefore, I made this patch.During this time, I noticed the PR #827, I think the names of static libraries and dynamic libraries should be different. When users call them externally, they should be very clear about what type of libraries they are using, and a different names can guarantee this.
So, basically, the part of this patch is a rollback to that patch.
Cc: @cdunn2001 @hjmjohnson