1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Modules: Use file(CONFIGURE) instead of CMakeConfigurableFile.in

When this was implemented, file(CONFIGURE) wasn't yet available until
CMake 3.18.
This commit is contained in:
Peter Kokot
2025-09-14 00:56:19 +02:00
parent b53375ea94
commit 92c808687d
3 changed files with 17 additions and 17 deletions

View File

@@ -125,9 +125,12 @@ function (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target
set(targetincludes)
set(targetdefines)
else()
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${_moc_parameters}")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${_moc_parameters_file}" @ONLY)
file(
CONFIGURE
OUTPUT "${_moc_parameters_file}"
CONTENT "${_moc_parameters}\n"
@ONLY
)
endif()
set(_moc_extra_parameters_file @${_moc_parameters_file})

View File

@@ -883,10 +883,12 @@ function(add_jar _TARGET_NAME)
# Create the list of files to compile.
set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources)
string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${_JAVA_COMPILE_STRING}")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${_JAVA_SOURCES_FILE}" @ONLY)
unset(CMAKE_CONFIGURABLE_FILE_CONTENT)
file(
CONFIGURE
OUTPUT "${_JAVA_SOURCES_FILE}"
CONTENT "${_JAVA_COMPILE_STRING}\n"
@ONLY
)
list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}")
endif()
if (_JAVA_COMPILE_FILELISTS)

View File

@@ -831,14 +831,13 @@ template<> struct ${prefix_arg}StaticAssert<true>{};
foreach(compiler ${_WCD_COMPILERS})
foreach(_lang ${_langs})
if(compiler_file_content_${compiler}_${_lang})
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}")
string(APPEND 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}"
file(
CONFIGURE
OUTPUT "${full_path}"
CONTENT "${compiler_file_content_}${compiler_file_content_${compiler}_${_lang}}\n"
@ONLY
)
endif()
@@ -852,9 +851,5 @@ template<> struct ${prefix_arg}StaticAssert<true>{};
endif()
string(APPEND file_content "\n#endif")
set(CMAKE_CONFIGURABLE_FILE_CONTENT ${file_content})
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${file_arg}"
@ONLY
)
file(CONFIGURE OUTPUT "${file_arg}" CONTENT "${file_content}\n" @ONLY)
endfunction()