[CMake] FW: cmake newbie questions

Alexander Neundorf a.neundorf-work at gmx.net
Wed Aug 6 17:48:41 EDT 2008


On Wednesday 06 August 2008, Phil Smith wrote:
> I added the last line in the following block in
> CMakeDetermineCCompiler.cmake (insertion after line 69):
>
>   LIST(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH)
>   IF("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2)
>     LIST(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1)
>     LIST(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER)
>   ENDIF("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2)
> MESSAGE(STATUS "${CMAKE_C_COMPILER_ARG1}!")
>
> And when I run it, I get only the exclamation point. So I don't think
> CMAKE_C_COMPILER is being set right.
>
> In fact, I changed the MESSAGE to:
> MESSAGE(STATUS "${CMAKE_C_COMPILER_ARG1}! length is
> !${_CMAKE_C_COMPILER_LIST_LENGTH}! compiler !${CMAKE_C_COMPILER}!")
>
> and no matter whether I set the variable to two tokens, two tokens in one
> set of double quotes, or two tokens in two sets of double quotes, I get the
> same output:
>
> -- ! length is !1! compiler !c:/progra~1/dignus/cc.bat!
>
> So ARG1 is always null, which makes sense since length is always 1.

This should really return 2:
LIST(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH)

Please run cmake on the attached CMakeLists.txt (no cross compiling, just run 
it) and post the output.
Here it gives:
$ /opt/cmake-2.6.1-Linux-i386/bin/cmake .
-- x length: 2
-- y length: 1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/src/tests/listtest


Alex
-------------- next part --------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

SET(X_CMAKE_C_COMPILER   "c:/progra~1/dignus/cc.bat" "-fasciiout")

LIST(LENGTH X_CMAKE_C_COMPILER X_CMAKE_C_COMPILER_LIST_LENGTH)
MESSAGE(STATUS "x length: ${X_CMAKE_C_COMPILER_LIST_LENGTH}")


SET(Y_CMAKE_C_COMPILER   "c:/progra~1/dignus/cc.bat -fasciiout")

LIST(LENGTH Y_CMAKE_C_COMPILER Y_CMAKE_C_COMPILER_LIST_LENGTH)
MESSAGE(STATUS "y length: ${Y_CMAKE_C_COMPILER_LIST_LENGTH}")




More information about the CMake mailing list