CMAKE_CFG_INTDIR.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. CMAKE_CFG_INTDIR
  2. ----------------
  3. .. deprecated:: 3.21
  4. This variable has poor support on :generator:`Ninja Multi-Config`, and
  5. predates the existence of the :genex:`$<CONFIG>` generator expression. Use
  6. ``$<CONFIG>`` instead.
  7. Build-time reference to per-configuration output subdirectory.
  8. For native build systems supporting multiple configurations in the
  9. build tree (such as :ref:`Visual Studio Generators` and :generator:`Xcode`),
  10. the value is a reference to a build-time variable specifying the name
  11. of the per-configuration output subdirectory. On :ref:`Makefile Generators`
  12. this evaluates to `.` because there is only one configuration in a build tree.
  13. Example values:
  14. ::
  15. $(Configuration) = Visual Studio 12 and above
  16. $(CONFIGURATION) = Xcode
  17. . = Make-based tools
  18. . = Ninja
  19. ${CONFIGURATION} = Ninja Multi-Config
  20. Since these values are evaluated by the native build system, this
  21. variable is suitable only for use in command lines that will be
  22. evaluated at build time. Example of intended usage:
  23. ::
  24. add_executable(mytool mytool.c)
  25. add_custom_command(
  26. OUTPUT out.txt
  27. COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
  28. ${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
  29. DEPENDS mytool in.txt
  30. )
  31. add_custom_target(drive ALL DEPENDS out.txt)
  32. Note that ``CMAKE_CFG_INTDIR`` is no longer necessary for this purpose but
  33. has been left for compatibility with existing projects. Instead
  34. :command:`add_custom_command` recognizes executable target names in its
  35. ``COMMAND`` option, so
  36. ``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool`` can be replaced
  37. by just ``mytool``.
  38. This variable is read-only. Setting it is undefined behavior. In
  39. multi-configuration build systems the value of this variable is passed
  40. as the value of preprocessor symbol ``CMAKE_INTDIR`` to the compilation
  41. of all source files.