Thanks for format editing. It looks much better.
-
I used
get_filename_component( root “${CMAKE_CURRENT_LIST_DIR}” REALPATH ) to get root path with symlink resolved. All the following paths were derided based the root path to avoid confusion. However, as seen in the log, it still show symlink path in some place. Don’t know how to configure that to make all to use the real path. -
I removed the IF NOT EXISTS part, but make no difference. The point here the code runs well in some scenarios but failed in the scenario using symlink path.
a. Run in real path, it worked no issue
cd \REALPATH
cmake -G Xcode … && cmake --build ./ --config Debug
b. Run in symlink path, it failed
cd \SYMLINKPATH
cmake -G Xcode … && cmake --build ./ --config Debug
error: Build input file cannot be found: ‘/REALPATH/gen/gen_xxx.cpp’
c. Run in symlink path twice, it works.
cd \SYMLINKPATH
cmake -G Xcode … && cmake --build ./ --config Debug
error: Build input file cannot be found: ‘/REALPATH/gen/gen_xxx.cpp’
cmake --build ./ --config Debug
Build succeed.d. Either in real or symlink path, use -T buildsystem=1, works no issue.
cmake -G Xcode -T buildsystem=1 … && cmake --build ./ --config Debug
From the above observation, it looks the code generated after compiling when using symlink path even though I saw code generation scripts bin/sh -c /SYMBLINKPATH/out/xxx.build/Debug/xxx2.build/s=Script-xxxxxxxx.sh is called before CompileC. Note that parallel build is enabled by default.