build: use CMAKE_SOURCE_SUBDIR variable to cmake.mk
authorAmol Bhave <ambhave@fb.com>
Tue, 2 Oct 2018 15:48:27 +0000 (08:48 -0700)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 4 Oct 2018 20:26:22 +0000 (22:26 +0200)
Sometimes, the CMakeLists.txt file is not in the root directory of a
repo. In those cases, the CMAKE_SOURCE_SUBDIR variable can be specified
to use CMakeLists.txt from a subdirectory instead.

Signed-off-by: Amol Bhave <ambhave@fb.com>
include/cmake.mk

index 900dae1d4afc6007f8ac04179dd7f0922a07d4fa..b66665d20ae6bd21daf4f65b923bfc5d2cca8fd3 100644 (file)
@@ -7,8 +7,8 @@ ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
 endif
 
 CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
-CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)
-HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)
+CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
+HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
 MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
 
 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)