View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013449CMakeCMakepublic2012-08-01 08:002014-06-02 08:37
ReporterMiguel FIGUEIREDO 
Assigned Tojschueller 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx86_64OSlinux-3.2.0-27-genericOS VersionUbuntu 12.04 LTS
Product VersionCMake 2.8.7 
Target VersionCMake 3.0Fixed in Version 
Summary0013449: [CROSS-CC] FindSWIG.cmake does not work when CMAKE_FIND_ROOT is redefined and CMAKE_FIND_ROOT_PATH_MODE_INCLUDE is set to ONLY
DescriptionThe "FindSWIG.cmake" script internally uses the command FIND_PATH() to set SWIG_DIR variable.

This command may have the path prefix overriden if :
- the variable CMAKE_FIND_ROOT is redefined to point to a different root path than the host machine root path, and
- the variable CMAKE_FIND_ROOT_PATH_MODE_INCLUDE is set to ONLY.

This is a typical use case when building for embedded targets.
Steps To Reproduce- Create a CMakeList.txt which have "find_package(SWIG)" into it (see http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_CMake_to_generate_SWIG_wrapper_libraries.3F [^]).

- Create a cmake toolchain script which redefines CMAKE_FIND_ROOT and set CMAKE_FIND_ROOT_PATH_MODE_INCLUDE to only (see http://www.vtk.org/Wiki/CMake_Cross_Compiling#The_toolchain_file [^]).

- Run cmake and make

- The build system should report the following error :
"CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find SWIG (missing: SWIG_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindSWIG.cmake:74 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  lw_pvod_core/binding/CMakeLists.txt:1 (find_package)"
Additional InformationI solve the issue by adding the parameter NO_CMAKE_FIND_ROOT_PATH to FIND_PATH() command avoiding path prefix overriding.

--- /usr/share/cmake-2.8/Modules/FindSWIG.cmake 2012-08-01 13:57:45.732656623 +0200
+++ FindSWIG.cmake 2012-08-01 13:57:51.528656642 +0200
@@ -45,7 +45,7 @@
     STRING(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output})
     # force the path to be computed each time in case SWIG_EXECUTABLE has changed.
     SET(SWIG_DIR SWIG_DIR-NOTFOUND)
- FIND_PATH(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output})
+ FIND_PATH(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH)
     IF(SWIG_DIR)
       SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake)
       EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version
TagsNo tags attached.
Attached Files

 Relationships
has duplicate 0014359closedjschueller [FindSWIG] SWIG detection fails when cross-compiling 

  Notes
(0034518)
Brad King (manager)
2013-11-22 09:14

FindSWIG: Search for swig.swg only on host
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=19b7a54d [^]
(0034543)
jschueller (developer)
2013-11-25 09:04

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=19b7a54d [^]
(0036039)
Robert Maynard (manager)
2014-06-02 08:37

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-08-01 08:00 Miguel FIGUEIREDO New Issue
2013-10-22 05:25 Michel Zou Note Added: 0034213
2013-10-22 05:26 Michel Zou Note Edited: 0034213
2013-11-22 09:08 Brad King Assigned To => jschueller
2013-11-22 09:08 Brad King Status new => assigned
2013-11-22 09:14 Brad King Note Added: 0034518
2013-11-22 09:20 Brad King Target Version => CMake 3.0
2013-11-25 09:03 jschueller Note Deleted: 0034213
2013-11-25 09:04 jschueller Note Added: 0034543
2013-11-25 09:04 jschueller Status assigned => resolved
2013-11-25 09:04 jschueller Resolution open => fixed
2013-11-25 09:21 jschueller Relationship added has duplicate 0014359
2014-06-02 08:37 Robert Maynard Note Added: 0036039
2014-06-02 08:37 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team