[CMake] CMake still broken post-2.8.1

Brad King brad.king at kitware.com
Fri Jan 20 16:57:31 EST 2012


On 1/20/2012 4:37 PM, Phil Smith wrote:
> I'm confused because neither of your examples has the semicolon,

I was asking which one you need, so neither option has semicolons.

 > but what we need is:
>    "regina.exe" "cc.rex" "dcc.exe" "CMakeCCompilerId.c"

Okay.

> But it sounds like you're saying that we're not actually getting invoked as:
>    cc.rex;dcc.exe   CMakeCCompilerId.c

Correct.  The execute_process should not be using the ";".  The semicolon
is CMake's list separator.  The execute process command line you see:

> If I run with --trace and --debug-output, the last of the output is:
>
> C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake(97):  EXECUTE_PROCESS(COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_
> COMPILER_ID_ARG1} ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} ${testflags} ${src} WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} OUTPUT_VARIABLE CMAKE_${lang}_C
> OMPILER_ID_OUTPUT ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT )

is here:

   http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerId.cmake;hb=v2.8.6#l96

     EXECUTE_PROCESS(
       COMMAND ${CMAKE_${lang}_COMPILER}
               ${CMAKE_${lang}_COMPILER_ID_ARG1}
               ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
               ${testflags}
               "${src}"
       WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
       OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
       ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
       RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
       )

CMake will evaluate ${CMAKE_${lang}_COMPILER_ID_ARG1} and split it on
the semicolons.  The execute_process will see the result as two arguments,
"cc.rex" and "dcc.exe", which is what you said is needed.  In fact if it
were not for the ";-change" you would be getting a single "cc.rex dcc.exe"
argument.  That is why I asked if that's what you want, since it appears
to work.

To see this, add this code right above that EXECUTE_PROCESS call:

     FOREACH(arg
       COMMAND ${CMAKE_${lang}_COMPILER}
               ${CMAKE_${lang}_COMPILER_ID_ARG1}
               ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
               ${testflags}
               "${src}"
       WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
       OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
       ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
       RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
       )
       MESSAGE(STATUS "arg=[${arg}]")
     ENDFOREACH()

The configure output should show you the exact set of arguments.

-Brad


More information about the CMake mailing list