question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] It seems, that it is not possible to specify build and install folders with new generators

See original GitHub issue

It seems, that it is not possible to specify build and install folders with new generators, when compiling for a local workflow. If I am wrong, please write a script, that will build a new cmake template to a certain folder.

My build script was always:

conan build   . --build-folder=build --source-folder=. && \
conan package . --build-folder=build --package-folder=bin```

### Environment Details (include every applicable attribute)
  * Operating System+version: Linux Ubuntu 22.04
  * Compiler+version: any
  * Conan version: 1.53.0

### Steps to reproduce (Include if Applicable)
conan new test/0.0.0 --template cmake_exe
conan install . --install-folder=build --build missing

### Logs (Executed commands with output) (Include/Attach if Applicable)

<!--
conanfile.py (test/0.0.0): Installing package
Requirements
Packages

Installing (downloading, building) binaries...
conanfile.py (test/0.0.0): Generator txt created conanbuildinfo.txt
conanfile.py (test/0.0.0): Calling generate()
conanfile.py (test/0.0.0): WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
conanfile.py (test/0.0.0): Preset 'release' added to CMakePresets.json. Invoke it manually using 'cmake --preset release'
conanfile.py (test/0.0.0): If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/home/andrei/sources/tmp/build/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
conanfile.py (test/0.0.0): Aggregating env generators
conanfile.py (test/0.0.0): Generated conaninfo.txt
conanfile.py (test/0.0.0): Generated graphinfo
Using lockfile: '/home/andrei/sources/tmp/build/conan.lock'
Using cached profile from lockfile
conanfile.py (test/0.0.0): Calling build()
ERROR: conanfile.py (test/0.0.0): Error in build() method, line 30
	cmake = CMake(self)
	FileNotFoundError: [Errno 2] No such file or directory: '/home/andrei/sources/tmp/build/build/generators/CMakePresets.json'-->

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
czoidocommented, Oct 25, 2022

Hi @AndreyMlashkin,

The problem here is that that information that used to be provided in command line now it’s provided in the layout() method, the documentation about the developer flow is probably outdated and we should update it to mention the layout method there. In this case you can just run:

conan install .
conan build .
conan export-pkg .

As the layout() is already providing the folders information. If you need to use other locations you can change the default cmake_layout folders using the src_folder and build_folder arguments in cmake_layout()

0reactions
BlueSoleicommented, Oct 26, 2022

I just encountered the same issue, so thanks @AndreyMlashkin for open this issue.
to not pollute the source tree I did this:

mkdir build && cd build
conan install ..
conan build .,
conan export-pkg ..

@czoido can you explain why it won’t happen in Conan 2.0?
Can I today move to 2.0 so I can set the folder as I used to? And for fixing the docs, I would do it A.S.A.P as it is very frustrating to fail on such a fundamental thing 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

[bug] layout: self.folders.generators not working like --install ...
Hi @heili77. This is expected. The new layout() generators folder only applies to the new generators, those in from conan.tools.xxxx ...
Read more >
vsCode setup check question - Tools (IDE, programmer etc.)
Hi, I've been following the 'PSoc6 Dual Core Project for VS code' instructions from Github and in section 4, Check I find make...
Read more >
Yo unaware of installed generators - Stack Overflow
I just installed Yeoman and some generators. However, because the /usr/lib folder is protected, I chose to change the prefix of the location...
Read more >
Error running the selected code generator :" value
the error that occurred when I created the controller view, I had to select the current view folder, and then right click add...
Read more >
CMake profiles | CLion Documentation - JetBrains
Change the profile name, build type, and other settings as required ... Go to File | New Projects Setup | Settings for New...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found