-
Notifications
You must be signed in to change notification settings - Fork 994
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
Using build type in components #7326
Comments
@steffenroeber I don't think it requires a new feature for components. We already use if self.settings.build_type = "Debug":
self.cpp_info.components["Core"].libs = ["Qt5Cored"]
else:
self.cpp_info.components["Core"].libs = ["Qt5Core"] #release OR lib_suffix = "d" if self.settings.build_type == "Debug" else ""
self.cpp_info.components["Core"].libs = ["Qt5Core" + lib_suffix] Again, it's not a new concept, this approach is the regular used for any recipe. |
To clarify a bit more about future plans: there are no plans to support multi-config components. With the new "multi" generators, like |
Ok. Thank you. Could you say when the cmake generator will support components? |
Hi! The idea is to deprecate the With the introduction of the new toolchain feature the main functionality of the Anyway, as said before, we would love to hear from your use-case to know if we are missing something and deprecating these things will be a blocker for some of our users. Will the approach suggested by @uilianries work for you? Do you see any problem if Thanks! |
I currently evaluate migrating from cmake to cmake_find_package toolchain. Best regards |
There are other alternatives you can consider:
|
Your second approach sounds smart. But I couldn't apply it in my conanfily.py:
This gives me an error. Is it possible to set build_type of icu in conanfile.py? |
I would strongly discourage that approach. It couples your QT recipe with a hack. If you cannot add that line to your profiles I would modify the ICU recipe, but not the consumers. You can fork the recipe you are using (the Conan Center one?) class ICURecipe(ConanFile):
settings = "os", "arch", "compiler", "build_type"
def build(self):
if self.settings.build_type == "Debug":
raise ConanInvalidConfiguration("In this company, ICU in Debug mode is not allowed")
def package_id(self):
del self.info.settings.build_type With these changes you ensure that noone will build the Anyway, once again, I would recommend you the profiles approach. |
Thanx a lot. I'll try this profile approach. |
Great! I'm closing this issue now, but feel free to open or comment if you need help/advice/opinion about it. Thanks! |
I actually have one more question but I don't know if this is the right place to ask. CMake Error: AUTOGEN: No valid Qt version found for target cbl. AUTOMOC disabled. Previously I used find_package(Qt5Core REQUIRED) (the find package from cmake itself).
` Best regards |
Meanwhile, I found that I may add a moc target in components, too. |
No. If you want to export your application, you add it to PATH and set a specific variable for that app. For instance: https://github.com/conan-io/conan-center-index/blob/3e43313932c67d04539e8ceecc1ba3cb6d60cd33/recipes/autoconf/all/conanfile.py#L84 Please, read Components documentation for further information. |
self.env_info.PATH.append(bin_path) seems not to work with cmake_find_package(_multi) |
Isn't #5408 exactly what I mean/need? Was/will this be merged anytime? |
You need to associate the RunEnvironment to append the PATH, it won't happen directly to your system. If you are only consuming the recipe, you should use virtualrunenv generator too.
No. The PR was closed months ago, the current state doesn't provide that. Please, follow #7240, that's the new feature for your topic. |
Example:
Old golbal approach
self.cpp_info.debug.libs += [Qt5Cored]
self.cpp_info.release.libs += [Qt5Core]
New approach with components:
self.cpp_info.components["Core"].libs = ["Qt5Cored"] #debug
#self.cpp_info.components["Core"].libs = ["Qt5Core"] #release
self.cpp_info.components["Core"].requires = ["openssl::openssl"] #same for debug and release
Is their any plan to support different buid_type for specifying component?
Best regards
Steffen
The text was updated successfully, but these errors were encountered: