Author: rinrab Date: Wed Jul 3 14:20:04 2024 New Revision: 1918877 URL: http://svn.apache.org/viewvc?rev=1918877&view=rev Log: On the 'cmake' branch: Completely rework CMake files.
Now the CMakeLists.txt is included to the repository instead of being generated from the build.conf file, but it no longer includes the list of targets. Instead of this, the other file named `targets.cmake` would be generated from this config by using the gen-make.py script. Advantages ---------- 1. An error message could be written if the `targets.cmake` was not generated. which improves the user experience. 2. The `options.cmake`, `dependencies.cmake`, and other files that were previously using include() cmake command could be simply inlined into CMakeLists.txt. * trunk/ (svn:ignore): Unignore the CMakeLists.txt, because it is now tracked under the source control. Changes summary -------------- * build/cmake: (svn:ignore): Ignore the targets.cmake file, because it is generated instead of CMakeLists.txt. * build/generator/gen_cmake.py (Generator.write): Generate target.cmake instead of CMakeLists.txt. * build/generator/templates/CMakeLists.txt.ezt: Delete file. * build/generator/templates/targets.cmake.ezt: New file with the part of CMakeLists.txt.ezt, related to generation of the targets list. * CMakeLists.txt: New file with the following content: - includes of the other cmake files, which will be inlined in the feature. This is taken from the CMakeLists.txt.ezt file. - The basic CMake configuration and option which is also taken from the CMakeLists.txt.ezt file. - Checking for existing and later including of the targets.cmake file. This file contains the targets list and generated from build.conf. Added: subversion/branches/cmake/CMakeLists.txt (with props) subversion/branches/cmake/build/generator/templates/targets.cmake.ezt - copied, changed from r1918876, subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt Removed: subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt Modified: subversion/branches/cmake/ (props changed) subversion/branches/cmake/build/cmake/ (props changed) subversion/branches/cmake/build/generator/gen_cmake.py Propchange: subversion/branches/cmake/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Jul 3 14:20:04 2024 @@ -66,5 +66,4 @@ compile_commands.json .swig_py_checked .swig_rb_checked out -CMakeLists.txt CMakeSettings.json Added: subversion/branches/cmake/CMakeLists.txt URL: http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1918877&view=auto ============================================================================== --- subversion/branches/cmake/CMakeLists.txt (added) +++ subversion/branches/cmake/CMakeLists.txt Wed Jul 3 14:20:04 2024 @@ -0,0 +1,52 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# CMakeLists.txt -- configuration file for CMake build system +# + +cmake_minimum_required(VERSION 3.12) + +project("Subversion") + +include("build/cmake/dependencies.cmake") + +include("build/cmake/options.cmake") + +include("build/cmake/extractor.cmake") + +set(SVN_INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_SOURCE_DIR}/subversion/include" + "${CMAKE_CURRENT_BINARY_DIR}" +) + +if (WIN32) + add_compile_definitions( + "alloca=_alloca" + "WIN32" + ) +endif() + +if (NOT EXISTS "${CMAKE_SOURCE_DIR}/build/cmake/targets.cmake") + message(FATAL_ERROR + "The 'build/cmake/targets.cmake' file does NOT exist. " + "Use the following command to generate it:\n" + " python gen-make.py -t cmake" + ) +endif() + +include("build/cmake/targets.cmake") Propchange: subversion/branches/cmake/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: subversion/branches/cmake/build/cmake/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Jul 3 14:20:04 2024 @@ -0,0 +1 @@ +targets.cmake Modified: subversion/branches/cmake/build/generator/gen_cmake.py URL: http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/gen_cmake.py?rev=1918877&r1=1918876&r2=1918877&view=diff ============================================================================== --- subversion/branches/cmake/build/generator/gen_cmake.py (original) +++ subversion/branches/cmake/build/generator/gen_cmake.py Wed Jul 3 14:20:04 2024 @@ -212,9 +212,9 @@ class Generator(gen_base.GeneratorBase): ) template = ezt.Template(os.path.join('build', 'generator', 'templates', - 'CMakeLists.txt.ezt'), + 'targets.cmake.ezt'), compress_whitespace=False) - template.generate(open('CMakeLists.txt', 'w'), data) + template.generate(open(os.path.join('build', 'cmake', 'targets.cmake'), 'w'), data) def get_install_sources(self): install_sources = self.graph.get_all_sources(gen_base.DT_INSTALL) Copied: subversion/branches/cmake/build/generator/templates/targets.cmake.ezt (from r1918876, subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt) URL: http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/templates/targets.cmake.ezt?p2=subversion/branches/cmake/build/generator/templates/targets.cmake.ezt&p1=subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt&r1=1918876&r2=1918877&rev=1918877&view=diff ============================================================================== --- subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt (original) +++ subversion/branches/cmake/build/generator/templates/targets.cmake.ezt Wed Jul 3 14:20:04 2024 @@ -16,31 +16,9 @@ # specific language governing permissions and limitations # under the License. # -# CMakeLists.txt.ezt -- template for CMakeLists.txt file -# CMakeLists.txt -- configuration file for CMake build system +# CMakeLists.txt.ezt -- template for targets.cmake file +# CMakeLists.txt -- list of CMake targets # - -cmake_minimum_required(VERSION 3.12) - -project("Subversion") - -include("build/cmake/dependencies.cmake") - -include("build/cmake/options.cmake") - -include("build/cmake/extractor.cmake") - -set(SVN_INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_SOURCE_DIR}/subversion/include" - "${CMAKE_CURRENT_BINARY_DIR}" -) - -if (WIN32) - add_compile_definitions( - "alloca=_alloca" - "WIN32" - ) -endif() [for targets] if ([targets.enable_condition])[is targets.type "lib"] add_library([targets.name][targets.build_type][for targets.sources]