[CXX-675] Support for environment variables CC, CXX, CFLAGS, CXXFLAGS, LD, CPP, ... Created: 24/Sep/15  Updated: 23/Feb/16  Resolved: 23/Feb/16

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Karolin Varner Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The standard environment variables should be used when compiling;

at the moment those variables are disregarded and one needs to specify -DCMAKE_CXX_COMPILER explicitly



 Comments   
Comment by Andrew Morrow (Inactive) [ 23/Feb/16 ]

The CMake way is the correct way to handle this.

Comment by Githook User [ 24/Sep/15 ]

Author:

{u'username': u'koraa', u'name': u'Karolin Varner', u'email': u'karo@cupdev.net'}

Message: CXX-675 Static bsoncxx library wrongly called libbson.a
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/4f447bcfcac0dc47f55a19f1c4b4739ea70efa57

Comment by Andrew Morrow (Inactive) [ 24/Sep/15 ]

We will consider it, but for now I don't think we want to change this. Perhaps later we can add a build flag that will allow opt-in to populating the CMake variables from the analogous shell variables, but given that there is an easy workaround (cmake -DCMAKE_C_COMPILER=$CC) I don't think this is a priority for us.

Comment by Karolin Varner [ 24/Sep/15 ]

I am aware that it is pretty common for cmake projects to ignore these, which in my opinion is pretty terrible.

Neither are those variables autoconf specific. They provide a generic non-tool-specific way of setting those variables and they have been around for a long time.
It's a de-facto standard.

The argument for not supporting them normally is around the lines, that one wants a clean, reproducible build on all systems.
Personally, I disagree with that argument, because it assumes those variables are generally set by accident or something.
If someone decides to specify those variables, even in their shell configuration, they probably intended something with it. If the setting specified in those variables is the cause of failure, IMO the correct way to deal with that is to fail and let the user decide how she wants to deal with the situation, rater than silently choosing a different compiler.

Comment by Andrew Morrow (Inactive) [ 24/Sep/15 ]

karo - I think that is actually pretty standard for CMake based projects. You are expected to set the CMake variables on the command line, not the autoconf style ones.

Generated at Wed Feb 07 21:59:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.