Comments (9)
Hi @lstoffer
Thanks for your question.
I would say this is not possible. The package_folder
is automatically defined to be the Conan cache folder when the package is created, but it cannot be arbitrary. The conan create
command must always end with a Conan package in the Conan cache, and pointing to a different location would break things.
I am not sure what you are trying to do, but if what you want is to get a copy of the final artifacts (not only for that package, but maybe also for dependencies), you might be interested in the deployers.
Please check for example https://blog.conan.io/2023/05/23/Conan-agnostic-deploy-dependencies.html. With this, you can extract and copy (deploy) artifacts from within Conan packages in the cache and put them where you want.
This in general is not the recommended floe for development. For development, and using Conan packages, there recommendation is to use them from the Conan cache. The deploy
process would be to extract the files out of Conan, and use them without Conan, for example, to create debian package out of the files to deploy in the production servers, or to create a windows auto-installer for a desktop application.
Please let me know if this is what you were looking for.
from conan.
Hi @memsharded
Thank you very much for your reply!
What I am trying to achieve is to build an application in Visual Studio that has some plugins (that are built together with the application) and also debug the application in Visual Studio.
Using the conan-debug
preset and running cmake it is trying to install the plugins and application to Program Files.
In VS Code I am setting "-DCMAKE_INSTALL_PREFIX=${workspaceRoot}/out/install"
when calling cmake in order to set the install prefix path.
Is there a way to achieve similar behavior in the layout()
or package()
methods such that conan create
is not affected?
from conan.
For the "local development flow", which are the conan install + conan source + conan build
the package_folder
is not defined at all (it is None
), because the concept of package doesn't exist yet. Until the package is "created" in the Conan cache, there is no package folder.
The layout()
method can be used to reference folders like "bindirs" of "source" and "build", but that is mostly for packages when they are in "editable" mode, so those binaries can be used by consumers that requires
that package reference that is in editable mode.
But I am afraid that I still don't fully get the full picture. If the flow is conan install + cmake
, you can do whatever you want in both places? Like conan install
can deploy, copy, or do whatever it wants in the generate()
method, mostly of its dependencies. And cmake ...
can do whatever it wants to do with its own binaries?
from conan.
How I understand it is that conan creates the CMakePresets.json file when using the conan-debug preset on installing. Visual Studio then uses this CMakePresets.json file to determine DCMAKE_INSTALL_PREFIX. Is there an option to set this DCMAKE_INSTALL_PREFIX in the automatically generated CMakePresets.json file?
So basically the conan-debug
preset looks like this:
"configurePresets": [
{
"name": "conan-debug",
"displayName": "'conan-debug' config",
"description": "'conan-debug' configure using 'Ninja' generator",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
"CMAKE_BUILD_TYPE": "Debug"
},
"toolset": {
"value": "v143",
"strategy": "external"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolchainFile": "C:\\Users\\lst\\git\\proj\\out\\build\\Debug\\generators\\conan_toolchain.cmake",
"binaryDir": "C:\\Users\\lst\\git\\proj\\out\\build\\Debug"
}
],
And what I am trying to achieve is to add the following line to the cacheVariables
:
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/Debug"
from conan.
I see.
You have some ways to control what is generated into the presets file. You can do something like:
def generate(self):
tc = CMakeToolchain(self)
if self.conf.get("user.myteam:cmake_prefix"):
tc.cache_variables["CMAKE_INSTALL_PREFIX"] = self.conf.get("user.myteam:cmake_prefix")
tc.generate()
Then you only need to call it with conan install . -c &:user.myteam:cmake_prefix=xxxx
to pass the value. Note the &
means "the current consumer", so in case you have it defined in other recipes, it won't interact with them.
Please let me know if this helps.
from conan.
Thank you very much, this kind of looks like what I am looking for.
However, do I understand this right that I have to change the conan config
in order to use this method? Or is there also a possibility to pass this user.myteam:cmake_prefx
variable directly when calling conan install
?
from conan.
However, do I understand this right that I have to change the conan config in order to use this method? Or is there also a possibility to pass this user.myteam:cmake_prefx variable directly when calling conan install?
Yes, the conf
items can be defined in:
- In the
global.conf
file in the cache (typically managed withconan config install
) - In the
[conf]
section of your profiles (profiles typically shared withconan config install
too) - In the command line arguments
-c ...
Sorry there was a mistake in my suggestion above, the command wouldn't be conan config install .. -c ...
but just:
$ conan install . -c &:user.myteam:cmake_prefix=xxxx
I hope this clarifies it.
from conan.
Thank you very much!
That was exactly what I was looking for.
from conan.
Happy to help! :)
from conan.
Related Issues (20)
- How can I read CPPFLAGS HOT 17
- [question] Recommended way of calling conan from python program HOT 8
- [question] Problem deploying oneMKL prepackaged binaries in custom package HOT 21
- [bug] tools.build:compiler_executables won't work with Meson due to spaces in the compiler path HOT 5
- Cannot install qt 6.7.0 prebuilt binary on Windows HOT 4
- [question] How to use editable library with cmake's conan provider file HOT 2
- [bug] `qt` install broken since 2.3.0 HOT 2
- [question] How can I not export sources when creating a package and publishing it HOT 3
- [question] Compatibility Issues HOT 5
- Conan CLI: Add option to conan remove to just skip without error if package does not exist HOT 2
- [feature] expose CMakeToolchain conf to be able to set CMAKE_GENERATOR_INSTANCE HOT 1
- conan export-pkg command not passing --version to the recipe with Conan 2.2.3 HOT 8
- [question] Revision mismatch between OSes HOT 1
- [bug] detect_api.detect_clang_compiler provides the minor version of the compiler HOT 4
- SSLError: HTTPSConnectionPool HOT 2
- [question] "control" cmake include dir variable HOT 7
- [bug] -o:h shared=True is not used when installing packages HOT 2
- [bug] Docker runner does not honor custom container name HOT 2
- [question] Change package_id() function to consider package_id of one dependency HOT 5
- [bug]: conan 1.x: generate() is not called when conan build is invoked HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conan.