From d8a2560c310afb67edb3d5aed6f777da5913db81 Mon Sep 17 00:00:00 2001 From: Nicholas Hutchinson Date: Sun, 17 Aug 2014 12:21:11 +0100 Subject: [PATCH] Fix `-isystem` includes being incorrectly passed to execute_process() The external command was being invoked with arguments: ["clang", ..., "-isystem /foo/bar/baz", ...], which meant that the compiler treated the whitespace between the flag and the path as being part of the path itself. (i.e. it was looking for " /foo/bar/baz"). Fixed by passing the argument to execute_process() as '-isystem/foo/bar/baz'; I also needed to ensure we normalized the value of CMAKE_INCLUDE_SYSTEM_FLAG_, which itself contains trailing whitespace in some cases. --- CMake/cotire.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/cotire.cmake b/CMake/cotire.cmake index cc6bbb4..50dc362 100644 --- a/CMake/cotire.cmake +++ b/CMake/cotire.cmake @@ -759,7 +759,7 @@ macro (cotire_add_includes_to_cmd _cmdVar _language _includeSystemFlag _includes else() list(FIND ${_systemIncludesVar} ${_include} _index) if(_index GREATER -1 AND NOT "${_includeSystemFlag}" STREQUAL "") - list (APPEND ${_cmdVar} "${_includeSystemFlag} ${_include}") + list (APPEND ${_cmdVar} "${_includeSystemFlag}${_include}") else() list (APPEND ${_cmdVar} "-I${_include}") endif() @@ -1922,7 +1922,7 @@ function (cotire_generate_target_script _language _configurations _targetSourceD get_target_property(COTIRE_TARGET_MAXIMUM_NUMBER_OF_INCLUDES ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES) cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_PRE_UNDEFS COTIRE_TARGET_SOURCES_PRE_UNDEFS ${COTIRE_TARGET_SOURCES}) cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_POST_UNDEFS COTIRE_TARGET_SOURCES_POST_UNDEFS ${COTIRE_TARGET_SOURCES}) - set (COTIRE_INCLUDE_SYSTEM_FLAG ${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}) + string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" COTIRE_INCLUDE_SYSTEM_FLAG) set (COTIRE_TARGET_CONFIGURATION_TYPES "${_configurations}") foreach (_config ${_configurations}) string (TOUPPER "${_config}" _upperConfig)