Configuring and building with CMake uses absolute path names. This leads to two problems:
First, moving or renaming the build directory breaks the build:
$ cd cmake_build $ cmake ... ... $ ninja ... $ cd .. $ mv cmake_build old_build $ touch src/block/block_addr.c $ cd old_build $ ninja ... FAILED: CMakeFiles/wt_objs.dir/src/block/block_addr.c.o ccache /opt/mongodbtoolchain/v4/bin/clang -I/opt/mongodbtoolchain/revisions/97dc5840fc91c99e296fb3406abb8707f4c2ccc3/stow/python3-v4.egB/include/python3.9 -I/home/ubuntu/src/wiredtiger/build/include -I/home/ubuntu/src/wiredtiger/build/config -I/home/ubuntu/src/wiredtiger/src/include -D_GNU_SOURCE -DHAVE_X86INTRIN_H -fPIC -Og -g3 -ggdb3 -gdwarf-4 -fdebug-macro -Werror -Wno-cast-align -Wno-documentation-unknown-command -Wno-format-nonliteral -Wno-packed -Wno-padded -Wno-reserved-id-macro -Wno-zero-length-array -Wno-cast-qual -Wno-thread-safety-analysis -Wno-disabled-macro-expansion -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-implicit-fallthrough -Wno-implicit-int-float-conversion -Weverything -MD -MT CMakeFiles/wt_objs.dir/src/block/block_addr.c.o -MF CMakeFiles/wt_objs.dir/src/block/block_addr.c.o.d -o CMakeFiles/wt_objs.dir/src/block/block_addr.c.o -c /home/ubuntu/src/wiredtiger/src/block/block_addr.c In file included from /home/ubuntu/src/wiredtiger/src/block/block_addr.c:9: /home/ubuntu/src/wiredtiger/src/include/wt_internal.h:19:10: fatal error: 'wiredtiger_config.h' file not found #include "wiredtiger_config.h" ^~~~~~~~~~~~~~~~~~~~~ 1 error generated.
A more severe problem can occur if you move/rename your tree, and checkout a new tree using the original directory name. At this point if you build in the old tree, the build will silently use files in the new tree. This can cause an engineer to waste a lot of time chasing weird errors.
$ mv ~/src/wiredtiger ~/src/wiredtiger.copy $ git checkout ... ~/src/wiredtiger $ cd ~/src/wiredtiger <edit files, build, etc.> $ cd ~/src/wiredtiger.copy/cmake_build $ ninja CHAOS AND CONFUSION REIGN
Ideally, we should change the build to use relative paths for files in the WiredTiger tree.
If this is not possible, or is too difficult, we should change the build to explicitly fail if it isn't in the same directory as when cmake was run.