CMake build multiple targets in different build directories

前端 未结 1 1165
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 16:59

I have the following CMake structure:

CMakelists.txt
toolchain.cmake
folder1
   ----CMakelists.txt
folder2
   ----CMakelists.txt
etc..

My f

相关标签:
1条回答
  • 2020-12-11 17:58

    No. The recommendation would be to just put your manual steps into a shell script.

    CMake can only handle one compiler/make environment at a time (if you switch the compiler you need a different binary output directory).

    Especially a toolchain file that does contain SET(CMAKE_SYSTEM_NAME ...) does change the whole outcome of the configuration/generation process.

    For details on what CMake does see: CMake: In which Order are Files parsed (Cache, Toolchain, …)?

    And you could make use of some CMake command line options in your shell script:

    if [ ! -d hostBuild ]; then
        cmake -E make_directory hostBuild
        cmake -E chdir hostBuild cmake ..
    fi
    cmake --build hostBuild
    ...
    
    0 讨论(0)
提交回复
热议问题