From patchwork Sat Oct 15 21:03:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 682612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sxH5m0lcKz9s9c for ; Sun, 16 Oct 2016 08:04:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=P7mgMShj; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 79423C24E9; Sat, 15 Oct 2016 21:04:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yjuAvu2emfTD; Sat, 15 Oct 2016 21:04:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5F37DC24B4; Sat, 15 Oct 2016 21:04:23 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id A19A71C2233 for ; Sat, 15 Oct 2016 21:04:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9A14230B70 for ; Sat, 15 Oct 2016 21:04:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ph9Bf5Z+nO7q for ; Sat, 15 Oct 2016 21:04:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by silver.osuosl.org (Postfix) with ESMTPS id 448FB2E7F5 for ; Sat, 15 Oct 2016 21:04:20 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id 191so3777258wmr.0 for ; Sat, 15 Oct 2016 14:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j5oElUwhoyw7L8eHAIVhlNV0dELQB5WEHRAPY8Xz7vE=; b=P7mgMShjfPmC0eoC5LqseZRPqpx4Mau8MisPpjAD1VOrJ23X+FHA1ID8vHZCq4/CxW EKUMma0S9nkmVpD2lG3waaZ8qk9Ab6A9Nx0iYk2fjs6ooTtEjYoXnwAl+W0VIXxLwgXc sIF2erfp2BaoPqs+ovPdxeIyM34Ft+sB7DvlsNCp+y4mzXNvBLYQ0S9moAU36JseJntC l2pBthuh9CxRSRZAx+RZfeTe6/m/oaZdYR6jOiw7T7IhBzI6z4O9DWWq9+k2d0pLTqLy v/wFY6FIhG06lv8dk8KqgJobYtEkthVjL2N/iR3ajaEYIM2UbJHODG/zLpUxW2f7ogw9 RU1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j5oElUwhoyw7L8eHAIVhlNV0dELQB5WEHRAPY8Xz7vE=; b=VpgD7YZeBNgRorn1E7KleoNDsnlVNtLZ/gYEOeT39dyr3+w1hVs4YXyRlKNA3lMhXG O79gTSlBU9Jojhpkodka7VoO2FOjkg7Wu7bAzddT9vKgEEDN5ChZNs/SM6NIMkyOVHU9 KfKuK2LgiL/VbgVTD6jjWTzfcONLOogtYnaAJrAodCZPlKqPAGIJTxmkZ4NTViH+TeXs zfBQN/bWWQU6AjPpossOLjaQzosGy9nuX23CqnHOkCtyiqkKT4GyDJiV/zSuc1VynidT UFmias+sURRN+jVHil/Y7+OIG7enUookCUDbaiNVMUV4lXQ/ZT+dibIjv9XytUd7Hovd IEvw== X-Gm-Message-State: AA6/9RmaWvk6zHKZ0sDlRXGrWotc6FkW34rVJYJdDLpT+9WUjBECysZxdYAS94LtuaI+mA== X-Received: by 10.194.154.227 with SMTP id vr3mr6781557wjb.127.1476565458749; Sat, 15 Oct 2016 14:04:18 -0700 (PDT) Received: from localhost.localdomain (p5DC47BBB.dip0.t-ipconnect.de. [93.196.123.187]) by smtp.gmail.com with ESMTPSA id m6sm5103756wmi.23.2016.10.15.14.04.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Oct 2016 14:04:18 -0700 (PDT) From: Samuel Martin To: buildroot@buildroot.org Date: Sat, 15 Oct 2016 23:03:43 +0200 Message-Id: <20161015210349.29432-4-s.martin49@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161015210349.29432-1-s.martin49@gmail.com> References: <20161015210349.29432-1-s.martin49@gmail.com> Subject: [Buildroot] [PATCH v5 3/9] toolchainfile.cmake: set per-config appended {C, CXX}FLAGS X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The toolchainfile.cmake file already sets the build type to get close to the Buildroot configuration. This change sets the per-config compiler flags CMake appends, so CMake does not mess up with the compilation flags Buildroot sets. This change still allows overriding the these variables from the configure command line. Note: If a CMake-based project forces using a given build type and/or force the compiler and/or linker flag definitions (the default ones or the per-config ones - e.g. CMAKE_C_FLAGS/CMAKE_C_FLAGS_{DEBUG,RELEASE}), there is not much Buildroot can do about it. So, the flags will be overwritten anyway in these cases. Cc: Arnout Vandecappelle (Essensium/Mind) Cc: Maxime Hadjinlian Signed-off-by: Samuel Martin --- changes v4->v5: - fix cmake set call changes v3->v4: - new patch --- support/misc/toolchainfile.cmake.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in index 2505256..75f3fb2 100644 --- a/support/misc/toolchainfile.cmake.in +++ b/support/misc/toolchainfile.cmake.in @@ -13,6 +13,18 @@ string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@) +# Give to CMake the {C,CXX}FLAGS to append in case the project's logic +# falls back on a build type or another (i.e. set CMAKE_{C,CXX}_FLAGS_* +# variables). +# +# Note: +# if the project forces some of these flag variables, Buildroot is +# screwed up and there is nothing Buildroot can do about that :( +set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS") +set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS") +set(CMAKE_C_FLAGS_RELEASE " -DNEBUG" CACHE STRING "Release CFLAGS") +set(CMAKE_CXX_FLAGS_RELEASE " -DNEBUG" CACHE STRING "Release CXXFLAGS") + # Build type from the Buildroot configuration set(CMAKE_BUILD_TYPE @@BR_CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration")