在我的Makefile中,我想在子模块中调用CMake。如果我在-Dxxxx之前添加“空格”,则它将无法运行CMake。
当我省略空格时,它会成功运行。谁知道是什么原因引起的?
ifeq ($(A),A)
CMAKE_DEFINITIONS = "-DA=A"
else
CMAKE_DEFINITIONS = "-DA=a"
endif
ifeq ($(B),B)
CMAKE_DEFINITIONS += " -DB=B"
else
CMAKE_DEFINITIONS += " -DB=b"
endif
.........
cmake:
@mkdir -p build && \
cd build && \
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain_file.cmake $(CMAKE_DEFINITIONS)
失败,错误信息如下:
The source directory "/repo/xxx/AppSrc/build/ -DB=B" does not exist.
但是,当我省略“ -DB”之前的空格时,它将成功运行。 成功的代码:
ifeq ($(A),A)
CMAKE_DEFINITIONS = "-DA=A"
else
CMAKE_DEFINITIONS = "-DA=a"
endif
ifeq ($(B),B)
CMAKE_DEFINITIONS += "-DB=B"
else
CMAKE_DEFINITIONS += "-DB=b"
endif