From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 212341F8C1 for ; Tue, 5 May 2020 06:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbgEEGQx (ORCPT ); Tue, 5 May 2020 02:16:53 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:52744 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbgEEGQx (ORCPT ); Tue, 5 May 2020 02:16:53 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 56FBCDFCF5; Tue, 5 May 2020 02:16:48 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=/7IuQ5O2pCqCYqLDYEAHQl4Akpw=; b=L2g3Mp /xMGZjr1mlNcrsQZxoB1iDNy6s7mnvF4DkIBDul5o9J9355mJnkWHJg99jksdkR3 Vkkxb8embCZ9h+FZHOkwcJp19svAsH3SU2mkr8LxPddPhZie6oHZGDCdSiKHGfxf ihPGYnSHPxPRzWP9i6jR/WTK3VwfwNOA1eQmM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=FsQw49lE0/PcQ8GkttGVzfVdAB50V+Mb 09p/4EeLG4KxQ+IFckCnhjApkj5Ql03ewElhcQAsXLSiLa3VvRHUioD/iRx5rvQW 5PnsVG9i+CW2ei3CXs/fE04pUgIwUCOfhyM3s/y3SlbtqItVn7Q3xOZ1XTSTEr9W wTWy3H4y0UI= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 4EE41DFCF4; Tue, 5 May 2020 02:16:48 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.74.119.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 94C40DFCF3; Tue, 5 May 2020 02:16:45 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Sibi Siddharthan Cc: Konstantin Tokarev , Johannes Schindelin , Jeff King , Danh Doan , Sibi Siddharthan via GitGitGadget , "git\@vger.kernel.org" Subject: Re: [PATCH 0/8] CMake build system for git References: <20200427200852.GC1728884@coredump.intra.peff.net> <20200427201228.GD1728884@coredump.intra.peff.net> <20200428135222.GB31366@danh.dev> <20200428210750.GE4000@coredump.intra.peff.net> <689741588534833@mail.yandex.ru> <848941588629532@mail.yandex.ru> Date: Mon, 04 May 2020 23:16:43 -0700 In-Reply-To: (Sibi Siddharthan's message of "Tue, 5 May 2020 09:46:09 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: FEEAF7AC-8E97-11EA-8FA2-B0405B776F7B-77302942!pb-smtp20.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Sibi Siddharthan writes: > Yes, this is trivial, but doing so is bad practice in general and > difficult to maintain. Can you substantiate "bad" and "difficult" in the above sentence? They are so subjective words and sounds more of your "opinion" than generally accepted "fact". > Won't it be better just to copy the CMakeLists.txt to the root > directory for configuring. I do not know it is better or not compared to using directly from a subdirectory. But it is easy to see that it is a bad practice to keep the source of truth in contrib/cmake/CMakeLists.txt and use it by copying it to the top of the working tree. The reason would be obvious once you imagine what happens when those who are helping to improve CMake support find that they need to make changes. It is too easy to edit the one they copied to the top of the working tree until they manage to get it working, and then forget to copy it back to contrib/cmake/ before committing the change [*1*]. Compared to that, the way Konstantin showed, which is just to be at the top of the working tree and run the cmake command with a single argument, which is the path to the CMakeList.txt file, looked quite simple and straight-forward to an untrained eye that hsan't seen a real use of CMake. But there must be reasons, coming from lessons learned by using CMake with a CMakeList.txt file in a subdirectory and suffering the consequences of doing so, that makes you say it is a bad practice and difficult to maintain. It needs to be spelled out to help those who do not know CMake understand. Thanks. [Footnote] *1* Creating a symlink CMakeLists.txt at the top of the working tree that points into contrib/cmake/CMakeLists.txt (and it needs to be done only once) would avoid such a problem, but if your filesystem does not let you use a symlink, copying a skeletal CMakeLists.txt that nobody is expected to modify to the top of the working tree might be an acceptable workaround. The sole purpose of that skeletal CMakeLists.txt at the top of the working tree would be to include the "real" thing in contrib/cmake/ directory (I am assuming that CMake is capable of including a CMakeLists.txt file that exists elsewhere in another CMakeLists.txt file). With either of these arrangements, it is much less likely for the user to accidentally edit a "wrong" copy and forgets to update the real thing---the real thing stored in contrib/cmake will be the only one that would be edited.