MantisBT - CMake | ||||||||||
View Issue Details | ||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||
0014359 | CMake | Modules | public | 2013-08-14 18:49 | 2014-06-02 08:37 | |||||
Reporter | Michel Zou | |||||||||
Assigned To | jschueller | |||||||||
Priority | normal | Severity | minor | Reproducibility | always | |||||
Status | closed | Resolution | duplicate | |||||||
Platform | OS | OS Version | ||||||||
Product Version | CMake 2.8.11.2 | |||||||||
Target Version | Fixed in Version | |||||||||
Summary | 0014359: [FindSWIG] SWIG detection fails when cross-compiling | |||||||||
Description | The detection of swig fails when cross-compiling, here's why: When cross-compiling, we do not want find_path to find files in the host tree, so we set the root path to the target libs and includes: set ( CMAKE_FIND_ROOT_PATH /usr/i386-mingw32 ) set ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) but we never want cmake to find utils (like swig, awk, bc, etc...) in the target tree but in the host prefix: set ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) Swig uses 'swig -swiglib' to determine the location of it's internal library: execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib OUTPUT_VARIABLE SWIG_swiglib_output) Then it uses find-path to check the library macros presence: find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) But with CMAKE_FIND_ROOT_PATH_MODE_INCLUDE set to ONLY, the path cannot be found in the host paths, and the required SWIG_DIR is not found ; the detection fails: -- Could NOT find SWIG (missing: SWIG_DIR) | |||||||||
Steps To Reproduce | Try to find swig while crosscompiling: - in CMakeLists: find_package(SWIG) - in ToolChain-i386-mingw32: set ( CMAKE_SYSTEM_NAME Windows ) set ( CMAKE_C_COMPILER i386-mingw32-gcc ) set ( CMAKE_FIND_ROOT_PATH /usr/i386-mingw32 ) set ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) set ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) set ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) | |||||||||
Additional Information | We could also search in the host paths by passing CMAKE_FIND_ROOT_PATH_BOTH to find_file: find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} CMAKE_FIND_ROOT_PATH_BOTH) See the embedded path, tested with and without cross-compilation. Regards, M. | |||||||||
Tags | No tags attached. | |||||||||
Relationships |
| |||||||||
Attached Files | cmake-swig-cross-compilation.patch (683) 2013-08-14 18:49 https://public.kitware.com/Bug/file/4852/cmake-swig-cross-compilation.patch | |||||||||
Issue History | ||||||||||
Date Modified | Username | Field | Change | |||||||
2013-08-14 18:49 | Michel Zou | New Issue | ||||||||
2013-08-14 18:49 | Michel Zou | File Added: cmake-swig-cross-compilation.patch | ||||||||
2013-08-15 07:01 | Michel Zou | Note Added: 0033719 | ||||||||
2013-09-03 05:48 | Michel Zou | Note Added: 0033775 | ||||||||
2013-11-25 09:21 | jschueller | Relationship added | duplicate of 0013449 | |||||||
2013-11-25 09:21 | jschueller | Status | new => resolved | |||||||
2013-11-25 09:21 | jschueller | Resolution | open => duplicate | |||||||
2013-11-25 09:21 | jschueller | Assigned To | => jschueller | |||||||
2014-06-02 08:37 | Robert Maynard | Note Added: 0036038 | ||||||||
2014-06-02 08:37 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|