diff options
author | Brad King <brad.king@kitware.com> | 2015-01-19 18:55:27 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-01-19 18:55:27 (GMT) |
commit | 0898de99cc085fee8534369aea27e9333b53d694 (patch) | |
tree | b6bba5666056e5b48c4ef6f4a307cff4e4b34cf4 | |
parent | 2e71d92ef270c4234368fd2e88259c0defbfb650 (diff) | |
parent | 59e6e15cde911e182e471df5b99746e0e203ba43 (diff) | |
download | CMake-0898de99cc085fee8534369aea27e9333b53d694.zip CMake-0898de99cc085fee8534369aea27e9333b53d694.tar.gz CMake-0898de99cc085fee8534369aea27e9333b53d694.tar.bz2 |
Merge topic 'WriteCompilerDetectionHeader-multi-file-lang'
59e6e15c Help: Add notes for topic 'WriteCompilerDetectionHeader-multi-file-lang'
54156d72 WCDH: Generate per-language files in multi-file mode.
d84d6ed4 WCDH: Allow compilers to specify features for one language but not the other.
7dcdfec9 WCDH: Find a language-specific DetermineCompiler.cmake if present.
-rw-r--r-- | Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst | 6 | ||||
-rw-r--r-- | Modules/WriteCompilerDetectionHeader.cmake | 44 |
2 files changed, 35 insertions, 15 deletions
diff --git a/Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst b/Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst new file mode 100644 index 0000000..a8665da --- /dev/null +++ b/Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst @@ -0,0 +1,6 @@ +WriteCompilerDetectionHeader-multi-file +--------------------------------------- + +* The :module:`WriteCompilerDetectionHeader` module learned to create + multiple output files per compiler and per language, instead of creating + one large file. diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index d61358f..a6ff475 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -234,7 +234,11 @@ function(_load_compiler_variables CompilerId lang) foreach(feature ${ARGN}) set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE) endforeach() - include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL) + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-DetermineCompiler.cmake" OPTIONAL + RESULT_VARIABLE determinedCompiler) + if (NOT determinedCompiler) + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL) + endif() set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) endfunction() @@ -382,6 +386,13 @@ function(write_compiler_detection_header endif() foreach(_lang ${_langs}) + set(target_compilers) + foreach(compiler ${_WCD_COMPILERS}) + _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features}) + if(_cmake_oldestSupported_${compiler}) + list(APPEND target_compilers ${compiler}) + endif() + endforeach() get_property(known_features GLOBAL PROPERTY CMAKE_${_lang}_KNOWN_FEATURES) foreach(feature ${${_lang}_features}) @@ -404,17 +415,16 @@ function(write_compiler_detection_header set(file_content "${file_content}${ID_CONTENT}\n") set(pp_if "if") - foreach(compiler ${_WCD_COMPILERS}) - _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features}) + foreach(compiler ${target_compilers}) 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() @@ -617,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() |