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: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id CC70E1F803 for ; Tue, 8 Jan 2019 07:39:25 +0000 (UTC) Received: from localhost ([127.0.0.1]:37970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gglyt-0006ys-Iq for normalperson@yhbt.net; Tue, 08 Jan 2019 02:39:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gglyo-0006xo-LU for bug-gnulib@gnu.org; Tue, 08 Jan 2019 02:39:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gglyk-0001od-W3 for bug-gnulib@gnu.org; Tue, 08 Jan 2019 02:39:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gglyj-0001hH-UR for bug-gnulib@gnu.org; Tue, 08 Jan 2019 02:39:14 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC64F88314; Tue, 8 Jan 2019 07:39:11 +0000 (UTC) Received: from kdudka-nb.localnet (ovpn-204-37.brq.redhat.com [10.40.204.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8363F10018FB; Tue, 8 Jan 2019 07:39:10 +0000 (UTC) From: Kamil Dudka To: Andrew Pennebaker Subject: Re: cmake support Date: Tue, 08 Jan 2019 08:39:41 +0100 Message-ID: <16290995.b3C5R5SNIv@kdudka-nb> In-Reply-To: References: <6589477.oZLneipaSj@kdudka-nb> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 08 Jan 2019 07:39:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bruno Haible , bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On Tuesday, January 8, 2019 2:46:08 AM CET Andrew Pennebaker wrote: > Hmm, cmake clearly supports building *libraries and executables* for > non-cmake external projects. But in the case of gnulib, gnulib itself does > not emit a library or executable, right? gnulib builds a static library. I thought it was obvious from my first reply. > It's meant to be sourced inside of another autotools project. Yes but a workaround exists and I mentioned it in my first reply. Did you try it? Kamil > Can cmake really be integrated around gnulib, or > am I forced to rewrite my project's build system in terms of autotools? > > Specifically, could someone clarify how gl_EARLY is supposed to be triggerd > by cmake in the inner gnulib project, so that files like openat.h can be > sourced from the cmake outer project? I don't know enough about autoconf > yet to understand how cmake would do this. It's hard enough getting this > far: > > # CMakeLists.txt > # Doesn't even work on my machine^TM > > add_executable(fewer lib/main.c lib/fewer.c) > > if(CMAKE_SYSTEM_NAME MATCHES "Minix") > ExternalProject_Add( > gnulib > SOURCE_DIR "gnulib" > CONFIGURE_COMMAND "${PROJECT_SOURCE_DIR}/gnulib/gnulib-tool" --dir > "${PROJECT_SOURCE_DIR}/gnulib-prefix/src/gnulib-build" --import openat # && > autoreconf -i && ./configure > BUILD_COMMAND echo > INSTALL_COMMAND echo > ) > add_dependencies(fewer gnulib) > target_include_directories(fewer PUBLIC > gnulib-prefix/src/gnulib-build/lib) > target_link_libraries(fewer libgnu) > endif() > > On Sun, Jan 6, 2019 at 3:37 AM Kamil Dudka wrote: > > On Sunday, January 6, 2019 3:22:01 AM CET Andrew Pennebaker wrote: > > > Ach, I've made a career out of not having to know autotools! ./configure > > > > && > > > > > make && [sudo] make install were black boxes as far as I was concerned. > > > > > > So be it, I'll spend some time reading up this weekend and see how far I > > > get. MSVC integration will become more interesting, but I suppose I can > > > disable Gnulib for targets that don't actually need it. This is what I > > > > get > > > > > for dipping my toes in CloudABI and introducing dprintf(), openat() to > > > my > > > projects :P > > > > > > Would be nice to offer NetBSD-style packages for MINIX and SmartOS, in > > > order to make Gnulib easier to install to a standard include path like > > > > with > > > > > other development libraries. > > > > I am afraid that there is no OS distribution that would install Gnulib to > > a standard include (and library) path and this is most likely not going to > > change because gnulib's developers do not want gnulib to be used this way: > > > > > > https://www.gnu.org/software/gnulib/manual/html_node/Library-vs-Reusable-C > > ode.html#Library-vs-Reusable-Code > > > > Kamil > > > > > On Sat, Jan 5, 2019 at 12:31 PM Kamil Dudka wrote: > > > > On Saturday, January 5, 2019 6:53:06 PM CET Bruno Haible wrote: > > > > > Hi, > > > > > > > > > > Andrew Pennebaker wrote: > > > > > > Could we improve how gnulib integrates with downstream projects, > > > > > > to > > > > > > > > make > > > > > > > > > > it > > > > > > easier to work with different build tools? In particular, would be > > > > > > > > helpful > > > > > > > > > > for gnulib to easily work with cmake projects. > > > > > > > > > > > > In my case, I have an application that needs openat(), and I > > > > already > > > > > > have > > > > > > > > > > a > > > > > > complex cmake configuration that would be difficult to rewrite in > > > > > > > > terms of > > > > > > > > > > autotools. > > > > > > > > > > I don't think we will spend time to make gnulib-tool generate cmake > > > > > configurations. > > > > > > > > > > 1. Because the GNU build system is based on Autotools. > > > > > 2. Because many people say that cmake is a horror to use. [1][2] > > > > > > > > That is not an argument. You can find similar horror stories about > > > > > > > > autotools: > > > > http://voices.canonical.com/jussi.pakkanen/2011/09/13/autotools/ > > > > > > > > > > But gnulib-tool by design creates a subdirectory, and you can > > > > yourself > > > > > > > - add a simple configure.ac to that subdirectory, as outlined in > > > > the > > > > > > > documentation [3], > > > > > > > > When I needed it 10 years ago, I was able to get around this > > > > limitation by > > > > > > using the --create-testdir option of gnulib-tool. It created a > > > > directory > > > > > > with configure script that (after running make) produced a static > > > > library. > > > > > > I am not sure if this approach had any side effects, like turning on > > > > debug > > > > > > build, but I was at least not forced to create configure.ac etc. > > > > > > > > Kamil > > > > > > > > > - integrate this subdirectory with cmake through an > > > > 'ExternalProject' > > > > > > [4]. > > > > > > > > > If, during this process, you encounter pain points that require > > > > (small) > > > > > > > gnulib-tool changes, please come back to us and report them. > > > > > > > > > > Bruno > > > > > > > > > > [1] > > > > https://www.reddit.com/r/cpp/comments/4flb8z/fighting_through_a_cmake_hell > > > > > > / > > > > > > > > > [2] > > > > https://www.reddit.com/r/cpp/comments/7yps20/its_time_to_do_cmake_right/ > > > > > > > [3] > > > > https://www.gnu.org/software/gnulib/manual/html_node/Initial-import.html > > > > > > > [4] > > > > https://stackoverflow.com/questions/5971921/building-a-library-using-autot > > > > > > o > > > > > > > > > ols-from-cmake