<br><br><div class="gmail_quote">2010/4/13 Alexander Neundorf <span dir="ltr"><<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On Tuesday 13 April 2010, Diego wrote:<br>
> Hello,<br>
> I'm trying to cross-compiling a library for the PSP platform, this is my<br>
> toolchain:<br>
><br>
> *# The name of the target operating system.<br>
> set(CMAKE_SYSTEM_NAME Generic)<br>
><br>
> # Which compilers to use for C and C++.<br>
> set(CMAKE_C_COMPILER /usr/local/pspdev/bin/psp-gcc)<br>
> set(CMAKE_CXX_COMPILER /usr/local/pspdev/bin/psp-g++)<br>
><br>
> set(CMAKE_FIND_ROOT_PATH /usr/local/pspdev/psp)<br>
><br>
> # Adjust the default behaviour of the FIND_XXX() commands:<br>
> # search headers and libraries in the target environment, search<br>
> # programs in the host environment.<br>
> set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)<br>
> set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)<br>
> set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)*<br>
><br>
><br>
> And this is the code (from CmakeLists.txt) to find the zlib.h header<br>
> located in /usr/local/pspdev/psp/include:<br>
><br>
> *cmake_minimum_required(VERSION 2.6 FATAL_ERROR)<br>
> if(COMMAND cmake_policy)<br>
> cmake_policy(SET CMP0003 NEW)<br>
> endif(COMMAND cmake_policy)<br>
><br>
> if(NOT CMAKE_BUILD_TYPE)<br>
> set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING<br>
> "Choose the type of build, options are:<br>
> None Debug Release RelWithDebInfo MinSizeRel Profile."<br>
> FORCE)<br>
> endif()<br>
> # Restrict configuration types to the selected build type.<br>
> # Note: This needs to be done before the project command<br>
> set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" CACHE INTERNAL<br>
> "internal")<br>
><br>
> # Set the project name.<br>
> project(MyLibrary C CXX)<br>
><br>
> FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)<br>
><br>
> message(STATUS "zlib include dir ${ZLIB_INCLUDE_DIR}")*<br>
><br>
> It returns not found but it should.<br>
><br>
> Setting *CMAKE INCLUDE_PATH* to */usr/local/pspdev/psp/include *(and<br>
> commenting the line set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) works as<br>
> expected.<br>
><br>
> What I'm doing wrong?<br>
<br>
</div></div>Without testing it...<br>
<br>
You set CMAKE_SYSTEM_NAME to "Generic", so Modules/Platforms/Generic.cmake is<br>
loaded. This file looks like this:<br>
<br>
---------8<----------------8<-----------------------8<---------------<br>
# This is a platform definition file for platforms without<br>
# operating system, typically embedded platforms.<br>
# It is used when CMAKE_SYSTEM_NAME is set to "Generic"<br>
#<br>
# It is intentionally empty, since nothing is known<br>
# about the platform. So everything has to be specified<br>
# in the system/compiler files ${CMAKE_SYSTEM_NAME}-<compiler_basename>.cmake<br>
# and/or<br>
${CMAKE_SYSTEM_NAME}-<compiler_basename>-${CMAKE_SYSTEM_PROCESSOR}.cmake<br>
<br>
# (embedded) targets without operating system usually don't support shared<br>
libraries<br>
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)<br>
<br>
---------8<----------------8<-----------------------8<---------------<br>
<br>
IOW, it doesn't load e.g. UnixPaths.cmake, so CMAKE_SYSTEM_INCLUDE_PATH is<br>
empty.<br>
Maybe it would be a good idea to add at least include/, lib/ and bin/ as<br>
default search paths in Generic.cmake.<br>
<br>
Can you append the following code to Generic.cmake and see if it works then ?<br>
<br>
SET(CMAKE_SYSTEM_INCLUDE_PATH /include "${CMAKE_INSTALL_PREFIX}/include")<br>
SET(CMAKE_SYSTEM_LIBRARY_PATH /lib "${CMAKE_INSTALL_PREFIX}/lib")<br>
SET(CMAKE_SYSTEM_PROGRAM_PATH /bin "${CMAKE_INSTALL_PREFIX}/bin")<br>
<br>
<br>
Alex<br>
</blockquote></div><br>Yes, it works now!<br>The CMAKE_FIND_ROOT_PATH variable it seems isn't
really necessary (??).<br><br>Thank you very much by the info about the
Modules/Platform/ directory :) and by your help.<br>
<br>Best regards.<br>