west: build: use CMAKE_HOME_DIRECTORY to locate source
Rather than relying on APPLICATION_SOURCE_DIR to be in the cache, just
use CMAKE_HOME_DIRECTORY instead.
https://cmake.org/cmake/help/latest/variable/CMAKE_HOME_DIRECTORY.html
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py
index ecdca21..7a74658 100644
--- a/scripts/west_commands/build.py
+++ b/scripts/west_commands/build.py
@@ -250,13 +250,13 @@
if self.args.source_dir:
source_dir = self.args.source_dir
elif self.cmake_cache:
- source_dir = self.cmake_cache.get('APPLICATION_SOURCE_DIR')
+ source_dir = self.cmake_cache.get('CMAKE_HOME_DIRECTORY')
if not source_dir:
- # Maybe Zephyr changed the key? Give the user a way
- # to retry, at least.
- log.die("can't determine application from build directory "
- "{}, please specify an application to build".
- format(self.build_dir))
+ # This really ought to be there. The build directory
+ # must be corrupted somehow. Let's see what we can do.
+ log.die('build directory', self.build_dir,
+ 'CMake cache has no CMAKE_HOME_DIRECTORY;',
+ 'please give a source_dir')
else:
source_dir = os.getcwd()
self.source_dir = os.path.abspath(source_dir)