-
Notifications
You must be signed in to change notification settings - Fork 21
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
Prevent superfluous warnings from ranlib about libcellml.a having no symbols on macOS #533
Conversation
…symbols on macOS (cellml#532).
# Prevent superfluous warnings from ranlib about libcellml.a having no symbols | ||
# on macOS. | ||
if(APPLE) | ||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") |
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 this line required? Does it change anything from the default?
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, I have no idea why, but if you don't set CMAKE_CXX_ARCHIVE_CREATE
and CMAKE_CXX_ARCHIVE_FINISH
then you get two warnings. If you only set one of them then you still get one warning. It's only when you set both that no warning is generated.
# on macOS. | ||
if(APPLE) | ||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") | ||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") |
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.
Would it be better to do this through a target property on STATIC_LIBRARY_OPTIONS?
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.
What do you have in mind exactly? Happy for you to suggest some code. :)
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.
set_property(
TARGET cellml
APPEND
PROPERTY STATIC_LIBRARY_OPTIONS "-no_warning_for_no_symbols"
)
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.
I have just given it a try, but to no avail:
FAILED: src/libcellml.a
: && /usr/local/Cellar/cmake/3.16.3/bin/cmake -E remove src/libcellml.a && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc src/libcellml.a -no_warning_for_no_symbols src/CMakeFiles/cellml.dir/component.cpp.o src/CMakeFiles/cellml.dir/componententity.cpp.o src/CMakeFiles/cellml.dir/debug.cpp.o src/CMakeFiles/cellml.dir/entity.cpp.o src/CMakeFiles/cellml.dir/error.cpp.o src/CMakeFiles/cellml.dir/generator.cpp.o src/CMakeFiles/cellml.dir/generatorprofile.cpp.o src/CMakeFiles/cellml.dir/importedentity.cpp.o src/CMakeFiles/cellml.dir/importsource.cpp.o src/CMakeFiles/cellml.dir/logger.cpp.o src/CMakeFiles/cellml.dir/model.cpp.o src/CMakeFiles/cellml.dir/namedentity.cpp.o src/CMakeFiles/cellml.dir/orderedentity.cpp.o src/CMakeFiles/cellml.dir/parser.cpp.o src/CMakeFiles/cellml.dir/printer.cpp.o src/CMakeFiles/cellml.dir/reset.cpp.o src/CMakeFiles/cellml.dir/units.cpp.o src/CMakeFiles/cellml.dir/utilities.cpp.o src/CMakeFiles/cellml.dir/validator.cpp.o src/CMakeFiles/cellml.dir/variable.cpp.o src/CMakeFiles/cellml.dir/version.cpp.o src/CMakeFiles/cellml.dir/xmlattribute.cpp.o src/CMakeFiles/cellml.dir/xmldoc.cpp.o src/CMakeFiles/cellml.dir/xmlnode.cpp.o src/CMakeFiles/cellml.dir/xmlutils.cpp.o && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib src/libcellml.a && /usr/local/Cellar/cmake/3.16.3/bin/cmake -E touch src/libcellml.a && :
ar: -no_warning_for_no_symbols: No such file or directory
ninja: build stopped: subcommand failed.
I then tried to replace STATIC_LIBRARY_OPTIONS
with STATIC_LIBRARY_FLAGS
, as suggested here, but still no luck. The same when replacing APPEND
with APPEND_STRING
with either STATIC_LIBRARY_OPTIONS
or STATIC_LIBRARY_FLAGS
.
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.
After consideration I think it would be better to exclude the debug.cpp
file from the build instead. And then add in an option to the configuration to enable debug helper methods.
I don't think I'm really not qualified to comment/review/whatever this PR ... :( sorry ... |
As an alternative see #536. |
Agreed, not to have |
Addresses issue #532.