[CMake] Still have a problem to cross-compile a simple C++ program
David Cole
david.cole at kitware.com
Wed Jan 12 13:46:03 EST 2011
First, use the correct spelling:
-DCMAKE_TOOLACHAIN_FILE
should be:
-DCMAKE_TOOLCHAIN_FILE
If that doesn't solve it entirely, then try using a name without the "+"
character in it for the PROJECT command.
If that doesn't do it, give us more details, I guess.
I'm not a cross-compiling expert, so hopefully somebody else who is can
chime in here as well.
HTH,
David
On Wed, Jan 12, 2011 at 1:41 PM, Enrique Izaguirre <
enrique.izaguirre at gmail.com> wrote:
> 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
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110112/001888b7/attachment-0001.htm>
More information about the CMake
mailing list