[CMake] CMake-2.6 CMAKE_TOOLCHAIN_FILE

Andreas Pokorny andreas.pokorny at gmail.com
Wed May 14 03:02:16 EDT 2008


Hi,
Thank you for all these hints. Are details like that described in the
Mastering CMake book?

I tracked it down to:
CMakeDetermineCCompiler.cmake: line 97:
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
  GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME_WE)
  MESSAGE(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
  MESSAGE(STATUS "COMPILER_BASENAME: ${COMPILER_BASENAME}")
  IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc")
    STRING(REGEX REPLACE "^(.+-)g?cc"  "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER
_BASENAME}")
  ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc")
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)

MESSAGE(STATUS "TOOLCHAIN: ${_CMAKE_TOOLCHAIN_PREFIX}")


It prints
CMAKE_C_COMPILER:
c:/work/QNX632/host/win32/x86/usr/bin/arm-unknown-nto-qnx6.3.0-gcc.exe
COMPILER_BASENAME: arm-unknown-nto-qnx6
TOOLCHAIN:

Seems like get_filename_component takes the first dot to determine the
extension!

kind regards
Andreas Pokorny


More information about the CMake mailing list