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

Alexander Neundorf a.neundorf-work at gmx.net
Sat Feb 5 10:07:35 EST 2011


On Saturday 05 February 2011, Enrique Izaguirre wrote:
> Hi Alex,
>
> Thank for the response. For some reason I didn't get the whole output
> before, but now here it is:
>
> # cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-linuxcpp.cmake ..
> -- The CXX compiler identification is GNU
> -- Check for working CXX compiler: /bin/g++-linux
> -- Check for working CXX compiler: /bin/g++-linux -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> System name is:
> Linux
> The Top directory is:
> /home/x0148488/omapflash
> Adding subdirectory comdriver...
> Entering comdriver's CMakeLists
> Now trying to find AdbWinApi.lib library
> Adding subdirectory common...
> Adding subdirectory host...
> -- Configuring done
> CMake Error: Error required internal CMake variable not set, cmake may be
> not be built correctly.
> Missing variable is:
> CMAKE_C_LINK_EXECUTABLE
> -- Generating done
> -- Build files have been written to: /home/x0148488/omapflash/cmake_build
>
> Seems that it is only taking the g++ compiler, and not the gcc. In the
> Toolchain file both are set, but seems that it is taking only the last one.

Do you maybe have a 
project(YourProject CXX)
command in your toplevel CMakeLists.txt ?
This would make cmake enable only the C++ language, but not the C language, 
i.e. not check for the C compiler, set its variables, etc.

This should lead to the behaviour you are seeing, if you are creating an C 
executable  later on.

By default, if you don't have any project() call, cmake automatically activate 
C and C++.

Alex


More information about the CMake mailing list