CMAKE_CFG_INTDIR.rst 1.7 KB

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