From owner-freebsd-ports@freebsd.org Sun Apr 24 08:44:36 2016 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 417E4B1250E for ; Sun, 24 Apr 2016 08:44:36 +0000 (UTC) (envelope-from abi@abinet.ru) Received: from mail.abinet.ru (mail.abinet.ru [136.243.72.227]) by mx1.freebsd.org (Postfix) with ESMTP id C99321749 for ; Sun, 24 Apr 2016 08:44:35 +0000 (UTC) (envelope-from abi@abinet.ru) Received: from [10.0.0.1] (unknown [10.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.abinet.ru (Postfix) with ESMTPSA id 5C8A81917C for ; Sun, 24 Apr 2016 08:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=abinet.ru; s=dkim; t=1461487472; bh=HRIVPFcGhK3vJfFG4TxhI0UYshQ20ycaBGlMQQF3plc=; h=Date:From:To:Subject:References:In-Reply-To; b=kHMxCJhpUBxZRGu3VGXDP0O68BRSZhxXCzJNMSdftdhSPOvvTIU3nXiCeCbr97GmD 7J8KL2jjPzRmyPSyp23WoY3PHjNIHgi7P4YUUXy0zrpBQVnW5/9Vhd3RTwHx29H2pb YnS3DpDfwxUryvgWGxNy46hjcLjLRITMvBcwGQTI= Message-ID: <571C876F.3040000@abinet.ru> Date: Sun, 24 Apr 2016 11:44:31 +0300 From: abi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:) Gecko/20160112 FossaMail/25.2.0 MIME-Version: 1.0 To: freebsd-ports@freebsd.org Subject: Re: Making a port - debugging cmake check_include_file References: <571BE034.9070200@abinet.ru> <20160423215530.GP83618@over-yonder.net> <571BF713.4040607@abinet.ru> <20160424071351.GQ83618@over-yonder.net> In-Reply-To: <20160424071351.GQ83618@over-yonder.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 08:44:36 -0000 I go the first way, however it seems that include directory is ignored in include tests. -- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.28") -- Checking for module 'libv4l1' -- Found libv4l1, version 1.6.3 gmake[3]: Entering directory '/usr/home/abishai/zoneminder/work/ZoneMinder-5a3978f/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_c7b01.dir/CheckIncludeFile.c.o /usr/bin/cc -O2 -pipe -fstack-protector -fno-strict-aliasing -o CMakeFiles/cmTC_c7b01.dir/CheckIncludeFile.c.o -c /usr/home/abishai/zoneminder/work/ZoneMinder-5a3978f/CMakeFiles/CMakeTmp/CheckIncludeFile.c /usr/home/abishai/zoneminder/work/ZoneMinder-5a3978f/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'libv4l1-videodev.h' file not found #include No -I, like before. Should I try CMAKE_REQUIRED_INCLUDES ? However, I don't know the effect of this on linux systems. On 24.04.2016 10:13, Matthew D. Fuller wrote: > On Sun, Apr 24, 2016 at 01:28:35AM +0300 I heard the voice of > abi, and lo! it spake thus: >> Thanks! >> If speak about general purpose solution, acceptable by upstream, I should >> 1. make cmake variable like INCLUDE_DIR_EXTRA >> 2. if set, include it contents. >> 3. add default value if platform is FreeBSD >> Am I right? > I'd say it depends on how much work you wanna put in, and how > interested upstream is. > > > The pkgconfig path is fairly simple. In a quick test: > > include(FindPkgConfig) > pkg_check_modules(LIBV4L1 libv4l1) > if(LIBV4L1_FOUND) > include_directories(${LIBV4L1_INCLUDE_DIRS}) > endif() > > seems to set things right here (I assume from the libv4l1-videodev.h > that it wants v4l_1_ rather than v4l_2_). That may be trivially > upstreamable, since it should just quietly have no effect in the cases > where v4l isn't in pkgconf, and DTRT when it is. Of course, it won't > work if a system doesn't have pkg-config installed, so unless you > wanted to add that as a build dep (it _is_ pretty tiny, but it's an > extra dep), you couldn't assume it was there on the system. > > > A somewhat more verbose solution that passes more control to the port > level would be to patch in a block like > > if(EXTRA_INCDIRS) > foreach(dir ${EXTRA_INCDIRS}) > include_directories(${dir}) > endforeach() > endif() > > relatively early into the CMakeLists.txt and then add $LOCALBASE into > the cmake command with something like > > CMAKE_ARGS+=-DEXTRA_INCDIRS="${LOCALBASE}" > > in the port Makefile (untested). Aside from potential need to redo > the patch if the CMakeLists.txt changes between releases, that doesn't > really need any upstream involvement at all, it can just be carried in > the port. OTOH, it's probably not too objectionable (possibly with > tweaks to variable naming) to upstream either. > > >