From patchwork Sun Jun 6 12:02:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Rogers X-Patchwork-Id: 12301991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37A81C47096 for ; Sun, 6 Jun 2021 12:03:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C2F061159 for ; Sun, 6 Jun 2021 12:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbhFFMEt (ORCPT ); Sun, 6 Jun 2021 08:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhFFMEs (ORCPT ); Sun, 6 Jun 2021 08:04:48 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF044C061767 for ; Sun, 6 Jun 2021 05:02:58 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id h8so14154688wrz.8 for ; Sun, 06 Jun 2021 05:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=2ne3rB5ZdeRb8L0oPxjH/HNDLTUAEiWOIUVXHEOYdy8=; b=qGaYwV22oyxMLPVLa22pLsg7m0bax7lbXHfNZsUkBEWyWypARkW6utBzsxQv+C0JkR AWhMQDl3r/AKhwbqp9oBOsk49UD7oTGRURkDTKPV0kZw82ibfroQKwNMKIZF7jbQtJt6 OEr9vTlNLr9G5pSwe4wYxrtI4I8c4/GQauvam0Zkc4979QBqaXrfRk0ZNt0vByftvMdL 52XOSIZWdZjPDtQ+JDYdlNMTIn4G54xx4D5/U4b31/La1Wn0n9hO0TyWhck5McLorgNR nXasPjcNvQ9oi6f+MlhkL9RBcQs30YgBoE97ufRb7Hg3nX3lsiLB4zbN13ffAcAi0x2n pszA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=2ne3rB5ZdeRb8L0oPxjH/HNDLTUAEiWOIUVXHEOYdy8=; b=tN3GT8HpsK3R2rBxLUABJhcbQ+UoLnPRogejk4xjo/I69VYO9fOl/e1uQDeXPTB/7l 1Dm5t/zX9pZNVsN5H1FAu/qY2SftkAu9ZZjU3EfflVWNAkObgEDjcEqpPImITTtkC2NQ 1tli206LDDFSCGnKyhcEK1zRg/QOMy9asTXAm7EfQxWkjX5KLJ+XWhrVwb04Mrte3vIj O/MM8kMaXojWBKTnWQJ0YNic5pq88ff7gT8KT9zpUfzizk18RKI2tID4SEdq2kxDKBk5 ofwXeWX9YvKoLGOhrt8ccOmtVAu2u6AJT38u35YL471lnHkD3+CQk5i6Su+aA2wzfmAC MGDw== X-Gm-Message-State: AOAM530FHmUqvgGX7U0Kwu5tLv5sTM1qfjS//CWyzEcL6nzk9VT4alFq XGHKFLumRJFUMfb0KN3kpHLdOOn0FUI= X-Google-Smtp-Source: ABdhPJygSfVGrcqjfYa3ahtwkPe9+s8Xs1YVTbMUv9TlDYFyhm4QwCvLJqZe+IWeG01hTutZT5CDZg== X-Received: by 2002:a5d:618f:: with SMTP id j15mr7446528wru.348.1622980976670; Sun, 06 Jun 2021 05:02:56 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g23sm11651983wmk.3.2021.06.06.05.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 05:02:56 -0700 (PDT) Message-Id: <485254b49de8923f2f47e595f6882d9935e38ee1.1622980974.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 06 Jun 2021 12:02:52 +0000 Subject: [PATCH v2 1/3] cmake: add knob to disable vcpkg Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Sibi Siddharthan , Bagas Sanjaya , Matthew Rogers , Matthew Rogers Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Matthew Rogers From: Matthew Rogers When building on windows users have the option to use vcpkg to provide the dependencies needed to compile. Previously, this was used only when using the Visual Studio generator which was not ideal because: - Not all users who want to use vcpkg use the Visual Studio generators. - Some versions of Visual Studio 2019 moved away from using the VS 2019 generator by default, making it impossible for Visual Studio to configure the project in the likely event that it couldn't find the dependencies. - Inexperienced users of CMake are very likely to get tripped up by the errors caused by a lack of vcpkg, making the above bullet point both annoying and hard to debug. As such, let's make using vcpkg the default on windows. Users who want to avoid using vcpkg can disable it by passing -DNO_VCPKG=TRUE. Signed-off-by: Matthew Rogers --- contrib/buildsystems/CMakeLists.txt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index a87841340e6a..be6d9659c387 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -43,14 +43,23 @@ NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studi to use another tool say `ninja` add this to the command line when configuring. `-G Ninja` +NOTE: By default CMake will install vcpkg locally to your source tree on configuration, +to avoid this, add `-DNO_VCPKG=TRUE` to the command line when configuring. + ]] cmake_minimum_required(VERSION 3.14) #set the source directory to root of git set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) -if(WIN32) + +option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies. Only applicable to Windows platforms" ON) +if(NOT WIN32) + set(USE_VCPKG OFF CACHE BOOL FORCE) +endif() + +if(USE_VCPKG) set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg") - if(MSVC AND NOT EXISTS ${VCPKG_DIR}) + if(NOT EXISTS ${VCPKG_DIR}) message("Initializing vcpkg and building the Git's dependencies (this will take a while...)") execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat) endif() @@ -178,7 +187,9 @@ endif() find_program(MSGFMT_EXE msgfmt) if(NOT MSGFMT_EXE) - set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe) + if (USE_VCPKG) + set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe) + endif() if(NOT EXISTS ${MSGFMT_EXE}) message(WARNING "Text Translations won't be built") unset(MSGFMT_EXE) @@ -982,7 +993,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n" file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n") -if(WIN32) +if(USE_VCPKG) file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") endif() From patchwork Sun Jun 6 12:02:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Rogers X-Patchwork-Id: 12301993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26213C47096 for ; Sun, 6 Jun 2021 12:03:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AB51613DF for ; Sun, 6 Jun 2021 12:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230112AbhFFMFF (ORCPT ); Sun, 6 Jun 2021 08:05:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhFFMFE (ORCPT ); Sun, 6 Jun 2021 08:05:04 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E7F8C061766 for ; Sun, 6 Jun 2021 05:02:58 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id a20so14218957wrc.0 for ; Sun, 06 Jun 2021 05:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=HEi8+rxOPBghb+AsSj6zyh+caMylWWOo5i+0EQ+VefQ=; b=dCrm2iKSc0YGOytH6y5i2b1UASVLv5ugaFNlCshsAHL9dRaUuPinz2zuup4921TX3p OP5YOUWeJC0+xrwXuCAlXzng+pRF4rHH3HNSzGRDo76HQazNZ+2BsJ3ga0QLoblMNVNu 7IJJK+/aMFK2n80WiglLDn5viB4w/1Hh3CUyQ0QzCBGd1qcbec7PfwB7R02XNoOYqe6y 2rWkk0kJBCe4nU5ySgviUP0wrh2dqyRP0l/v/Q6kjnPWD9lbsPewmEyjZPPvtJCzDP9h JpszgvlrrLuRSuVdW2aH9CM7TwUVlmowP0LF5thYyfVSr53YLMBzLbHIZTjCGE6jLo1m fqFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=HEi8+rxOPBghb+AsSj6zyh+caMylWWOo5i+0EQ+VefQ=; b=ahsvfv7hvRGrwkSsx+5rW/qyHsifkcVwIwh5HHToSRv73Z3DTEqA5LELubamDLv2tX sVpdVOYHEvBMscOg46mQ9SEbAhbz/nBWew137tV391c7mwx5qfc+HUjQb3Hw27snmf3i CoZeilcRwdUgROGEQHxFdnBj8AdbUKcU3H8Q9PQO+CR4ytXxeI7J+U6DF4AMSo7TcOv8 deNmEuyemt3dHAk2Bs9gdvZhdEYm28YUAJxhCYIfvSSjPex/Q+CxTgWUVypL6EIsAzdk 3NuysbSxjsbQhGh7STId7FtiJQt7V/+1pT1irJXVU+ocwx0hsn8bfGuq+UL/mJFkuooM beNg== X-Gm-Message-State: AOAM532IBocpY5Z3yN0hy1FVL5w2SwfHsoHzQwE0j7O74OFxKjBds8vW FBBMFH+mDJ67AAVEBXDDBJvkTYDg2DU= X-Google-Smtp-Source: ABdhPJzMmpzB4fcSMejxXMF0HFbAl4pjfYn7qRyOgfQOdoXqmdoYwK+pgRCj63jgFZvZ+qlggee07g== X-Received: by 2002:a05:6000:10cc:: with SMTP id b12mr12482460wrx.54.1622980977207; Sun, 06 Jun 2021 05:02:57 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r2sm12515139wrv.39.2021.06.06.05.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 05:02:56 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 06 Jun 2021 12:02:53 +0000 Subject: [PATCH v2 2/3] cmake: create compile_commands.json by default Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Sibi Siddharthan , Bagas Sanjaya , Matthew Rogers , Matthew Rogers Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Matthew Rogers From: Matthew Rogers Some users have expressed interest in a more "batteries included" way of building via CMake[1], and a big part of that is providing easier access to tooling external tools. A straightforward way to accomplish this is to make it as simple as possible is to enable the generation of the compile_commands.json file, which is supported by many tools such as: clang-tidy, clang-format, sourcetrail, etc. This does come with a small run-time overhead during the configuration step (~6 seconds on my machine): Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=TRUE real 1m9.840s user 0m0.031s sys 0m0.031s Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=FALSE real 1m3.195s user 0m0.015s sys 0m0.015s This seems like a small enough price to pay to make the project more accessible to newer users. Additionally there are other large projects like llvm [2] which has had this enabled by default for >6 years at the time of this writing, and no real negative consequences that I can find with my search-skills. NOTE: That the compile_commands.json is currently produced only when using the Ninja and Makefile generators. See The CMake documentation[3] for more info. 1: https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/ 2: https://github.com/llvm/llvm-project/commit/2c5712051b31b316a9fc972f692579bd8efa6e67 3: https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html Signed-off-by: Matthew Rogers --- contrib/buildsystems/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index be6d9659c387..399a3cd6c071 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -57,6 +57,10 @@ if(NOT WIN32) set(USE_VCPKG OFF CACHE BOOL FORCE) endif() +if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS) + set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) +endif() + if(USE_VCPKG) set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg") if(NOT EXISTS ${VCPKG_DIR}) From patchwork Sun Jun 6 12:02:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Rogers X-Patchwork-Id: 12301997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29216C4743D for ; Sun, 6 Jun 2021 12:04:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07E4461408 for ; Sun, 6 Jun 2021 12:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbhFFMGC (ORCPT ); Sun, 6 Jun 2021 08:06:02 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:35530 "EHLO mail-wr1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbhFFMGA (ORCPT ); Sun, 6 Jun 2021 08:06:00 -0400 Received: by mail-wr1-f42.google.com with SMTP id m18so14173874wrv.2 for ; Sun, 06 Jun 2021 05:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=QVYidJVjvN8UjKUUznUYyJfwF6LhpwcZXlKQZ3a0M/Y=; b=XKAEh9kFc4b7VQpyv9tMgWtqgBEgAnrFsgZO4zEnLh7BwukakkkMKoNHUR8y15fful GG5TbrNPL3olPW7eduTj4Ig8mzH6LISTALXS39pEoZ3ATpJVpvFDgcfjv9DzuaxNc/2Z 8XCmNAtt/w9Q6CbbOUv9+lgIEMY2MmfNqy1dfd7TXectHrbQO4WE1z0etxMUzVfNHBIf YQ6gdl6d6csQ5ApELoAYZbQSvpMCQ/86kdqxn+5/cyd52Nsyzzp3jGu0gWxIjQSNWOgd OWqOtjDpQYsVMFs6du+lfTI7xmQGaScwax/bwxZ/1qzTiKIBqqphpIbOlu1Tu3+ncInX 3F7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=QVYidJVjvN8UjKUUznUYyJfwF6LhpwcZXlKQZ3a0M/Y=; b=W9gRtUjkmpGVsCrcbSX+BM2yke1RrBVpZKJ9h8RQ5ldk2YE4XgoK3JX7rLNIXrhO2Q 7OYbAMqi45FaEqiuFBZgUPMe/WQ96kzL6Ix9O+ZZDlnEfgXCcE5yBBPmkqOukoQfUMky KGVwhBw/JA8qz0wCWKonSy7hnp+EYdJQmGf2s9hY8+Yv3on6oLjBYXEqBauMn2/Fm6W5 g5rkcZouc/W8AFih898a2LY/c2GNWdsiyr1UnwntrFYNlyhPjN7qvwqlm9N42TF5s8An WrZxnWJd8c5MzMPPzjP8UejAL30pyE7s4z+TlbZbV/0jHCw3q9a3FtGdOXQSeALksG/i E6KA== X-Gm-Message-State: AOAM531umbFYDrFHppWv5n5dof57B5F6xYWveW/I5Dr8kBVd4qY0RHfl MZkroUfTBTLWta12aw2Iw2XacY8eAcs= X-Google-Smtp-Source: ABdhPJyMV7zCvFsjo1tToxu7bwLWj6OrfLIggDPLiYpYwNWfNhvjU+Yz2T/POqoVcHhvj/FHCmW7ZQ== X-Received: by 2002:adf:fe8c:: with SMTP id l12mr12698767wrr.26.1622980977872; Sun, 06 Jun 2021 05:02:57 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p12sm12914382wme.43.2021.06.06.05.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 05:02:57 -0700 (PDT) Message-Id: <2110c8ffa423e90224089d048291f4392aa50eab.1622980974.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 06 Jun 2021 12:02:54 +0000 Subject: [PATCH v2 3/3] cmake: add warning for ignored MSGFMT_EXE Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Sibi Siddharthan , Bagas Sanjaya , Matthew Rogers , Matthew Rogers Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Matthew Rogers From: Matthew Rogers It does not make sense to attempt to set MSGFMT_EXE when NO_GETTEXT is configured, as such add a check for NO_GETTEXT before attempting to set it. Suggested-by: Johannes Schindelin Signed-off-by: Matthew Rogers --- contrib/buildsystems/CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 399a3cd6c071..3dc7ffcd98bb 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -189,14 +189,18 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds endif() endif() -find_program(MSGFMT_EXE msgfmt) -if(NOT MSGFMT_EXE) - if (USE_VCPKG) - set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe) - endif() - if(NOT EXISTS ${MSGFMT_EXE}) - message(WARNING "Text Translations won't be built") - unset(MSGFMT_EXE) +if(NO_GETTEXT) + message(STATUS "msgfmt not used under NO_GETTEXT") +else() + find_program(MSGFMT_EXE msgfmt) + if(NOT MSGFMT_EXE) + if(USE_VCPKG) + set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe) + endif() + if(NOT EXISTS ${MSGFMT_EXE}) + message(WARNING "Text Translations won't be built") + unset(MSGFMT_EXE) + endif() endif() endif()