Why not leave the build directory alone & let the cmake 1.1 PG handle it? Most CMake-based ports can handle out-of-source building these days, and that's the default for the cmake 1.1 PG, and the default setting here should work for the vast majority of cmake-based ports.
To your query: You shouldn't try to write to or generate files outside the ${worksrcdir} (or ${worksrcpath}); all configuring, building, installing, patching, etc must be done within the port's build path. Hope this is useful! - MLD On Thu, May 2, 2019, at 12:40 PM, Ao Liu wrote: > Hi all macports fans, > > I'm recently learning to do some small modifications and enhancements on an > existing portfile. One way I found that would solve my problem was to modify > the build dir of cmake. (The PortGroup == cmake 1.1). > > I tried to set cmake.build_dir to ${prefix}/share/abc/abc${abc.version}/ > > But it always throws an error and I believe it was because cmake can not > write to the above directory. I tried to chown the directory to macports, > still doesn't work. > > Any guidance on how to customize the CMake build directory? Thanks folks! > > :info:configure CMake Error at > /opt/local/share/cmake-3.14/Modules/CMakeDetermineSystem.cmake:173 (file): > :info:configure file failed to open for writing (No such file or directory): > :info:configure /opt/local/share/abc/abc4.10.5/CMakeFiles/CMakeOutput.log > ... > ... > ...(similar CMake errors)