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:
parent
d84d6ed409
commit
54156d723a
@ -419,12 +419,12 @@ function(write_compiler_detection_header
|
|||||||
set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
|
set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
|
||||||
|
|
||||||
if(_WCD_OUTPUT_FILES_VAR)
|
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")
|
set(file_content "${file_content}\n# include \"${compile_file_name}\"\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(_WCD_OUTPUT_FILES_VAR)
|
if(_WCD_OUTPUT_FILES_VAR)
|
||||||
set(compiler_file_content compiler_file_content_${compiler})
|
set(compiler_file_content compiler_file_content_${compiler}_${_lang})
|
||||||
else()
|
else()
|
||||||
set(compiler_file_content file_content)
|
set(compiler_file_content file_content)
|
||||||
endif()
|
endif()
|
||||||
@ -627,16 +627,20 @@ function(write_compiler_detection_header
|
|||||||
|
|
||||||
if(_WCD_OUTPUT_FILES_VAR)
|
if(_WCD_OUTPUT_FILES_VAR)
|
||||||
foreach(compiler ${_WCD_COMPILERS})
|
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 "${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}")
|
set(full_path "${main_file_dir}/${compile_file_name}")
|
||||||
list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path})
|
list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path})
|
||||||
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
|
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
|
||||||
"${full_path}"
|
"${full_path}"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
set(${_WCD_OUTPUT_FILES_VAR} ${${_WCD_OUTPUT_FILES_VAR}} PARENT_SCOPE)
|
set(${_WCD_OUTPUT_FILES_VAR} ${${_WCD_OUTPUT_FILES_VAR}} PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user