summaryrefslogtreecommitdiff
path: root/Modules/WriteCompilerDetectionHeader.cmake
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-01-17 14:42:08 +0100
committerStephen Kelly <steveire@gmail.com>2015-01-17 14:48:27 +0100
commit54156d723a3fde678ed7f884364ad0449d23ad2b (patch)
treea83426a1c16ec1bc93862d51bf07ec38d23421d8 /Modules/WriteCompilerDetectionHeader.cmake
parentd84d6ed409c663573a02efa7d2692b6829d27c46 (diff)
downloadcmake-54156d723a3fde678ed7f884364ad0449d23ad2b.tar.gz
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.
Diffstat (limited to 'Modules/WriteCompilerDetectionHeader.cmake')
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake28
1 files changed, 16 insertions, 12 deletions
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index d9ab9fb821..a6ff475a20 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -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})
- set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}")
- set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}}")
-
- set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}.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
- )
+ 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}_${_lang}}")
+
+ 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()