[CMake] Copying a cmake generated VisualStudio project file to another directory

Antje Kühn antje.kuehn at online.de
Wed May 9 11:23:04 EDT 2012


No, I need one "main" solution that bundles all the other "subprojects".

-----Ursprüngliche Nachricht-----
Von: Petr Kmoch [mailto:petr.kmoch at gmail.com] 
Gesendet: Mittwoch, 9. Mai 2012 17:19
An: Antje Kühn
Cc: cmake at cmake.org
Betreff: Re: [CMake] Copying a cmake generated VisualStudio project file to
another directory

For every "project()" command in CMakeLists, cmake generates one .sln file
(in addition to one .vcproj for each target added). Do you need any extra
solutions?

Petr

On Wed, May 9, 2012 at 5:15 PM, Antje Kühn <antje.kuehn at online.de> wrote:
> Thank you for your answer!
> Up to now I used qmake for building the Visual Studio project environment.
> For every subprojct a  *.vcxproj was built and in the end a Visual 
> Studio solution of all the vcxproj files was created.
> As I know there is no way in cmake to generate a VS "Solution", so my 
> idea was to "reuse" the "original" qmake file for building the solution.
> For this I need all my vcxproj files at a specific place.
>
> But now I have to look for another way....
>
> Antje
>
> -----Ursprüngliche Nachricht-----
> Von: Petr Kmoch [mailto:petr.kmoch at gmail.com]
> Gesendet: Mittwoch, 9. Mai 2012 16:46
> An: Antje Kühn
> Cc: cmake at cmake.org
> Betreff: Re: [CMake] Copying a cmake generated VisualStudio project 
> file to another directory
>
> 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