[CMake] multiple executables

David Cole david.cole at kitware.com
Mon Jun 2 11:41:26 EDT 2008


Your initial attempt looks reasonable... Did you try it without the
"VERBATIM" argument to the ADD_CUSTOM_COMMAND?

This sort of copy command should work if invoked from Visual Studio, even
with the $(OutDir) reference...


HTH,
David


On Sun, Jun 1, 2008 at 10:29 AM, Pečiva Jan <peciva at fit.vutbr.cz> wrote:

> Dears cmakers,
>
> I am about to finish my "dual gui/console" behaviour for InventorTools
> utilities. Compilation of whole set of executables is perfectly handled by
> cmake, but final "installation" procedure does not work.
>
> Can cmake handle this situation?:
>
> 1. cmake builds all the executables of the projects
>   "Dual" behaviour requires .com suffix, so all *.com are placed in
>   the build directories. On MSVC, it is usually at
>   build/(project_name)/(debug|release)/*.com
>   This works perfectly.
>
> 2. The last project makes one .exe for "dual" behaviour. It is called
>   autoconsole.exe. Before using cmake, I copied autoconsole.exe to all
> other
>   build directories to reside together with their .com and renamed them to
>   the same name as .com except with .exe suffix. This worked perfectly
> using
>   post-build script, but how to make it with cmake?
>
> I unsuccessfully tried two options:
>
> - to make post-build step by
>
> add_custom_command (TARGET autoconsole
>     POST_BUILD
>     COMMAND ${CMAKE_COMMAND} -E copy
>     ${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/autoconsole.exe
>     ${ivview_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ivview.exe
>     COMMENT "Copying executables..." VERBATIM)
>
> This does not work because ${CMAKE_CFG_INITDIR} is set to $(IntDir) on
> Visual Studio. So, the copy command fails because it expect regular path.
> (And $(IntDir) differs among different debug/release configurations).
>
> - to make it part of install process by
>
> install (TARGETS autoconsole
>         RUNTIME
>         DESTINATION bin
>         RENAME ivview.exe)
>
> It copies the file, but RENAME does not work (It probably works only for
> PROGRAMS and FILES signatures). I was planning to use this command about ten
> times to get all the required .exe.
>
>
> Please, is there any way how to proceed, to get all of about ten .exe
> executables to their places, either with their .com counterparts
> (preferred), or to final install destination?
>
> Thanks,
> John
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080602/e94526e8/attachment.htm>


More information about the CMake mailing list