How to pull in CMake dependencies #339
Replies: 2 comments 3 replies
-
Alright I finally managed to compile it. But it's nowhere near perfect. This is my chalet file: "cppgfx": {
"kind": "cmakeProject",
"location": "${external:cppgfx-src}",
"recheck": true,
"targets": [
"cppgfx"
]
},
"inversekinematics": {
"kind": "executable",
"language": "C++",
"settings:Cxx": {
"cppStandard": "c++23",
"cppModules": true,
"warningsPreset": "pedantic",
"includeDirs": [
"src",
"${external:cppgfx-src}/include",
"${externalBuild:cppgfx}/_deps/sfml-src/include",
"${externalBuild:cppgfx}/_deps/spdlog-src/include",
"${externalBuild:cppgfx}/_deps/glm-src",
"${externalBuild:cppgfx}/_deps/imgui-src"
],
"staticLinks": [
"cppgfx",
"sfml-audio",
"sfml-system",
"sfml-window",
"sfml-network",
"sfml-graphics",
"ImGui-SFML"
],
"libDirs": [
"${externalBuild:cppgfx}/",
"${externalBuild:cppgfx}/_deps/sfml-build/lib",
"${externalBuild:cppgfx}/_deps/imgui-sfml-build",
"${externalBuild:cppgfx}/_deps/imgui-build",
"${externalBuild:cppgfx}/_deps/spdlog-build"
],
"defines": [
"SFML_STATIC"
]
},
"files": "src/**.cc"
} It does work, but it feels like a horrible hack to have to do all of this, basically I have to recreate the entire project structure from CMake here, including the structure of ALL transient dependencies. There are surely many more dependencies I am missing, but they are not used yet and don't cause errors. Also, this is very fragile and will probably break often. Linking dynamically is out of the question at this point, it would blow up complexity x3. Is there a better way to do this? Can it maybe |
Beta Was this translation helpful? Give feedback.
-
What would be great in the documentation is a full example on how to use it. Especially in The example could show a full configuration on how to include a very popular library with modern CMake support, like spdlog, or nlohmann::json, or something similar. That would significantly help to understand the relations between targets. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there!
I want to use Chalet for a new project, but I depend on another library of mine, which has modern CMake support.
I already managed to get the library by specifying it as a git dependency and Chalet immediately cloned it. However, how do I now use the library in the build process? I could not find that in the documentation, I know there is CMake integration, but can a third-party dependency automatically be build using CMake, and the rest using Chalet? Or do I have to rewrite the build system in both to be Chalet?
By the way, I don't know all of Chalet's features yet, but if it had CMake integration in both directions, it would be the ultimate winner for me, and I would use it for all projects. I mean if Chalet could automatically consume modern CMake libraries by just specifying the git repo, and if CMake projects could consume Chalet libraries (maybe with a CMake file that calls chalet). Dunno if that's possible, but that would be the ultimate win for me.
Beta Was this translation helpful? Give feedback.
All reactions