Conditional Clause of add_custom_command

后端 未结 1 978
野的像风
野的像风 2021-01-28 16:09

I want to take advantage of Ninja\'s \"job pools\" in my custom commands; something finally directly supported in cmake 3.15.0. Many/most people won\'t have this version, so I

相关标签:
1条回答
  • 2021-01-28 16:51

    According to @Tsyvarev, my approach is reasonable. In my code, which "works", I implemented something similar to this:

    set(USE_JOB_POOL 0)
    if("${CMAKE_GENERATOR}" STREQUAL "Ninja" AND
       "${CMAKE_VERSION}" STRGREATER_EQUAL "3.15.0")
        set(USE_JOB_POOL  JOB_POOL my_job_pool)
    endif()
    ...
    add_custom_command(
      OUTPUT  foo
      COMMAND  ${CMAKE_COMMAND} -E touch foo
      $<${JOB_POOL}:${JOB_POOL}>
      VERBATIM
      )
    
    0 讨论(0)
提交回复
热议问题