cmake-rs icon indicating copy to clipboard operation
cmake-rs copied to clipboard

Infer CMAKE_BUILD_TYPE from DEBUG enviroment variable

Open DavidEichmann opened this issue 8 years ago • 2 comments

I'm relatively new to cmake and to custom rust/cargo build scripts so, correct me if I am wrong. Currently this library doesn't observe the DEBUG environment variable. It may be useful to do this in order support release/debug builds via cargo. I'm suggesting that if DEBUG="true" then set CMAKE_BUILD_TYPE="Debug" else if DEBUG="false" set CMAKE_BUILD_TYPE="Release" else don't set CMAKE_BUILD_TYPE.

DavidEichmann avatar Feb 05 '17 16:02 DavidEichmann

Ah yeah so right now we infer debug/release based on cargo build vs cargo build --release, but adding and explicit env var seems reasonable to!

alexcrichton avatar Feb 05 '17 21:02 alexcrichton

Since "DEBUG"(the environment variable) is not a common and standardized variable for these situations, I think cmake(the crate) should not treat it in a special way. It's not hard as a user to do env!("DEBUG")/option_env!("DEBUG") and then treat that however you want, after which to call cmake_config.profile("[what the user wants]").

lilianmoraru avatar Apr 08 '17 22:04 lilianmoraru