Apple M1: CMAKE_SOURCE_DIR is not correct when in sub directory
OS: Apple M1 CMake: 3.23.0-rc5
When printing CMAKE_SOURCE_DIR
in a sub directory, say <project_root>/src/CMakeLists.txt
,
├── build
│ ├── linux-x64-build.sh
│ └── mac-M1-build.sh
├── CMakeLists.txt
├── hello.hpp
├── linux-x64-output.png
├── mac-M1-output.png
├── README.md
└── src
├── CMakeLists.txt
└── testbed.cpp
the expected is <project_root>
, but the actual result is <project_root>/src
. The src
is not expected and should be dropped.
The full reproduce example project:https://github.com/zchrissirhcz/min-repros/tree/master/test_M1_cmake_source_dir
Edited by Zhuo Zhang