[CMake] Copying a cmake generated VisualStudio project file to another directory
Petr Kmoch
petr.kmoch at gmail.com
Wed May 9 10:45:50 EDT 2012
Hi.
Custom commands are executed at build time (that is, when you do a
build in Visual Studio), not at generation time (when cmake is
running). There is no way to hook something to the end of the
generation process itself (see
http://public.kitware.com/Bug/view.php?id=13020 ).
BTW, it's generally a "Bad Idea (TM)" to move the generated tree
around - it's full of absolute paths. Why do you need to move it in
the first place?
Petr
On Wed, May 9, 2012 at 4:12 PM, Antje Kühn <antje.kuehn at online.de> wrote:
> Hi,
>
>
>
> I'm using CMake 2.8.7 to generate VC++ 2010 project files on Windows 7.
>
>
>
> At my CMakeLists.txt files I defined the following:
>
>
>
> add_executable(VSData ${SRC} ${INC})
>
> Target_link_libraries(VSData ${SOME_LIBS})
>
>
>
> Now I start cmake from my build directory with:
>
>>cmake -G "Visual Studio 10" ..
>
>
>
> This works and I get the *.vcxproj files in build/VSData.
>
> Now I want to copy the generated project files to another place at my file
> system.
>
> For this I added the following command at the end to my CMakeLists.txt:
>
>
>
> add_custom_command(TARGET VSData
>
> POST_BUILD
>
> COMMAND ${CMAKE_COMMAND}
>
> ARGS -E copy ${CMAKE_BINARY_DIR}/VSData/VSData.vcxproj ${destDir}
> VERBATIM)
>
>
>
> I also tried this:
>
>
>
> add_custom_command(TARGET VSData.vcxproj
>
> POST_BUILD
>
> COMMAND ${CMAKE_COMMAND}
>
> ARGS -E copy $<TARGET_FILE: VSData.vcxproj> ${destDir} VERBATIM)
>
>
>
> But nothing happens! No error message, no warnings and the file will not be
> copied!
>
>
>
>
>
>
>
>
>
>
>
>
> --
>
> 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
More information about the CMake
mailing list