[CMake] Cross-compilation & Find_Package(Tcl)...

Georgios Petasis petasisg at yahoo.gr
Tue Jun 26 12:37:10 EDT 2012


Στις 26/6/2012 18:22, ο/η Georgios Petasis έγραψε:
> Στις 26/6/2012 17:56, ο/η Georgios Petasis έγραψε:
>> Hi all,
>>
>> I am trying to cross-compile an application for windows, in a Fedora 
>> 17 box.
>> I have successfully cross-compiled/installed Tcl/Tk from sources.
>> And I want to also cross-compile my application, which uses cmake.
>>
>> Is there a way to convince cmake to use the platform tclsh (in order 
>> to run some scripts), but find the includes & libraries that I have 
>> cross-compiled for the platform?
>>
>> Running cmake from the Fedora wrapper "mingw32-cmake" does not work. 
>> I also tried to set the following variables:
>>
>> CMAKE_PREFIX_PATH=/opt/ActiveTcl-8.6
>> CMAKE_INCLUDE_PATH=/free/cross-compilation-binaries/win32-ix86/tcl/include 
>>
>> CMAKE_LIBRARY_PATH=/free/cross-compilation-binaries/win32-ix86/tcl/lib
>> CMAKE_PROGRAM_PATH=/opt/ActiveTcl-8.6/bin
>>
>> But I always get the following:
>>
>> -- Found Tclsh: /opt/ActiveTcl-8.6/bin/tclsh (found version "8.6")
>> CMake Error at 
>> /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:97 
>> (MESSAGE):
>>   Could NOT find TCL (missing: TCL_LIBRARY TCL_INCLUDE_PATH)
>> Call Stack (most recent call first):
>> /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:288 
>> (_FPHSA_FAILURE_MESSAGE)
>>   /usr/share/cmake/Modules/FindTCL.cmake:206 
>> (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
>>   CMakeLists.txt:122 (FIND_PACKAGE)
>>
>>
>> Any ideas?
>>
>> George
>>
> I have managed to proceed a little bit further, with the following 
> commands:
>
> echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
> echo "CMAKE_INCLUDE_PATH=$CMAKE_INCLUDE_PATH"
> echo "CMAKE_LIBRARY_PATH=$CMAKE_LIBRARY_PATH"
> echo "CMAKE_PROGRAM_PATH=$CMAKE_PROGRAM_PATH"
> mingw32-cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE \
>               -D PKG_OS_ARCH=$ARCH -D CMAKE_INSTALL_PREFIX=$PREFIX \
>               -D TCL_INCLUDE_PATH=$CMAKE_INCLUDE_PATH \
>               -D TK_INCLUDE_PATH=$CMAKE_INCLUDE_PATH \
>               -D TCL_LIBRARY=$CMAKE_LIBRARY_PATH \
>               -D TK_LIBRARY=$CMAKE_LIBRARY_PATH ...
>
> Which gave as output:
>
> CMAKE_PREFIX_PATH=/free/cross-compilation-binaries/win32-ix86/tcl/
> CMAKE_INCLUDE_PATH=/free/cross-compilation-binaries/win32-ix86/tcl/include 
>
> CMAKE_LIBRARY_PATH=/free/cross-compilation-binaries/win32-ix86/tcl/lib
> CMAKE_PROGRAM_PATH=/opt/ActiveTcl-8.6/bin
> ...
> CMake Error: The following variables are used in this project, but 
> they are set to NOTFOUND.
> Please set them or make sure they are set and tested correctly in the 
> CMake files:
> TCL_STUB_LIBRARY (ADVANCED)
>
>
> How to help cmake to define the stubs library path?
> Looking inside the /free/cross-compilation-binaries/win32-ix86/tcl/lib 
> folder, the stubs library is named "libtclstub86.a"
>
> George
>
Finally, defining all the variables myself, seems to solve the problem:

mingw32-cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE \
               -D PKG_OS_ARCH=$ARCH -D CMAKE_INSTALL_PREFIX=$PREFIX \
               -D TCL_INCLUDE_PATH=$TCL_INCLUDE_PATH \
               -D TK_INCLUDE_PATH=$TCL_INCLUDE_PATH \
               -D TCL_LIBRARY=$TCL_LIB_PATH/libtcl${TCL_VERSION}.a \
               -D TK_LIBRARY=$TCL_LIB_PATH/libtk${TCL_VERSION}.a \
               -D 
TCL_STUB_LIBRARY=$TCL_LIB_PATH/libtclstub${TCL_VERSION}.a \
               -D 
TK_STUB_LIBRARY=$TCL_LIB_PATH/libtkstub${TCL_VERSION}.a ...

Now I have only to check what the output of the compiler is... :-)

George


More information about the CMake mailing list