Build: Simplify configure_file() calls

This commit is contained in:
Alex Turbov 2022-08-21 04:48:36 +04:00 committed by Brad King
parent a67c9f9756
commit 0aed435b35
6 changed files with 21 additions and 49 deletions

View File

@ -114,9 +114,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
endif()
# Inform STL library header wrappers whether to use system versions.
configure_file(${CMake_SOURCE_DIR}/Utilities/std/cmSTL.hxx.in
${CMake_BINARY_DIR}/Utilities/cmSTL.hxx
@ONLY)
configure_file(Utilities/std/cmSTL.hxx.in Utilities/cmSTL.hxx @ONLY)
# set the internal encoding of CMake to UTF-8
set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
@ -222,9 +220,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
endforeach()
# Inform utility library header wrappers whether to use system versions.
configure_file(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in
${CMake_BINARY_DIR}/Utilities/cmThirdParty.h
@ONLY)
configure_file(Utilities/cmThirdParty.h.in Utilities/cmThirdParty.h @ONLY)
endmacro()
@ -262,18 +258,12 @@ macro(CMAKE_SETUP_TESTING)
endif()
# configure some files for testing
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
@ONLY)
configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
configure_file(Templates/CTestScript.cmake.in CTestScript.cmake @ONLY)
configure_file(Tests/.NoDartCoverage Tests/.NoDartCoverage)
configure_file(Tests/.NoDartCoverage Modules/.NoDartCoverage)
configure_file(CTestCustom.cmake.in CTestCustom.cmake @ONLY)
if(BUILD_TESTING AND DART_ROOT)
configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif
${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
configure_file(CMakeLogo.gif Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
endif()
mark_as_advanced(DART_ROOT)
endmacro()
@ -829,10 +819,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
endif()
# add the uninstall support
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
configure_file(cmake_uninstall.cmake.in cmake_uninstall.cmake @ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

View File

@ -43,31 +43,19 @@ endif()
# configure the .dox.in file
if(CMake_BUILD_DEVELOPER_REFERENCE)
configure_file(
"${CMake_SOURCE_DIR}/Source/dir.dox.in"
"${CMake_BINARY_DIR}/Source/dir.dox"
@ONLY
)
configure_file(dir.dox.in dir.dox @ONLY)
endif()
# configure the .h file
configure_file(
"${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in"
"${CMake_BINARY_DIR}/Source/cmConfigure.h"
)
configure_file(
"${CMake_SOURCE_DIR}/Source/cmVersionConfig.h.in"
"${CMake_BINARY_DIR}/Source/cmVersionConfig.h"
)
configure_file(
"${CMake_SOURCE_DIR}/Source/CPack/cmCPackConfigure.h.in"
"${CMake_BINARY_DIR}/Source/CPack/cmCPackConfigure.h"
)
configure_file(cmConfigure.cmake.h.in cmConfigure.h)
configure_file(cmVersionConfig.h.in cmVersionConfig.h)
configure_file(CPack/cmCPackConfigure.h.in CPack/cmCPackConfigure.h)
# Tell CMake executable in the build tree where to find the source tree.
configure_file(
"${CMake_SOURCE_DIR}/Source/CMakeSourceDir.txt.in"
"${CMake_BINARY_DIR}/CMakeFiles/CMakeSourceDir.txt" @ONLY
CMakeSourceDir.txt.in
"${CMake_BINARY_DIR}/CMakeFiles/CMakeSourceDir.txt"
@ONLY
)
# add the include path to find the .h
@ -1208,7 +1196,7 @@ if(WIN32)
set(CMake_RCVERSION_STR ${CMake_VERSION})
# Add Windows executable version information.
configure_file("CMakeVersion.rc.in" "CMakeVersion.rc" @ONLY)
configure_file(CMakeVersion.rc.in CMakeVersion.rc @ONLY)
# We use a separate object library for this to work around a limitation of
# MinGW's windres tool with spaces in the path to the include directories.

View File

@ -11,7 +11,7 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
endif()
configure_file(cmFormConfigure.h.in "${CMAKE_CURRENT_BINARY_DIR}/cmFormConfigure.h")
configure_file(cmFormConfigure.h.in cmFormConfigure.h)
add_library(cmForm
fld_arg.c

View File

@ -348,5 +348,4 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
endif()
set(CMAKE_PACKAGE_QTGUI TRUE)
configure_file("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in"
"${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY)
configure_file(QtDialogCPack.cmake.in QtDialogCPack.cmake @ONLY)

View File

@ -47,12 +47,10 @@ if(WIN32)
list(APPEND CMakeLib_TESTS
testVisualStudioSlnParser.cxx
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testVisualStudioSlnParser.h.in
${CMAKE_CURRENT_BINARY_DIR}/testVisualStudioSlnParser.h @ONLY)
configure_file(testVisualStudioSlnParser.h.in testVisualStudioSlnParser.h @ONLY)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testXMLParser.h.in
${CMAKE_CURRENT_BINARY_DIR}/testXMLParser.h @ONLY)
configure_file(testXMLParser.h.in testXMLParser.h @ONLY)
create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS})
add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS})

View File

@ -1,5 +1,5 @@
foreach(_retval IN ITEMS 0 1)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY)
configure_file(memtester.cxx.in ret${_retval}.cxx @ONLY)
endforeach()
include_directories(${CMake_SOURCE_DIR}/Source ${CMake_BINARY_DIR}/Source)