[CMake] FindwxWidgets and Cross-compiling

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Sat Jan 5 17:47:30 EST 2008


Hello Everyone,

I have been assigned a bug (http://www.cmake.org/Bug/view.php?id=6187)
to fix the FindwxWidgets for cross-compiling, but since I don't
cross-compile I'm not sure what is the correct approach.

Rodolfo submitted a patch that adds the following code around the
FIND_PROGRAM call:

    # if cross-compiling, save the current
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM and change it to ONLY
    IF(CMAKE_FIND_ROOT_PATH)
        SET(_old_path_mode ${CMAKE_FIND_ROOT_PATH_MODE_PROGRAM})
        SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
    ENDIF(CMAKE_FIND_ROOT_PATH)

    FIND_PROGRAM(wxWidgets_CONFIG_EXECUTABLE wx-config)

    # restore the previous CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
    if(_old_path_mode)
        SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ${_old_path_mode})
    endif(_old_path_mode)

I believe the idea is to ensure that the wx-config used is the one
from the target platform. I would like to enlist the help of those
more experienced cross-compiling to affirm that this is the right
course of action. I am concerned that maybe the
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM should be set before the
FIND_PACKAGE call. Would people be setting this differently for
different programs, so that I need to ensure that only the
cross-compiling directories are searched for to find wx-config? Or can
I count on the user to have set this mode correctly for his platform?

Thanks,
--Miguel

PS - Thanks to Rodolfo for raising this issue.


More information about the CMake mailing list