[CMake] Confusion with $<CONFIGURATION>

Petr Kmoch petr.kmoch at gmail.com
Wed Nov 7 07:02:53 EST 2012


Sorry, I got lost in the course of the discussion. I was referring to
$<CONFIGURATION>. Thanks for the correction.

Petr

On Wed, Nov 7, 2012 at 12:52 PM, David Cole <david.cole at kitware.com> wrote:

> Peter K: ${CMAKE_CFG_INTDIR} is NOT a generator expression, and it
> does work in the output clause of add_custom_command.
>
> Robert:
> Yes, you can use ${CMAKE_CFG_INTDIR} in the OUTPUT clause.
>
> The following CMakeLists works for me with the Xcode generator this
> morning (assuming you also have an "in.txt" file). I'm confident it
> works with Visual Studio generators as well:
>
>   cmake_minimum_required(VERSION 2.8)
>   project(test_acc)
>
>   set(in "${CMAKE_CURRENT_SOURCE_DIR}/in.txt")
>   set(out "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/out.txt")
>
>   add_custom_command(
>     OUTPUT ${out}
>     COMMAND ${CMAKE_COMMAND} -E copy ${in} ${out}
>     DEPENDS ${in}
>     )
>
>   add_custom_target(copyInput ALL
>     DEPENDS ${out}
>     )
>
>
> On Wed, Nov 7, 2012 at 2:53 AM, Petr Kmoch <petr.kmoch at gmail.com> wrote:
> > Yes, there is a limitation. You can't use them in OUTPUT. See
> > http://public.kitware.com/Bug/view.php?id=12877
> >
> > Petr
> >
> >
> > On Wed, Nov 7, 2012 at 12:26 AM, Robert Dailey <rcdailey.lists at gmail.com
> >
> > wrote:
> >>
> >> I was specifying that in my path for one of the OUTPUT files in
> >> add_custom_command(). Is there any limitation on where/how it can be
> >> used in a custom command?
> >>
> >> On Tue, Nov 6, 2012 at 2:41 PM, David Cole <david.cole at kitware.com>
> wrote:
> >> > The multi-configuration generators do understand CMAKE_CFG_INTDIR.
> >> >
> >> > CMake generates code to call your custom command, including $(OutDir)
> >> > wherever you reference ${CMAKE_CFG_INTDIR}, and then Visual Studio
> >> > sets that before invoking your command so that it gets resolved to the
> >> > correct configuration-specific string.
> >> >
> >> > Are you seeing your command called with the literal $(OutDir) from
> >> > Visual Studio? It should already be substituted for you by the time
> >> > you see it in your command's argument parsing.
> >> >
> >> >
> >> >
> >> > On Tue, Nov 6, 2012 at 3:31 PM, Robert Dailey <
> rcdailey.lists at gmail.com>
> >> > wrote:
> >> >> On second thought, CMAKE_CFG_INTDIR won't work for
> multi-configuration
> >> >> generators. It is using $(OutDir) for Visual Studio 2008 generator,
> >> >> which my custom command can't understand. I'd like to use
> >> >> $<CONFIGURATION> but then it won't work for single-configuration
> >> >> generators (like NMake) where I want it to be "." only.
> >> >>
> >> >> Any ideas?
> >> >>
> >> >> On Mon, Nov 5, 2012 at 5:45 PM, Robert Dailey
> >> >> <rcdailey.lists at gmail.com> wrote:
> >> >>> Sorry I got confused, what I needed to use is CMAKE_CFG_INTDIR.
> >> >>>
> >> >>> On Mon, Nov 5, 2012 at 5:17 PM, Robert Dailey
> >> >>> <rcdailey.lists at gmail.com> wrote:
> >> >>>> I'm using a custom target to copy files to the following directory:
> >> >>>>
> >> >>>> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIGURATION>
> >> >>>>
> >> >>>> This works on Visual Studio generators, because binaries that are
> >> >>>> compiled are placed in the directory above.
> >> >>>>
> >> >>>> However, if I generate for NMake on Windows, binaries are placed in
> >> >>>> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} instead, but $<CONFIGURATION> for
> >> >>>> the NMake makefiles generator says "Debug" instead of just "." so
> my
> >> >>>> files do not copy to the correct location.
> >> >>>>
> >> >>>> Can anyone explain this? Am I doing something wrong? How can I make
> >> >>>> my
> >> >>>> files copy to the appropriate binary output directory on both
> >> >>>> generators?
> >> >> --
> >> >>
> >> >> Powered by www.kitware.com
> >> >>
> >> >> Visit other Kitware open-source projects at
> >> >> http://www.kitware.com/opensource/opensource.html
> >> >>
> >> >> Please keep messages on-topic and check the CMake FAQ at:
> >> >> http://www.cmake.org/Wiki/CMake_FAQ
> >> >>
> >> >> Follow this link to subscribe/unsubscribe:
> >> >> http://www.cmake.org/mailman/listinfo/cmake
> >> --
> >>
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Please keep messages on-topic and check the CMake FAQ at:
> >> http://www.cmake.org/Wiki/CMake_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.cmake.org/mailman/listinfo/cmake
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121107/4f1a723a/attachment-0001.htm>


More information about the CMake mailing list