On Saturday 14 July 2012, Stephen Kelly wrote:
> Hi,
> 
> For Qt 5 I'm creating IMPORTED targets for all the libraries, which has
> several benefits.
> 
> I'm not sure if there are any benefits to creating IMPORTED targets for the
> executables too?

Yes, intended for crosscompiling.

add_custom_command() and add_custom_target() support using the target name of 
an executable created in the project as command (instead of using the path to 
an executable).

When crosscompiling a project, which contains code generators, you can do 
something like this:

# somewhere at the top level:
if(CMAKE_CROSSCOMPILING)
  # will find the exported executable targets exported and installed from a
  # native build of this project, which creates the imported target mycodegen
  find_package(MyProjectExecutables)
endif()

# then at the place where the code generator is built:
if(NOT CMAKE_CROSSCOMPILING)
  add_executable(mycodegen mcg.c)
endif()

...
add_custom_command(... COMMAND mycodegen arg1 arg2)


Alex
--

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

Reply via email to