[cmake-developers] [CMake 0014004]: FindSDL fails to find headers for cross-compilation

Mantis Bug Tracker mantis at public.kitware.com
Tue Mar 12 12:51:38 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14004 
====================================================================== 
Reported By:                Quintus
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14004
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-03-12 12:51 EDT
Last Modified:              2013-03-12 12:51 EDT
====================================================================== 
Summary:                    FindSDL fails to find headers for cross-compilation
Description: 
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.
====================================================

Steps to Reproduce: 
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.

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-03-12 12:51 Quintus        New Issue                                    
======================================================================




More information about the cmake-developers mailing list