poac-dev / poac

A package manager and build system for C++
https://poac.dev
Apache License 2.0
985 stars 66 forks source link

How to specify -stdlib when using clang++ #923

Open watiko opened 1 month ago

watiko commented 1 month ago

It is possible to specify -stdlib by writing the following in poac.toml, but it will not work when CXX=g++.

[profile]
cxxflags = ["-stdlib=libc++"]

I felt it would be useful if there was a way to make it work for both CXX=clang++ and CXX=g++. I'm not sure what the best way is, but I wrote notes of what I came up with.

ken-matsui commented 1 month ago

@watiko For conditional CXXFLAGS, I think adding cfg works better. For example:

[target.'cfg(compiler = "clang++")'.profile]
cxxflags = ["-stdlib=libc++"]

For fixing CXX to a specific compiler, I am not sure that we should do it. Let me think of it.