[CMake] FW: cmake newbie questions

Alexander Neundorf a.neundorf-work at gmx.net
Wed Aug 6 16:30:05 EDT 2008


On Wednesday 06 August 2008, Phil Smith wrote:
> No errors, no CMakeError.log -- just null values for the SIZEOF_LONG_LONG
> et al.
>
> It sets CMAKE_C_COMPILER_ARG1 in CMakeDetermineCCompiler.cmake -- but
> inside: IF(NOT CMAKE_C_COMPILER)
>
> ...so it doesn't do it if you explicitly specify a C compiler, a la:
>         SET(CMAKE_C_COMPILER   "c:/progra~1/dignus/cc.bat -fasciiout")
>
> At least, that's how I read it.  After some fumbling, I put a MESSAGE
> before and inside that IF block, and only the one before gets triggered.

That's how it continues after the ELSE():

ELSE(NOT CMAKE_C_COMPILER)

  # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made 
CMakeCache.txt
  # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
  # if CMAKE_C_COMPILER is a list of length 2, use the first item as 
  # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1

  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)

So set CMAKE_C_COMPILER to  
SET(CMAKE_C_COMPILER   "c:/progra~1/dignus/cc.bat" "-fasciiout")
and then CMAKE_C_COMPILER_ARG1 should be set there.

Doesn't that work ?

Alex



More information about the CMake mailing list