[CMake] CMake Error: Error required internal CMake variable not set, ...

Enrique Izaguirre enrique.izaguirre at gmail.com
Wed Jan 12 10:29:39 EST 2011


Hello,

I am new to CMake and following a few examples, I am now trying to
cross-compile a C++ program from Cygwin to Linux, and I got the following
errors:

CMake Error: Error required internal CMake variable not set, cmake may be
not be built correctly.
Missing variable is:
CMAKE_C++_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be
not be built correctly.
Missing variable is:
CMAKE_C++_COMPILER
:


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 C++)

    #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:
   INCLUDE (CMakeForceCompiler)
   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 .


Before this, I tried it compiling a simple C program, using gcc-linux
compiler and setting CMAKE_C_COMPILER variable, and it worked correctly, but
once that I am trying to do it with C++ I got these errors. I couldn't find
anything about this on the web. Could you help me please?

Thanks

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


More information about the CMake mailing list