From 0aed435b351577681a7cbbd8c542fbe998d1717d Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Sun, 21 Aug 2022 04:48:36 +0400 Subject: Build: Simplify `configure_file()` calls --- CMakeLists.txt | 29 ++++++++-------------------- Source/CMakeLists.txt | 28 ++++++++------------------- Source/CursesDialog/form/CMakeLists.txt | 2 +- Source/QtDialog/CMakeLists.txt | 3 +-- Tests/CMakeLib/CMakeLists.txt | 6 ++---- Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt | 2 +- 6 files changed, 21 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00e0052..54ff7e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index b1a79af..82978d5 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -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. diff --git a/Source/CursesDialog/form/CMakeLists.txt b/Source/CursesDialog/form/CMakeLists.txt index 68d28c8..63214e3 100644 --- a/Source/CursesDialog/form/CMakeLists.txt +++ b/Source/CursesDialog/form/CMakeLists.txt @@ -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 diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 95962d8..a635200 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -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) diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 1d45162..612d4b4 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -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}) diff --git a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt index 3f2f891..b4bc921 100644 --- a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt @@ -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) -- cgit v0.12