Changing CMake files standard location

前端 未结 1 1598
别跟我提以往
别跟我提以往 2020-12-08 03:07

I have a source directory with a folder called \"phantom-dir/\" where I put all generated files I don\'t need. I want to put all generated files by CMake inside this phantom

相关标签:
1条回答
  • 2020-12-08 03:28

    You could make use of the undocumented CMake options -H and -B to avoid leaving your source dir. -H specifies the path to the main CMakeLists.txt file, and -B specifies the path to your desired build directory.

    cmake -H. -Bphantom-dir
    

    Note that these are undocumented and so I suppose could change at any time the Kitware guys feel like.

    To build your project without leaving your source dir, you can make use of the (official) option --build This is a cross-platform way to invoke your chosen build tool, and you can pass whatever flags you want to this tool. e.g.

    cmake --build phantom-dir -- -j3
    
    0 讨论(0)
提交回复
热议问题