Run cmakels' configure in user's build directory #32
Description
Currently we copy CMakeCache.txt to a new directory (.cmakels) and run a fresh configure there to get information from CMake. This is to avoid messing up the user's build directory (we don't want to change the state of his build directory).
Disadvantage:
- The build directory has a different location and therefore variables like
CMAKE_CURRENT_BINARY_DIRwill point to the wrong location. - The first cmakels configure might be heavy (e.g. if some external dependency needs to be fetched from the internet).
Possible Solution:
- Investigate if we can run
configure()without writing any files to disk. - Possible obstacles:
configure_file()which changes on each run (e.g. with a timestamp);FetchContentwhich might update a dependency.
Even if we don't manage to leave the user's build directory untouched, this might still the way to go. Rationale: If no CMake files are touched, cmakels only needs to run the configure() on startup. The vscode-cmake-tools extensions also runs configure() on startup. It is very unlikely that cmakels will mess up. If the user is touching CMake files, he is obviously working actively on CMake and therefore anyways wants to run configure() at some point to test the development.
Caveat: We can easily run in a race condition where the user (or some other plugin) runs configure at the same time as cmakels.
Comments are welcome.
Activity