View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
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. | ||||||||
Attached Files | cmake-swig-cross-compilation.patch [^] (683 bytes) 2013-08-14 18:49 [Show Content] | ||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0033719) Michel Zou (reporter) 2013-08-15 07:01 |
It is all the more blocking since SWIG_DIR is reset each time: set(SWIG_DIR SWIG_DIR-NOTFOUND) find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) , and we cannot provide an additional location by passing explicitely the correct location, maybe a HINTS variable could also be passed ? Moreover SWIG_DIR and SWIG_VERSION should be marked: mark_as_advanced ( SWIG_VERSION SWIG_DIR ) |
(0033775) Michel Zou (reporter) 2013-09-03 05:48 |
I think it's a duplicate of http://public.kitware.com/Bug/view.php?id=13449 [^] From a year ago... C'mon guys :! |
(0036038) Robert Maynard (manager) 2014-06-02 08:37 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
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 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |