Merge topic 'HandleCMAKE_CXX_COMPILER_ARG1InEclipse'

3df49dc fix #12392: handle CMAKE_CXX_COMPILER_ARG1 for Eclipse projects
This commit is contained in:
David Cole 2011-10-11 14:45:09 -04:00 committed by CMake Topic Stage
commit 3ece15b8f9
2 changed files with 14 additions and 3 deletions

View File

@ -25,10 +25,12 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
IF (${_lang} STREQUAL "c++")
SET(_compilerExecutable "${CMAKE_CXX_COMPILER}")
SET(_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
ELSE ()
SET(_compilerExecutable "${CMAKE_C_COMPILER}")
SET(_arg1 "${CMAKE_C_COMPILER_ARG1}")
ENDIF ()
EXECUTE_PROCESS(COMMAND ${_compilerExecutable} -v -E -x ${_lang} -dD dummy
EXECUTE_PROCESS(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
ERROR_VARIABLE _gccOutput
OUTPUT_VARIABLE _gccStdout )

View File

@ -987,17 +987,26 @@ void cmExtraEclipseCDT4Generator
// we need the "make" and the C (or C++) compiler which are used, Alex
std::string make = makefile.GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::string compiler = makefile.GetSafeDefinition("CMAKE_C_COMPILER");
std::string arg1 = makefile.GetSafeDefinition("CMAKE_C_COMPILER_ARG1");
if (compiler.empty())
{
compiler = makefile.GetSafeDefinition("CMAKE_CXX_COMPILER");
arg1 = makefile.GetSafeDefinition("CMAKE_CXX_COMPILER_ARG1");
}
if (compiler.empty()) //Hmm, what to do now ?
{
compiler = "gcc";
}
// the following right now hardcodes gcc behaviour :-/
std::string compilerArgs =
"-E -P -v -dD ${plugin_state_location}/${specs_file}";
if (!arg1.empty())
{
arg1 += " ";
compilerArgs = arg1 + compilerArgs;
}
fout <<
"<storageModule moduleId=\"scannerConfiguration\">\n"
"<autodiscovery enabled=\"true\" problemReportingEnabled=\"true\""
@ -1007,7 +1016,7 @@ void cmExtraEclipseCDT4Generator
cmExtraEclipseCDT4Generator::AppendScannerProfile(fout,
"org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile",
true, "", true, "specsFile",
"-E -P -v -dD ${plugin_state_location}/${specs_file}",
compilerArgs,
compiler, true, true);
cmExtraEclipseCDT4Generator::AppendScannerProfile(fout,
"org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile",