MantisBT - CMake
View Issue Details
0012392CMakeCCMakepublic2011-08-08 03:552011-12-16 17:16
Axel Sander 
Alex Neundorf 
normalminoralways
closedfixed 
CMake 2.8.5 
CMake 2.8.7CMake 2.8.7 
0012392: CMakeFindEclipseCDT4.cmake ignores CMAKE_CXX_COMPILER_ARG1 in compiler invocation
While trying to find system include dirs, in the script CMakeFindEclipseCDT4.cmake the compile is called with:
 ... COMMAND ${_compilerExecutable} -v -E -P -x ${_lang} -dD dummy ...
When using something like ccache or distcc these commands are called directly with the parameter above and complain about unknown options -v.
In the lines:
  SET(_compilerExecutable "${CMAKE_CXX_COMPILER}");
and
  SET(_compilerExecutable "${CMAKE_C_COMPILER}");
the compiler arguments like ${CMAKE_CXX_COMPILER_ARG1}, ${CMAKE_C_COMPILER_ARG1}... are not used.
with:
  CC="ccache gcc" CXX="ccache g++" cmake -G "Eclipse CDT4 - Unix Makefiles" .
the .cproject does not contain system includes.

To view the problem use:
  MESSAGE(STATUS "gccOutput: ${_gccOutput}")
  MESSAGE(STATUS "gccStdout: ${_gccStdout}")
after invocation of
  EXECUTE_PROCESS(COMMAND ${_compilerExecutable}...)
No tags attached.
related to 0012223closed Alex Neundorf Support of linked resources in Eclipse/CDT (single files, not folders) 
Issue History
2011-08-08 03:55Axel SanderNew Issue
2011-08-08 03:59Alex NeundorfAssigned To => Alex Neundorf
2011-08-08 03:59Alex NeundorfStatusnew => assigned
2011-08-08 04:41Axel SanderNote Added: 0027177
2011-08-08 04:41Axel SanderNote Edited: 0027177bug_revision_view_page.php?bugnote_id=27177#r398
2011-08-08 05:43Axel SanderNote Added: 0027178
2011-09-30 15:20Alex NeundorfRelationship addedrelated to 0012223
2011-10-01 13:21Alex NeundorfNote Added: 0027501
2011-10-01 13:21Alex NeundorfStatusassigned => closed
2011-10-01 13:21Alex NeundorfResolutionopen => fixed
2011-12-16 17:16David ColeFixed in Version => CMake 2.8.7
2011-12-16 17:16David ColeTarget Version => CMake 2.8.7

Notes
(0027177)
Axel Sander   
2011-08-08 04:41   
Probably not a good solution (have not written so much cmake code before), but working for the test cases I've here:

Added the if block in the CXX part
    SET(_compilerExecutable "${CMAKE_CXX_COMPILER}")
    IF (NOT ("${CMAKE_CXX_COMPILER_ARG1}" STREQUAL ""))
      STRING(REGEX REPLACE "^ +" "" _compilerArg ${CMAKE_CXX_COMPILER_ARG1})
    ENDIF (NOT ("${CMAKE_CXX_COMPILER_ARG1}" STREQUAL ""))
and in the C part
    SET(_compilerExecutable "${CMAKE_C_COMPILER}")
    IF (NOT ("${CMAKE_CXX_COMPILER_ARG1}" STREQUAL ""))
      STRING(REGEX REPLACE "^ +" "" _compilerArg ${CMAKE_C_COMPILER_ARG1})
    ENDIF (NOT ("${CMAKE_CXX_COMPILER_ARG1}" STREQUAL ""))
and
  EXECUTE_PROCESS(COMMAND ${_compilerExecutable} ${_compilerArg} -v -E -P -x ${_lang} -dD dummy

I'm not sure if there should be quotes like:
  EXECUTE_PROCESS(COMMAND "${_compilerExecutable}" "${_compilerArg}" -v -E -P -x ${_lang} -dD dummy

(0027178)
Axel Sander   
2011-08-08 05:43   
In the .cproject file the runAction for the scanner does not get the arguments, either:
 <scannerInfoProvider id="specsFile">
   <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="/usr/bin/ccache" useDefault="true"/>

I did not find the source, where .cproject is generated, to analyse the problem further.
(0027501)
Alex Neundorf   
2011-10-01 13:21   
The sources are in Sources/cmExtraEclipseCTD4Generator.cxx.

I committed a patch which should make this work for you (at least my tests were successful) to cmake stage (HandleCMAKE_CXX_COMPILER_ARG1InEclipse branch) and merged it into next.

Hopefully it will still make it into 2.8.6.

Alex