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
rectanglebinpack: add rectanglebinpack/cci.20210901 recipe #7112
rectanglebinpack: add rectanglebinpack/cci.20210901 recipe #7112
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
self.cpp_info.names["cmake_find_package"] = "RectangleBinPack" | ||
self.cpp_info.names["cmake_find_package_multi"] = "RectangleBinPack" |
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.
targets are not exported
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.
Blah #7153 they match upstream
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" |
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.
generators = "cmake", "cmake_find_package" | |
generators = "cmake" |
not used
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): |
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.
if not tools.cross_building(self.settings): | |
if not tools.cross_building(self): |
self.copy("*.a", dst="lib", keep_path=False) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = tools.collect_libs(self) |
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.
self.cpp_info.libs = tools.collect_libs(self) | |
self.cpp_info.libs = ["RectangleBinPack"] |
if(NOT "${CMAKE_CXX_STANDARD}") | ||
set(CMAKE_CXX_STANDARD 11) | ||
endif() | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
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.
maybe move this in a patch and submit it upstream?
It would prefer target_compile_features(RectangleBinPack PUBLIC cxx_std_11)
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 will submit this to upstream, but since the upstream cmake file has two targets (RectangleBinPack
and MaxRectsBinPackTest
) which need C++11 support, isn't it better to just define set(CMAKE_CXX_STANDARD 11)
instead of defining target_compile_features
for both targets?
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.
No, CMAKE_CXX_STANDARD
should never be used in libraries. Nowadays target_compile_features
should be preferred in libraries, it allows to ask for a minimum C++ standard (while CMAKE_CXX_STANDARD
asks for the upper bound).
Then final project can decide to enforce a specific C++ standard through CMAKE_CXX_STANDARD
in all its dependencies.
It also plays better with compiler.cppstd
in conan profiles.
It's worth noting that even with if(NOT "${CMAKE_CXX_STANDARD}")
, this block is NOT equivalent to target_compile_features(target PUBLIC cxx_std_11)
:
if(NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 11)
endif()
Indeed, if CMAKE_CXX_STANDARD has not been explicitly set downstream, target_compile_features(target PUBLIC cxx_std_11)
may use any standard greater or equal than 11 (I guess CMake prefers default C++ standard of the compiler if possible).
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.
All right, I'll use target_compile_features
, thanks for the explanation!
All green in build 5 (
|
Specify library name and version: rectanglebinpack/cci.20210901
We use this library as a dependency, so we would like to provide this recipe so anyone can use it.
conan-center hook activated.