Code Blocks/Eclipse: Use non-default stdlib includes when specified.

When -stdlib=x is specified in CMAKE_CXX_FLAGS this passes it along so
that the correct include dirs are detected.
This commit is contained in:
Christian Manning 2014-07-02 16:15:28 +01:00 committed by Brad King
parent 6aa2d47737
commit 45a25d63ba
1 changed files with 5 additions and 1 deletions

View File

@ -26,11 +26,15 @@ macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
if (${_lang} STREQUAL "c++")
set(_compilerExecutable "${CMAKE_CXX_COMPILER}")
set(_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
if (CMAKE_CXX_FLAGS MATCHES "(-stdlib=[^ ]+)")
set(_stdlib "${CMAKE_MATCH_1}")
endif ()
else ()
set(_compilerExecutable "${CMAKE_C_COMPILER}")
set(_arg1 "${CMAKE_C_COMPILER_ARG1}")
endif ()
execute_process(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy
execute_process(COMMAND ${_compilerExecutable} ${_arg1} ${_stdlib} -v -E -x ${_lang} -dD dummy
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
ERROR_VARIABLE _gccOutput
OUTPUT_VARIABLE _gccStdout )