microsoft / microsoft/vscode-cmake-tools

Cmake cache variables getting deleted

Open
#1,373 7 comments 4 reactions 0 assignees View on GitHub
enhancement Feature: configure investigation needed
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

I run cmake externally and successfully set all variables, configure and build the project. I then open VSCode, and cached variables get reset, causing the cmake to fail. I then open the CMake project externally, and the cached variables has been deleted there, too.

It seems that VSCode isn't properly parsing the CMakeCache.txt. Since I've correctly configured the build repository prior to running VSCode, it should just need to run the CMake, and shouldn't need to modify any variables.

### Expected:

1. Create CMake binary folder outside of VSCode
2. Set any required variables and successfully run `make install`
3. Open VSCode and CMake configure successfully completes

### Apparent Behavior:

1. Create CMake binary folder outside of VSCode
2. Set any required variables and successfully run `make install`
3. Open VSCode and CMake configure fails because of missing variables
4. Open external CMake for second time, and variables have also been deleted there.

### CMake Tools Log

```
[proc] Executing command: /Applications/CMake.app/Contents/bin/cmake -H/Users/rich/Documents/Code/SIRF -B/Users/rich/Documents/Code/SIRF-SuperBuild/Build/builds/SIRF/build -G "Unix Makefiles"
[proc] Executing command: /Applications/CMake.app/Contents/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -H/Users/rich/Documents/Code/SIRF -B/Users/rich/Documents/Code/SIRF-SuperBuild/Build/builds/SIRF/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Python libraries found
[cmake] -- SIRF Python modules will be installed in /Users/rich/Documents/Code/SIRF-SuperBuild/Install/python
[cmake] -- Attempting to find MATLAB Mex extension (This might launch MATLAB so might take a while)
[cmake] -- Matlab libraries found
[cmake] -- SIRF Matlab libraries will be installed in /Users/rich/Documents/Code/SIRF-SuperBuild/Install/matlab
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/iUtilities/CMakeLists.txt:50 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- HDF5: Using hdf5 compiler wrapper to determine C configuration
[cmake] -- HDF5_DIR: HDF5_DIR-NOTFOUND
[cmake] -- HDF5_DEFINITIONS:
[cmake] -- HDF5_INCLUDE_DIRS: /usr/local/Cellar/hdf5/1.12.0_1/include;/usr/local/opt/szip/include
[cmake] -- HDF5_LIBRARIES: /usr/local/Cellar/hdf5/1.12.0_1/lib/libhdf5.dylib;/usr/local/opt/szip/lib/libsz.dylib;/Users/rich/Documents/Code/SIRF-SuperBuild/Install/lib/libz.a;/usr/lib/libdl.dylib;/usr/lib/libm.dylib
[cmake] -- HDF5_HL_LIBRARIES:
[cmake] -- HDF5_C_DEFINITIONS:
[cmake] -- HDF5_C_INCLUDE_DIR:
[cmake] -- HDF5_C_INCLUDE_DIRS: /usr/local/Cellar/hdf5/1.12.0_1/include;/usr/local/opt/szip/include
[cmake] -- HDF5_C_LIBRARY:
[cmake] -- HDF5_C_LIBRARIES: /usr/local/Cellar/hdf5/1.12.0_1/lib/libhdf5.dylib;/usr/local/opt/szip/lib/libsz.dylib;/Users/rich/Documents/Code/SIRF-SuperBuild/Install/lib/libz.a;/usr/lib/libdl.dylib;/usr/lib/libm.dylib
[cmake] -- HDF5_C_HL_LIBRARY:
[cmake] -- HDF5_C_HL_LIBRARIES:
[cmake] -- FFTW3 UNIX libraries: /usr/local/lib/libfftw3f.dylib
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/xGadgetron/pGadgetron/CMakeLists.txt:38 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- SPM found
[cmake] -- VTK found: 1
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/Registration/pReg/CMakeLists.txt:40 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- ITK support in STIR enabled.
[cmake] -- STIR not built with NiftyPET.
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/xSTIR/pSTIR/CMakeLists.txt:39 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- Registration, ISMRMRD and STIR (with ITK) have been built. Building synergistic code.
[cmake] -- Downloading (if not already done)...
[cmake] Path: /Users/rich/Documents/Code/SIRF/data/examples/MR/zenodo/SIRF_recon.h5
[cmake] URL: https://zenodo.org/record/3571228/files/SIRF_recon.h5?download=1
[cmake] MD5: 0d69892502d3a5cd220716a717cc2c26
[cmake] -- Downloading (if not already done)...
[cmake] Path: /Users/rich/Documents/Code/SIRF/data/examples/MR/zenodo/dicom_as_nifti.nii
[cmake] URL: https://zenodo.org/record/3571228/files/dicom_as_nifti.nii?download=1
[cmake] MD5: c5f5b519e5c032560ead912713479b53
[cmake] -- Registration, ISMRMRD and STIR (with ITK) have been built.
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/common/CMakeLists.txt:59 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- python alias:pGadgetron<-sirf.Gadgetron
[cmake] -- python alias:pSTIR<-sirf.STIR
[cmake] -- python alias:pUtilities<-sirf.Utilities
[cmake] -- python alias:pygadgetron<-sirf.pygadgetron
[cmake] -- python alias:pystir<-sirf.pystir
[cmake] -- python alias:pyiutilities<-sirf.pyiutilities
[cmake] -- python alias:pReg<-sirf.Reg
[cmake] -- python alias:pyreg<-sirf.pyreg
[cmake] -- setup.py:/Users/rich/Documents/Code/SIRF-SuperBuild/Install/python/setup.py
[cmake] -- Configuring done
[cmake] You have changed variables that require your cache to be deleted.
[cmake] Configure will be re-run and you may have to reset some variables.
[cmake] The following variables have changed:
[cmake] CMAKE_C_COMPILER= /usr/bin/clang
[cmake] CMAKE_CXX_COMPILER= /usr/bin/clang++
[cmake]
[cmake] -- The C compiler identification is AppleClang 11.0.3.11030032
[cmake] -- The CXX compiler identification is AppleClang 11.0.3.11030032
[cmake] -- Check for working C compiler: /usr/bin/clang
[cmake] -- Check for working C compiler: /usr/bin/clang - works
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Check for working CXX compiler: /usr/bin/clang++
[cmake] -- Check for working CXX compiler: /usr/bin/clang++ - works
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Found Boost: /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version "1.72.0", minimum required is "1.36.0") found components: system filesystem thread date_time chrono
[cmake] -- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.16")
[cmake] -- Python libraries found
[cmake] -- SIRF Python modules will be installed in /usr/local/python
[cmake] -- Attempting to find MATLAB Mex extension (This might launch MATLAB so might take a while)
[cmake] -- Matlab libraries found
[cmake] -- SIRF Matlab libraries will be installed in /usr/local/matlab
[cmake] -- Found SWIG: /usr/local/bin/swig (found version "4.0.2")
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/iUtilities/CMakeLists.txt:50 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- HDF5: Using hdf5 compiler wrapper to determine C configuration
[cmake] -- Found HDF5: /usr/local/Cellar/hdf5/1.12.0_1/lib/libhdf5.dylib;/usr/local/opt/szip/lib/libsz.dylib;/usr/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib (found version "1.12.0") found components: C
[cmake] -- FFTW3 UNIX libraries: /usr/local/lib/libfftw3f.dylib
[cmake] -- Found FFTW3: /usr/local/lib/libfftw3f.dylib
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/xGadgetron/pGadgetron/CMakeLists.txt:38 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- SPM not found
[cmake] -- VTK found: 1
[cmake] CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:460 (message):
[cmake] Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
[cmake] flag. Run "cmake --help-policy CMP0086" for policy details. Use the
[cmake] cmake_policy command to set the policy and suppress this warning.
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.17/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
[cmake] src/Registration/pReg/CMakeLists.txt:40 (SWIG_ADD_LIBRARY)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] CMake Error at src/CMakeLists.txt:84 (find_package):
[cmake] By not providing "FindSTIR.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "STIR", but
[cmake] CMake did not find one.
[cmake]
[cmake] Could not find a package configuration file provided by "STIR" with any of
[cmake] the following names:
[cmake]
[cmake] STIRConfig.cmake
[cmake] stir-config.cmake
[cmake]
[cmake] Add the installation prefix of "STIR" to CMAKE_PREFIX_PATH or set
[cmake] "STIR_DIR" to a directory containing one of the above files. If "STIR"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/Users/rich/Documents/Code/SIRF-SuperBuild/Build/builds/SIRF/build/CMakeFiles/CMakeOutput.log".
```

### Developer Tools Log

```

```

### Platform and Versions

- **Operating System**: macOS
- **CMake Version**: 3.17.2
- **VSCode Version**: 1.47.2
- **CMake Tools Extension Version**: 1.4.1
- **Compiler/Toolchain**: clang++ (Apple clang version 11.0.3 (clang-1103.0.32.62))

# Screenshots
## Project configured externally. `STIR_DIR` correctly set
![image](https://user-images.githubusercontent.com/33289025/87786286-965f4480-c831-11ea-8767-111051d93c1b.png)

## Open VSCode, `STIR_DIR` not found
![image](https://user-images.githubusercontent.com/33289025/87786514-efc77380-c831-11ea-9c94-075f1ecfeb62.png)

## Re-open CMake externally, `STIR_DIR` has been reset
![image](https://user-images.githubusercontent.com/33289025/87786554-0372da00-c832-11ea-96a1-5aae087f246b.png)

Contributor guide

Open the contributing guide

Research direction

Reproduce the three steps using the external CMake binary, the VS Code project, and the reported build directory. Start with CMakeCache.txt and the CMake Tools log around the configure commands; done means opening VS Code no longer removes required cached variables or causes the subsequent external CMake run to fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.