InterviewSolution
| 1. |
I Run An Out-of-source Build But Cmake Generates In-source Anyway. Why? |
|
Answer» This means that there is a CMakeCache.txt file in the source tree,possibly as part of an existing in-source BUILD. If CMake is given the path to a directory with a CMakeCache.txt file, it assumes the directory is a build tree. THEREFORE if one runs "cmake ../mysrc" to build out-of-source but there is a mysrc/CMakeCache.txt file then cmake will treat mysrc as the build tree. This is a side-effect of the FEATURE that allows "cmake ." to be used to regenerate a build tree. The behavior will not be changed because mixing in-source and out-of-source builds is not SAFE anyway (configured headers MAY be found in the wrong place). This means that there is a CMakeCache.txt file in the source tree,possibly as part of an existing in-source build. If CMake is given the path to a directory with a CMakeCache.txt file, it assumes the directory is a build tree. Therefore if one runs "cmake ../mysrc" to build out-of-source but there is a mysrc/CMakeCache.txt file then cmake will treat mysrc as the build tree. This is a side-effect of the feature that allows "cmake ." to be used to regenerate a build tree. The behavior will not be changed because mixing in-source and out-of-source builds is not safe anyway (configured headers may be found in the wrong place). |
|