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