-
Notifications
You must be signed in to change notification settings - Fork 982
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
Could not find toolchain file when calling CMake on Windows, Linux #17324
Comments
Hi @ibis-hdl Thanks for the details. I see now what is the issue. The default The solution would be to encode your layout accordingly in the I'll have a look to see if |
Trying to allow this, I have realized that settings def test_recipe_build_folders_vars_empty():
client = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
from conan.tools.cmake import cmake_layout
class Conan(ConanFile):
name = "pkg"
version = "0.1"
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain"
def layout(self):
self.folders.build_folder_vars = ["settings.compiler", "settings.build_type"]
cmake_layout(self)
""")
client.save({"conanfile.py": conanfile})
client.run("install . -s os=Windows -s compiler=gcc -s compiler.version=10 "
"-s compiler.libcxx=libstdc++11 -s arch=armv8 -s build_type=Debug")
presets = client.load("build/gcc-debug/generators/CMakePresets.json")
assert "conan-gcc-debug" in presets So if your preset name is |
Thank you for your help. Using this works on Linux now. I changed the ...
def layout(self):
# conan.io #17324
self.folders.build_folder_vars = ["settings.compiler", "settings.build_type"]
cmake_layout(self)
... Now, the problems rise as described on the bottom of the first thread on Windows. To exclude some side effect from Linux settings on Windows build, I temporarily removed the inheritance of On Windows, I have now a
I did run on Windows terminal:
All went fine. Now:
There is a file
Anyway, now I'll come back to the
to Finally, probably I have a wrong understanding about Ninja's
isn't it? For reference (and hopefully to make my intention clear), I attach the complete |
Hi @ibis-hdl Thanks for your feedback. The gen = conanfile.conf.get("tools.cmake.cmaketoolchain:generator", default=generator)
if gen:
multi = "Visual" in gen or "Xcode" in gen or "Multi-Config" in gen
else:
multi = conanfile.settings.get_safe("compiler") == "msvc" If that doesn't help, I'd suggest the following, as this is getting a bit too difficult to understand and follow as text. |
Thank you, I'm preparing an special Github repository ... |
What is your question?
I refer here to issue #17209 and like to restart.
I'm a consumer of
catch2
package and want to compile my project/app on Linux, Windows and macOS (even I don't own one) using CMake's default build toolninja
.For this I have the following
conanfile.py
Further, I have these (shortened) presets:
As you see I like to have the buildDir
${sourceDir}/build/${presetName}
. Creating Conan profiles is working as expected, also installing by Conan:On Linux:
After running this, I have the default build/{Debug,Release}/generators structure from conan, where "toolchainFile": "generators/conan_toolchain.cmake". The point is here "binaryDir": "${sourceDir}/build/${presetName}" from CMakePresets.json. This is my preferred build tree for Linux, Windows and Darwin. Hence, this error rises:
I would assume, set I can the build_dir at conanfile.py (how to do in detail? cmake_layout?). Is it useful to use
--output-folder
to point to"binaryDir": "${sourceDir}/build/${presetName}"
?Here I have some concerns related to my typically workflow:
conan install ...
: Conan should nothing know about cmake's presets to be used later (it's a provider for 3rd party libraries), but this would be important for the output path.cmake --preset xyz
cmake --build --preset xyz
To make things more complicated, Windows and XCode? uses Ninja's multi-config feature, where Conan's directory hierarchy is different. How to cope with this situation? How is the intended process for multi-platform projects on consumer side?
During writing/preparing/testing this question I face just another (related? Ninja's multi-config single-config feature) problem related to CMake presets holding Linux and Windows settings and build tool (conan-relese, conan-debug vs. conan-default on Windows) which I have to tackle down next, but basically the same toolchain path file problem as on Linux.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: