-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
cmake: Support extended attributes when built with cmake #1176
Conversation
Extended attribute support (--xattr) was omitted when curl was built with cmake since cmake does not test for and set the HAVE_FSETXATTR defines. The configure.ac, configure, make build system is not affected by this issue. Closes #XXXX
@jay, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Sukender, @billhoffman and @Lekensteyn to be potential reviewers. |
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.
Changes look good, but see some inline stylistic comments.
if(CURL_XATTR) | ||
check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR) | ||
if(HAVE_FSETXATTR) | ||
add_definitions(-DHAVE_FSETXATTR) |
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.
This adds an option to the compile command. An alternative is to define macros in a config.h file (lib/curl_config.h.cmake):
#cmakedefine HAVE_FSETXATTR 1
I think this is closer to what autotools does via AC_DEFINE
(but I did not check the output).
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.
Yes, this is a great suggestion.
endforeach(CURL_TEST) | ||
if(HAVE_FSETXATTR_5) | ||
set_source_files_properties(tool_xattr.c PROPERTIES | ||
COMPILE_FLAGS "-DHAVE_FSETXATTR_5") |
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.
This can possibly override other compile flags, so try appending properties and use the special property COMPILE_DEFINITIONS
:
set_property(SOURCE tool_xattr.c APPEND PROPERTY
COMPILE_DEFINITIONS HAVE_FSETXATTR_5)
Same comment for the next line. Alternatively, try adding a #cmakedefine
as before, autotools uses an AC_DEFINE
for these ..._5
and ..._6
options too.
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.
With the curl_config.h.cmake #cmakedefine suggestion this block becomes much simpler:
+check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR)
+if(HAVE_FSETXATTR)
- foreach(CURL_TEST HAVE_FSETXATTR_5 HAVE_FSETXATTR_6)
- curl_internal_test_run(${CURL_TEST})
- endforeach(CURL_TEST)
+endif(HAVE_FSETXATTR)
Thanks for the feedback, I'll prepare an updated patch. |
Thanks again for the feedback. I have attached a shorter patch based on this one that enables xattr support when built using cmake. |
I've added this patch to the branch as draft2 to make it easier to review |
} | ||
#endif | ||
|
||
#ifdef HAVE_FSETXATTR_6 |
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.
Is there any difference between the two main functions below and up?
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.
5 vs 6 arguments in the fsetxattr()
call.
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.
That is for _5 vs _6, but if my diff tool is not broken, the same test programs are duplicated. I think lines 552-568 can be deleted
} | ||
#endif | ||
|
||
#ifdef HAVE_FSETXATTR_6 |
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.
That is for _5 vs _6, but if my diff tool is not broken, the same test programs are duplicated. I think lines 552-568 can be deleted
@Lekensteyn You tool is not broken. It is duplicated block at the end of this file. |
Squash me into previous draft. - Changes to address Peter's review of draft1.
fc60641
to
9c05a8b
Compare
my fault, patch applied it even though there was no change from the first draft. fixed, please check again |
LGTM, let's see what the buildbots say |
Just landed, thanks guys |
Several months ago a patch was proposed on the mailing list to support xattr in cmake builds, but it appears to have slipped through the cracks. It is now the commit in this PR. Can a dev familiar with cmake please review?
/cc @sburford @Lekensteyn @snikulov @jzakrzewski