WCDH: Generate per-language files in multi-file mode.

Otherwise we generate defines for C/CXX features unguarded by the presence of
the __cplusplus macro and available to the wrong compiler.
This commit is contained in:
Stephen Kelly 2015-01-17 14:42:08 +01:00
parent d84d6ed409
commit 54156d723a
1 changed files with 15 additions and 11 deletions

View File

@ -419,12 +419,12 @@ function(write_compiler_detection_header
set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
if(_WCD_OUTPUT_FILES_VAR)
set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}.h")
set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
set(file_content "${file_content}\n# include \"${compile_file_name}\"\n")
endif()
if(_WCD_OUTPUT_FILES_VAR)
set(compiler_file_content compiler_file_content_${compiler})
set(compiler_file_content compiler_file_content_${compiler}_${_lang})
else()
set(compiler_file_content file_content)
endif()
@ -627,16 +627,20 @@ function(write_compiler_detection_header
if(_WCD_OUTPUT_FILES_VAR)
foreach(compiler ${_WCD_COMPILERS})
foreach(_lang ${_langs})
if(compiler_file_content_${compiler}_${_lang})
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}_${_lang}}")
set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}.h")
set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
set(full_path "${main_file_dir}/${compile_file_name}")
list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path})
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${full_path}"
@ONLY
)
endif()
endforeach()
endforeach()
set(${_WCD_OUTPUT_FILES_VAR} ${${_WCD_OUTPUT_FILES_VAR}} PARENT_SCOPE)
endif()