CMAKE_CFG_INTDIR.rst 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. $(ConfigurationName) = Visual Studio 9
  16. $(Configuration) = Visual Studio 11 and above
  17. $(CONFIGURATION) = Xcode
  18. . = Make-based tools
  19. . = Ninja
  20. ${CONFIGURATION} = Ninja Multi-Config
  21. Since these values are evaluated by the native build system, this
  22. variable is suitable only for use in command lines that will be
  23. evaluated at build time. Example of intended usage:
  24. ::
  25. add_executable(mytool mytool.c)
  26. add_custom_command(
  27. OUTPUT out.txt
  28. COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
  29. ${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
  30. DEPENDS mytool in.txt
  31. )
  32. add_custom_target(drive ALL DEPENDS out.txt)
  33. Note that ``CMAKE_CFG_INTDIR`` is no longer necessary for this purpose but
  34. has been left for compatibility with existing projects. Instead
  35. :command:`add_custom_command` recognizes executable target names in its
  36. ``COMMAND`` option, so
  37. ``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool`` can be replaced
  38. by just ``mytool``.
  39. This variable is read-only. Setting it is undefined behavior. In
  40. multi-configuration build systems the value of this variable is passed
  41. as the value of preprocessor symbol ``CMAKE_INTDIR`` to the compilation
  42. of all source files.