The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=13449 ====================================================================== Reported By: Miguel FIGUEIREDO Assigned To: ====================================================================== Project: CMake Issue ID: 13449 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2012-08-01 08:00 EDT Last Modified: 2012-08-01 08:00 EDT ====================================================================== Summary: [CROSS-CC] FindSWIG.cmake does not work when CMAKE_FIND_ROOT is redefined and CMAKE_FIND_ROOT_PATH_MODE_INCLUDE is set to ONLY Description: The "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 Information: I 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 ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2012-08-01 08:00 Miguel FIGUEIREDONew Issue ====================================================================== -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
