[CMake] Still have a problem to cross-compile a simple C++ program

Enrique Izaguirre enrique.izaguirre at gmail.com
Wed Jan 12 13:41:28 EST 2011


Hello again:
For some reason when I try to compile a simple C++ program, it takes the
wrong compiler, even though I am setting the appropriate one in the
Toolchain file; I am working on Cygwin, and I am trying to compile for a
LInux environment using g++-linux compiler, which I tested it and works
correctly.

I have a folder named helloC++-linux, where I have all my stuff:
A simple hello.cpp program
My CMakeLists.txt contains:
    #CMakeLists.txt :  CMake configuration file
    PROJECT(helloC++-linux CXX)
    #States that CMake required version must be >= 2.6
    CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
    #File to build and executable:
    ADD_EXECUTABLE(hello.o hello.cpp)

My Toolchain file (named Toolchain-linuxcpp.cmake) contains:
   SET(CMAKE_SYSTEM_NAME Linux)
   #specify the cross-compiler
   SET(CMAKE_CXX_COMPILER /bin/g++-linux)


and I tried to build it using following command:
cmake -DCMAKE_TOOLACHAIN_FILE=./Toolchain-linuxcpp.cmake .

But when building, CMake looks for a compiler, and takes  /usr/bin/c++.exe
instead of /bin/g++-linux.

I tried also using CMAKE_FORCE_CXX_COMPILER, but I got the same results. Is
there any way of
make it take the compiler from /bin, instead of from /usr/bin ?

Thanks

Best Regards

Enrique
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110112/29162e31/attachment.htm>


More information about the CMake mailing list