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

Cmake restart fix v2

Open Dushistov opened this issue 3 years ago • 8 comments

Extracted from comments that I add to cmake-rs:

// Acording to // https://gitlab.kitware.com/cmake/cmake/-/issues/18959 // CMake does not support usage of the same build directory for different // compilers. The problem is that we can not make sure that we use the same compiler // before running of CMake without CMake's logic duplication (for example consider // usage of CMAKE_TOOLCHAIN_FILE). Fortunately for us, CMake can detect is // compiler changed by itself. This is done for interactive CMake's configuration, // like ccmake/cmake-gui. But after compiler change CMake resets all cached variables. // So

run cmake twice with parameters specified by user of cmake-rs to make sure that settings not disappear. Tested on macOS during several weeks. As I found out the problem that I faced in #98 , is unrelated to this patch, and related to alexcrichton/cc-rs#530 , but I made little changes of the implementation to make it more robust.

Dushistov avatar Jul 13 '20 16:07 Dushistov

I faced with this problem on macOS, where /usr/bin/clang and /Application/Xcode/.../clang are different binaries, but have the same version. Plus some tools like to set /usr/bin/cc (that link to /usr/bin/clang) but cmake can not distinguish them.

Dushistov avatar Jul 13 '20 16:07 Dushistov

@alexcrichton , have no time to review, or have some doubts about this PR?

Dushistov avatar Sep 01 '20 20:09 Dushistov

First off, I want to say I'm sorry for being so glacially slow on this PR, I got too used to this email sitting in my inbox.

Other than that though I'm reading this over and this looks pretty reasonable to me, thanks for sending this PR and doing the work here! Code-wise I was wondering if perhaps run_{configure,build} could share some implementation? They're largely the same except for one needing to run two commands instead of one. Also, the comment on run_and_check_if_need_reconf looks like it may have been cut off?

Again I'm sorry about the pace here, but I'll do my best to be more responsive on this in the future!

alexcrichton avatar Sep 27 '20 17:09 alexcrichton

run_{configure,build}

refactor these two into run_cmake_action function

the comment on run_and_check_if_need_reconf looks like it may have been cut off?

Also I removed unfinished sentence in comment

Plus rebase.

Dushistov avatar Feb 12 '21 13:02 Dushistov

Ping @alexcrichton

Dushistov avatar Apr 24 '21 19:04 Dushistov

I rebased my branch, it is again ready to merge @alexcrichton

Dushistov avatar Aug 11 '21 19:08 Dushistov

Sorry I think I'm gonna be real with myself, I don't have time to maintain this crate any more. I've opened https://github.com/alexcrichton/cmake-rs/issues/127.

alexcrichton avatar Aug 12 '21 20:08 alexcrichton

Rebase on master. Ping @alexcrichton and @strega-nil .

Dushistov avatar Nov 11 '21 14:11 Dushistov