[CMake] multiple executables

Pečiva Jan peciva at fit.vutbr.cz
Sun Jun 1 10:29:14 EDT 2008


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



More information about the CMake mailing list