Re: [cmake-developers] RFC: LLVM community CMake documentation
Thank you everyone for the feedback! I’ve updated the document based on the feedback. In addition to this document I’m also working on putting together a set of coding standards/guidelines/tips that are more LLVM-specific. When I get that together I’ll also send it over here for feedback. The only comment I think I didn’t directly update the document for was Dan’s comment about GLOBAL properties. I kinda have mixed feelings about GLOBAL properties. I know why we use them, but I’m not sure I want to encourage people to use them. I think some of the places we use them is just wrong. Many thanks! -Chris CMakePrimer.rst Description: Binary data > On Apr 27, 2016, at 1:39 PM, Chris Bienemanwrote: > > Hello cmake-developers, > > Earlier this year the LLVM community finished migrating to CMake as our one > and only build system. One of the lingering things on my to-do list to help > this transition is to write some basic documentation for the CMake language > to help LLVM developers get a feel for the language. > > I’ve attached the working draft of my documentation, and would greatly > appreciate any feedback from members of the CMake community. While it is not > my goal to be a definitive source, I would like to be as accurate as I can be. > > Thank you, > -Chris > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake-developers -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [CMake 0016082]: Support alternative download URL in ExternalProject_Add
Hi there! I added that feature in the attached patch. Best regards André Klitzing From 856b9e78b00180a232d4b9d498a726489778a07d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?=Date: Thu, 28 Apr 2016 21:03:26 +0200 Subject: [PATCH] Add support for multiple/alternative URLs Now it is possible to pass multiple URLs as a list that will be tried in and foreach(). So it will try next URL if the previous failed. ExternalProject_Add(dummy URL "${FIRST_URL}" "${SECOND_URL}" "${THIRD_URL}" ) --- Modules/ExternalProject.cmake | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 9cc8a20..7e68b30 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -69,8 +69,8 @@ Create custom targets to build projects in external trees URL of mercurial repo ``HG_TAG `` Mercurial branch name, commit id or tag - ``URL /.../src.tgz`` -Full path or URL of source + ``URL /.../src.tgz /other/path/src.tgz`` +Full pathes or URLs of source. ``URL_HASH ALGO=value`` Hash of file at URL ``URL_MD5 md5`` @@ -901,8 +901,10 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p endif() file(WRITE ${script_filename} -"${hash_check}message(STATUS \"downloading... - src='${remote}' +"${hash_check} +foreach(url ${remote}) + message(STATUS \"downloading... + src='\${url}' dst='${local}' timeout='${timeout_msg}'\") @@ -910,7 +912,7 @@ ${tls_verify_code} ${tls_cainfo_code} file(DOWNLOAD - \"${remote}\" + \"\${url}\" \"${local}\" ${show_progress} ${timeout_args} @@ -921,13 +923,22 @@ list(GET status 0 status_code) list(GET status 1 status_string) if(NOT status_code EQUAL 0) - message(FATAL_ERROR \"error: downloading '${remote}' failed + message(WARNING \"downloading '\${url}' failed status_code: \${status_code} status_string: \${status_string} log: \${log} \") endif() +if(status_code EQUAL 0) + break() +endif() +endforeach() + +if(NOT status_code EQUAL 0) + message(FATAL_ERROR \"error: each download failed\") +endif() + message(STATUS \"downloading... done\") " ) -- 2.8.0 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] RFC: LLVM community CMake documentation
Hi Chris, Thanks for doing this. I've had a quick scan and I have a few minor comments. # Scripting overview This is personal preference but I don't like ``add_definitions()`` due to its global behaviour so I think its use should be discouraged. I much prefer ``target_compile_definitions()`` which isn't global. # Dereferencing One "Gotcha" I think that is worth mentioning is implicit derefencing of variables in ``if()`` conditionals for example ``` if ("${SOME_VAR}" STREQUAL "MSVC") ``` behaves very strangely because CMake will implicitly dereference "MSVC" (as if it was "${MSVC}") where as someone reading the code probably thinks that it is trying to check if the contents of the SOME_VAR as a string are "MSVC". This behaviour is prevented by setting CMP0054 to NEW but this was only introduced with CMake 3.1 and I don't think that's LLVM's minimum version so developers might hit this issue. Run ``cmake --help-policy CMP0054`` for more details. A hacky work around I employ is to write conditionals like that like this ``` if ("X${SOME_VAR}" STREQUAL "XMSVC") ``` It's not good though... # Scope You don't mention "GLOBAL" properties. IIRC LLVM's CMake code uses these so it might be worth mentioning these # LLVM specific macros/functions LLVM's CMake code pretty much avoids using many of the standard CMake commands for declaring targets favouring its own (sometimes confusingly named, e.g. add_llvm_library Vs. llvm_add_library) which I sometime find quite confusing. Seeing as this guide is aimed at LLVM developers I think this document (or an accompanying document) should describe these macros/functions. Thanks, Dan. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] RFC: LLVM community CMake documentation
Hi Chris, This is great! I do have a suggestion that perhaps Brad could weigh in on (may disagree). Since your already looking at a reasonably recent minimum requirement in your examples (3.2) and discussing bumping the minimum up to 3.4.3 even, I think it would be worthwhile to let even some of the simple examples show some of the newer language features and syntax. For example, in your lists of lists example, you currently have: foreach(list_name ${list_of_lists}) foreach(value ${${list_name}}) message(${value}) endforeach() endforeach() which has been valid CMake syntax since the days of yore, but you could show the newer syntax instead that uses the list variables directly instead of de-referencing them: foreach(list_name IN LISTS list_of_lists) foreach(value IN LISTS ${list_name}) message(${value}) endforeach() endforeach() It's of course a preference for how you want to document and use CMake in llvm but it might be good to get users started right off the bat with "new" cmake. - Chuck On Wed, Apr 27, 2016 at 4:39 PM, Chris Bienemanwrote: > Hello cmake-developers, > > Earlier this year the LLVM community finished migrating to CMake as our > one and only build system. One of the lingering things on my to-do list to > help this transition is to write some basic documentation for the CMake > language to help LLVM developers get a feel for the language. > > I’ve attached the working draft of my documentation, and would greatly > appreciate any feedback from members of the CMake community. While it is > not my goal to be a definitive source, I would like to be as accurate as I > can be. > > Thank you, > -Chris > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake-developers > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Code style auto-formatting
On 04/27/2016 07:12 PM, Daniel Pfeifer wrote: > It took a while, but i figured out .clang-format definitions (there > are two required) and a script that, after applying, does not break > compilation and unit tests. Thanks! I'll try that out myself when I get a chance. > I have attached a patch that adds the .clang-format and two other > patches that need to be applied before reformatting. Meanwhile I've applied these cleanups: CursesDialog: add missing cmState include https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb8fdcf6 Tests: add blank line between includes in StringFileTest https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29abee03 -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Integration of clang-tidy
On 04/27/2016 06:48 PM, Daniel Pfeifer wrote: > It is unrelated. Clang-Tidy picks the interesting pieces from the > compiler command line and ignores the rest. Whether cc is given or not > makes no difference. > But maybe we should leave the decision what to pick to Clang-Tidy? It > may be clearer to forward the original command line unmodified. Applied, thanks! Clang-Tidy: Give entire compiler command line to clant-tidy tool https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=304ab71d -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] RFC: LLVM community CMake documentation
On 04/27/2016 04:39 PM, Chris Bieneman wrote: > attached the working draft of my documentation Good work! Most of it looks great. Here are minor some comments. Please add a link to the cmake-language(7) manual: https://cmake.org/cmake/help/v3.5/manual/cmake-language.7.html somewhere. It has a lot of useful information, though is more of a reference than an introduction. It also has a formal grammar. > .. code-block:: console > >cmake_minimum_required(VERSION 3.2) I think you can specify "cmake" as the code block language here. CMake uses rst/sphinx for our docs and we do this frequently. > One of the few examples is PATH variables, which CMake does have some special > handling for. This special handling is for both PATH and FILEPATH and is explained at the end of this section: https://cmake.org/cmake/help/v3.5/command/set.html#set-cache-entry > CMake provides a module `CMakeParseArguments` which provides an implementation > of advanced argument parsing. FYI, in CMake 3.5 and above cmake_parse_arguments is a native command: https://cmake.org/cmake/help/v3.5/command/cmake_parse_arguments.html and the CMakeParseArguments module is an empty placeholder for compatibility. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [CMake 0016086]: Ninja generator doesn't handle multiple Mac apps using the same plist file with MACOSX_BUNDLE_INFO_PLIST
The following issue has been SUBMITTED. == https://cmake.org/Bug/view.php?id=16086 == Reported By:Florent Castelli Assigned To: == Project:CMake Issue ID: 16086 Category: CMake Reproducibility:always Severity: major Priority: normal Status: new == Date Submitted: 2016-04-28 05:37 EDT Last Modified: 2016-04-28 05:37 EDT == Summary:Ninja generator doesn't handle multiple Mac apps using the same plist file with MACOSX_BUNDLE_INFO_PLIST Description: If an app is using the same plist file using the target property MACOSX_BUNDLE_INFO_PLIST, CMake will add a dependency on that plist file as it is a template with variables that needs processing at generation time. But if multiple apps are using the same plist template, CMake will add multiple dependencies to the same file on the Re-Run target and Ninja will then warn: ninja: warning: multiple rules generate ../Info.plist.in. builds involving this target will not be correct; continuing anyway [-w dupbuild=warn] A fix would probably be to deduplicate the dependencies for rerunning CMake. == Issue History Date ModifiedUsername FieldChange == 2016-04-28 05:37 Florent CastelliNew Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers