[CMake] How to find/run external host executables when using cross compiling

Williams, Norman K norman-k-williams at uiowa.edu
Tue Dec 10 12:00:29 EST 2013


This is a case for using the ExternalProject module!


You have a top level 'SuperBuild' whose job it is to find all the
prerequisites for the actual project build.  Then it configures and builds
it.

This means that the tricky configuration is handled by CMake, instead of
working it out yourself by hand.

The Superbuild can be part of the project's source tree. The simplest
method is to make a SuperBuild subdirectory, and put in a CMakeLists.txt
something like this:

project(MySuperBuild)
include(ExternalProject)
# find all the prerequisite tools
ExternalProject_Add(MyActualProject
  DOWNLOAD_COMMAND ""
  BINARY_DIR MyActualProject-build
  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..     # SuperBuild is subdir of
source directory
  CMAKE_ARGS                                    # all the arguments to
configure your project.
    -DPERL_EXECUTABLE:STRING=${PERL_EXECUTABLE} # for example
  INSTALL_COMMAND ""                            # deployment not handled
by install
)

On 12/9/13 6:57 PM, "Eric Wing" <ewmailing at gmail.com> wrote:

>On 12/4/13, Eric Wing <ewmailing at gmail.com> wrote:
>> I'm currently trying to port a rather large, complex project to
>> Android. It has an existing CMake project so I'm trying to leverage
>> that. I've taken and enhanced one of the Android-CMake toolchains I've
>> found.
>>
>> This particular project I'm porting has unfortunate dependencies on
>> running the host system's Perl, Python, and Ruby interpreters to do
>> various kinds of on-the-fly code generation.
>>
>> The problem I'm having is that with the cross-compilation toolchain,
>> none of these (host) dependencies are found with CMake (I think it
>> uses FindPackage) because the cross-compilation toolchain has
>> sandboxed off everything to look in the target toolchain which won't
>> have Perl/Python/Ruby (which is completely reasonable; I'm not
>> complaining).
>>
>> But I need to solve this problem and figure out how to find/invoke the
>> host Perl/Python/Ruby/etc so my cross-compile can work.
>>
>> Can anybody give me suggestions on how I should approach this?
>
>Bump.
>I have a temporary workaround in place where I comment out the
>find_package calls for Perl/Python/Ruby, and then use -D switches with
>CMake to pre-populate the correct values for my host system.
>
>Thanks,
>Eric
>--
>Beginning iPhone Games Development
>http://playcontrol.net/iphonegamebook/
>--
>
>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://www.cmake.org/mailman/listinfo/cmake



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the CMake mailing list