-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix POSITION_INDEPENDENT_CODE #1347
Fix POSITION_INDEPENDENT_CODE #1347
Conversation
96bd9fe
to
f13f2da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! We depend on users for cmake maintenance. We use meson ourselves.
The TravisCI troubles should be fixed. Please rebase, then merge after the CI tests pass.
Maybe it is a off topic question, but why don't you use GitHub Actions rather than TravisCI and implement a matrix with all possible combinations meson, cmake and different OS? If you're interested I could easily do it. Thanks |
…BUILD_SHARED_LIBS is ON
f13f2da
to
29f9853
Compare
Hello @cdunn2001, Thanks |
Yes! Very interested. We would gladly accept your help. |
I think we already test cmake in AppVeyor. But as long as the tests run fast, more robustness would be welcome. |
@@ -180,7 +180,7 @@ if(BUILD_OBJECT_LIBS) | |||
OUTPUT_NAME jsoncpp | |||
VERSION ${PROJECT_VERSION} | |||
SOVERSION ${PROJECT_SOVERSION} | |||
POSITION_INDEPENDENT_CODE ON | |||
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it really make sense? I would have removed it, that's all (same behavior than STATIC). I mean, BUILD_SHARED_LIBS is orthogonal to BUILD_OBJECT_LIBS.
@@ -119,7 +119,7 @@ if(BUILD_SHARED_LIBS) | |||
OUTPUT_NAME jsoncpp | |||
VERSION ${PROJECT_VERSION} | |||
SOVERSION ${PROJECT_SOVERSION} | |||
POSITION_INDEPENDENT_CODE ON | |||
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the BUILD_SHARED_LIBS branch, so it's always ON in this block. And actually forcing POSITION_INDEPENDENT_CODE
for a shared lib is useless because it's implicit in CMake. Therefore this line could be removed, it's misleading.
@SpaceIm about your suggestions..... in my opinion, the best solution is just to put at the root level, and just once this:
I didn't want to do that change because I just took a quick way. Thanks |
I disagree. I like principle of least surprise:
|
Ok, I'm fine with whatever solution meanwhile there is a way by flags of disabling the Thanks |
@SpaceIm , I didn't realize there was controversy. If you feel strongly about this, please submit a PR with a better solution. We try to let the cmake community reach consensus. |
Description
This PR just fixed a wrong configuration in the
cmake
files with thePOSITION_INDEPENDENT_CODE
, it should be just enabled when theBUILD_SHARED_LIBS
config is enabled as well.The specific details about the issue can be found here:
#1344
Thanks