CMake output/build directory

前端 未结 5 480
北恋
北恋 2020-11-28 03:05

I\'m pretty new to CMake, and read a few tutorials on how to use it, and wrote some complicated 50 lines of CMake script in order to make a program for 3 different compilers

5条回答
  •  失恋的感觉
    2020-11-28 03:42

    Turning my comment into an answer:

    In case anyone did what I did, which was start by putting all the build files in the source directory:

    cd src
    cmake .
    

    cmake will put a bunch of build files and cache files (CMakeCache.txt, CMakeFiles, cmake_install.cmake, etc) in the src dir.

    To change to an out of source build, I had to remove all of those files. Then I could do what @Angew recommended in his answer:

    mkdir -p src/build
    cd src/build
    cmake ..
    

提交回复
热议问题