MantisBT - CMake
View Issue Details
0014004CMakeModulespublic2013-03-12 12:512016-06-10 14:31
Quintus 
Benjamin Eikel 
normalminoralways
closedmoved 
LinuxArch Linux
CMake 2.8.10.2 
 
0014004: FindSDL fails to find headers for cross-compilation
FindSDL fails to find the SDL include headers for cross compilation. I have a MXE (http://mxe.cc [^]) cross-compilation environment set up at $HOME/win32/mxe/usr/i686-pc-mingw32 which includes a cross-compiled SDL library for mingw32 (the host system is a 64-bit Arch Linux). Here’s a list of all SDL-related files installed under that root directory: http://pastie.org/6461937 [^]

Exact error from CMake:

====================================================
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
  Could NOT find SDL (missing: SDL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindSDL.cmake:178 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:40 (find_package)

====================================================

In order to cross-compile, I then set CMAKE_FIND_ROOT_PATH in my toolchain file:


====================================================
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_FIND_ROOT_PATH "$ENV{HOME}/win32/mxe/usr/i686-pc-mingw32")
====================================================

And of course, I also set the other necessary variables:

====================================================
set(CMAKE_C_COMPILER i686-pc-mingw32-gcc)
set(CMAKE_CXX_COMPILER i686-pc-mingw32-g++)
set(CMAKE_RC_COMPILER i686-pc-mingw32-windres)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
====================================================

This is the cross-compiler:

====================================================
% i686-pc-mingw32-gcc --version
i686-pc-mingw32-gcc (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
====================================================
1. Create a SDL installation for mingw32 somewhere
2. Create CMakeLists.txt that calls find_package(SDL REQUIRED)
3. Create a toolchain file for cross-compilation from Linux to mingw32, variables see above, ensure CMAKE_FIND_ROOT_PATH includes the root of your SDL installation
4. Invoke CMake with -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain/file
5. CMake fails to find the SDL headers.
No tags attached.
Issue History
2013-03-12 12:51QuintusNew Issue
2013-03-18 12:45Benjamin EikelNote Added: 0032665
2013-03-18 12:45Benjamin EikelAssigned To => Benjamin Eikel
2013-03-18 12:45Benjamin EikelStatusnew => assigned
2016-06-10 14:28Kitware RobotNote Added: 0042246
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0032665)
Benjamin Eikel   
2013-03-18 12:45   
Please check if the bug also affects 2.8.11-rc1 [1], because the new version contains a fix concerning SDL search directories (see issue 0013819 [2]).

[1] http://www.cmake.org/files/v2.8/?C=M;O=D [^]
[2] http://public.kitware.com/Bug/view.php?id=13819 [^]
(0042246)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.