On 03/04/2015 08:15 PM, Matt McCormick wrote: > On Wed, Mar 4, 2015 at 12:00 PM, Brad King wrote: >> I do not think a global setting like this makes sense. We cannot >> unconditionally add the cross-compiling target launcher in front of >> all tests. Some tests may be running host tools. See below. > > This set of patches does not globally and unconditionally add a > launcher in front of all tests. It uses build system knowledge to add > the emulator commands in front of target executables only.
Good, but it may take more work. I see the key logic here: > cmTarget* target = mf->FindTargetToUse(exe); > if(target && target->GetType() == cmTarget::EXECUTABLE) > { > // Use the target file on disk. > exe = target->GetFullPath(config); > + > + // Prepend with the emulator when cross compiling if required. This if() condition is not sufficient to know that the executable is for the target architecture. The cmTarget could be IMPORTED, in which case we don't know whether it references a host tool or one built for the target architecture. Some kind of target property may be needed to say "use the emulator to run me" more explicitly. Once we have such a property, then it might as well refer to the tool to be used, e.g. add_executable(myexe ...) set_property(TARGET myexe PROPERTY CROSSCOMPILING_EMULATOR ${emulator}) > The point about the overloaded meaning of "targets" is a good one. I > think the best name is then CMAKE_CROSSCOMPILING_EMULATOR. Sounds good. This variable could be used to initialize the above property on target creation (see SetPropertyDefault calls). In try_run we simply need to pass the value into the inner project and its executable will pick it up too. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers