Re: [cmake-developers] add_custom_command changes, was [Introductions and questions]
Hi. I am only a CMake user, not a developer, but I wholeheartedly support adding the CONFIG keyword to add_custom_*(). While variations in COMMAND can be handled by generator expressions, variations in OUTPUT can't (see e.g. bug 12877). Thus, adding the CONFIG keyword would kill two (very annoying) birds with one stone. I have rather complex CMake framework at work, and this option would simplify it *tremendously.* So far, I've been working around it with EXCLUDE_FROM_DEFAULT_BUILD_CONFIG, but it's painful. Petr On Wed, Jan 29, 2014 at 11:54 PM, Steve Wilson ste...@wolfram.com wrote: On Jan 24, 2014, at 3:25 PM, Steve Wilson ste...@wolfram.com wrote: The first item I would like to see merged back to the project is issue 9974 in the Mantis tracker (CMake should support custom commands that can vary by configuration). I am the author of the original set of patches submitted in that report. I did not have time to follow up on that Mantis issue as responses developed, but can follow up now. In looking back through my changes for this issue and updating the changes for the current sources, I've realized that generator expressions in custom commands might be sufficient for my needs (my build system was initially designed in 2009 and hasn't been significantly updated for new features such as generator expressions). However there is one bug (14353) that prevents them from being fully useful. My proposed changes for add_custom_command would be the following: add_custom_command(OUTPUT output1 [output2 ...] COMMAND command1 [ARGS] [args1...] [COMMAND command2 [ARGS] [args2...] ...] [MAIN_DEPENDENCY depend] [DEPENDS [depends...]] [IMPLICIT_DEPENDS lang1 depend1 [lang2 depend2] ...] [WORKING_DIRECTORY dir] [COMMENT comment] [VERBATIM] [APPEND] [CONFIG Debug | MinSizeRel | Release | RelWithDebInfo | ...]) add_custom_command(TARGET target PRE_BUILD | PRE_LINK | POST_BUILD COMMAND command1 [ARGS] [args1...] [COMMAND command2 [ARGS] [args2...] ...] [WORKING_DIRECTORY dir] [COMMENT comment] [VERBATIM] [CONFIG Debug | MinSizeRel | Release | RelWithDebInfo | ...]) The addition of course here is the CONFIG keyword that takes a configuration argument. When add_custom_command() has a CONFIG argument, all of the commands in the custom command only get executed if the build is configured in the requisite configuration (or is selected in an IDE configuration). Currently generator expressions in custom commands cannot work for this kind of usage because of bug 14353. In 14353 generator expressions that have a space character (i.e. more content than just one word/command) don't parse correctly and thus make complex custom commands that vary by configuration impossible to construct. Is there a need for the add_custom_command() version with CONFIG? While the generator expressions make short add_custom_command() usages work quite nicely I could see the case where the generator expression syntax might become unwieldy for larger custom commands that have many COMMAND statements.I personally would not want to write: add_custom_command(... COMMAND $$CONFIG:...:... COMMAND $$CONFIG:...:... COMMAND $$CONFIG:...:... ... ) repeatedly, while having to embed my command inside the generator $$CONFIG:...:... syntax. My build systems have custom commands for Unix/Windows/etc... that require careful attention to make sure the commands execute correctly in the platform specific command interpreters and the $$ syntax would just be an extra confusing layer to have to maintain. Even though most usage cases would be fine with the generator expressions, I would still find the add_custom_command() with the CONFIG keyword useful for use with long custom commands. However, if everyone else thinks there is really no need for this form of add_custom_command, then I would stop working on re-integrating my changes into the source tree and work on 14353 instead. Opinions? -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe:
[CMake] Out-of-tree build with multiple executables for eclipse
Hello, I'm very new to CMake. I'm trying to set up an out-of-source C++ build on Windows with CMake so I can use version control with eclipse (mingw make). My setup should look like this: Root --- build --- src --- test src/ contains my program code and test/ the unit tests. There is a main method in src/ and in test/. I now want the possibility to build all the source files in src/ with Debug or Release configuration, and a seperate build target for unit tests that creates another executable with only the unit tests, but should link the source files from src/ as well. So far, I've read the articles on the Eclipse CDT4 generator ( http://www.vtk.org/Wiki/Eclipse_CDT4_Generator) and various others I have found elsewhere. I can get the build for src/ to work if I run cmake from the build folder: cmake ../src. Now I tried to get the second build target (test/) to work, but I can't get it. I tried to add a CMakeLists.txt in the Root folder which just defines the project and add the two directories, but then CMake generates the error that The build directory is a subdirectory of the source directory., which is not really true, since all the source is in src/ and build/ is a sibling... I honestly don't know what to do. Can anyone help me? Thank you, Azzu -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] include_directories(...) versus set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES ...)
Hi all, Recently I ran into a problem with a medium-large sized project with newer CMakes. At first I didn't know what was going on: a cmake run started to crawl, until it almost came to a standstill and then the OS killed my login session. It turned out that, just before being logged out forcibly by the OS, cmake was consuming a whopping 14GB(!) of RAM memory. Time for some digging. Luckily I have a number of different version of CMake lying around on my system, so it was quite easy to figure out that CMake 2.8.8 behaved normally, wheras CMake = 2.8.8 would just blow up. When I started to print some variables and properties I understood why: my list of include paths had grown ridiculously large. I won't go into detail about the setup of this specific project, but suffice it to say that include_directories() is used inside a macro that is called quite a lot in order to resolve cross-dependencies. This never was a problem, because CMake automatically performed de-duplication of include paths; until version 2.8.8. Now my question. What is the proper (or best) way to handle this. I've been thinking along the following line: replace the call to include_directories() in the offending macro with: -include_directories(${_dirs}) +list(APPEND _inc_dirs ${_dep_inc_dirs}) +list(REMOVE_DUPLICATES _inc_dirs) +set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES ${_inc_dirs}) Any suggestions or comments? Best regards, Marcel Loose. attachment: loose.vcf-- 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Reverse logic
On 2014-01-29 19:09, Rob McDonald wrote: I feel like this is a really dumb question, but I've got myself wrapped around the axel I'd like to use a negative conditional on a variable that may or may not be defined... say USE_SYSTEM_FOO So, I'd like to do something like this... IF( NOT ${USE_SYSTEM_FOO} ) # Build my own FOO ENDIF() However, this does not work as desired. On the other hand, the following version does have the desired behavior (shouldn't these be the same?). IF( ${USE_SYSTEM_FOO} ) ELSE() # Build my own FOO ENDIF() I tried a couple of combinations with DEFINED thrown in. They didn't work as desired either. I didn't chase after a compound conditional like the following simply due to ugliness IF( NOT DEFINED ${USE_SYSTEM_FOO} OR NOT ${USE_SYSTEM_FOO} ) # Build my own FOO ENDIF() Expanding somewhat on JC's reply... do you realize you wrote e.g. 'if(NOT DEFINED ON)' here? ${NAME} means before evaluating anything else, replace '${NAME}' with the value of the variable 'NAME' (or nothing, if 'NAME' is unset). Dereferencing is automatic in this context (especially 'DEFINED', which operates on a variable name). So as JC wrote, you will probably have better success omitting the dereference. -- Matthew -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] retrieving and manipulating (Fortran) dependency information
I noticed that output_required_files is deprecated. Is there a way to determine the dependencies of a Fortran source file that I can then manipulate in a CMakeLists.txt file? Fortran dependency resolution is a pain, and I need to determine dependencies for a custom target. TIA, Zaak -- 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Add support for Metro apps
Here comes a new version of this patch. In this version, ARM are also supported. Modifications include: 1. Determine MSVC ARM compiler. Cmake can determine and test VC's x86-arm compiler correctly, and mark it as cross compiling. This feature is inspired by Martell Malone's patch in http://www.cmake.org/Bug/view.php?id=13511#c32952. 2. Modify ARM's utility project to Win32 configuration. Utility projects, such as ALL_BUILD and ZERO_CHECKS, can't be win store or ARM configuration. They are changed to Win32 by default. With this patch, any configuration targeting WinRT platform should be supported. The project files can be generated, built and depolyed well. Minmin 2013-11-27 Minmin Gong minmin.g...@gmail.com: In our project, we need to build an Win8+ Metro app. Currently the CMake do support VS_WINRT_EXTENSIONS. However, if you want to build an exe instead of dll or lib, even with x86 or x64, it always fails because lacking of some tags in vcxproj and sln. The requirements about it in our project are: 1. The primary platform is x86 and x64. 2. Support both MSBuild and VS2012+ for building. So I made this patch for WinRT/Metro apps, based on the master branch of CMake. In this patch, 1. Add AppContainerApplication, ApplicationType, MinimumVisualStudioVersion and ApplicationTypeRevision tags to vcxproj when VS_WINRT_EXTENSIONS is on. 2. Recognize AppxManifest file type. 3. A dedicated boolean source file property VS_WINRT_CONTENT is added. Generator expressions is also supported here. 4. Add Deploy.0 in .sln for deploy WinRT apps by default, as WinCE apps do. 5. Add PackageCertificateKeyFile tag to vcxproj for package certification. After that, an app with x86 or x64 configuration can be correctly built an packed. Do you have some more suggestions about this feature? Thanks. -- Minmin Gong -- Minmin Gong 0001-CMake-Add-support-for-WinRT-platforms-and-metro-apps.patch Description: Binary data -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] AStyle or similar code beautifier
All, I'm interested in adding a code beautifier to my project. I'm looking at AStyle, but am open to others. Implementing a FindAStyle.cmake is pretty trivial. Likewise, implementing custom targets is pretty straightforward in the simple case. However, I thought there might be some canonical/idiomatic examples of this sort of thing. Any pointers to projects that do this particularly well? Are there any other code beautifiers that already have CMake support? Thanks, Rob -- 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://www.cmake.org/mailman/listinfo/cmake
[Cmake-commits] CMake branch, next, updated. v2.8.12.2-7354-g0222788
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project CMake. The branch, next has been updated via 02227888b572de741df035dd58f83deca21c5ff9 (commit) via 9751f292bbfe3c4de63f62c45e81ef42bea9e30f (commit) via 078e9e2c397ba25630756bc5c1c28c7262a385fb (commit) from 34d71cfc1f1c6fa93d8e2051216603098507a1e9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02227888b572de741df035dd58f83deca21c5ff9 commit 02227888b572de741df035dd58f83deca21c5ff9 Merge: 34d71cf 9751f29 Author: Eran Ifrah eran.if...@gmail.com AuthorDate: Thu Jan 30 13:26:14 2014 -0500 Commit: CMake Topic Stage kwro...@kitware.com CommitDate: Thu Jan 30 13:26:14 2014 -0500 Merge topic 'codelite-generator-multi-jobs-bug-fix' into next 9751f292 Use make's -jN switch when generating Unix/MinGW makefiles 078e9e2c CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9751f292bbfe3c4de63f62c45e81ef42bea9e30f commit 9751f292bbfe3c4de63f62c45e81ef42bea9e30f Author: Eran Ifrah eran.if...@gmail.com AuthorDate: Thu Jan 30 20:16:48 2014 +0200 Commit: Eran Ifrah eran.if...@gmail.com CommitDate: Thu Jan 30 20:16:48 2014 +0200 Use make's -jN switch when generating Unix/MinGW makefiles diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index b156691..ff84fb7 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -449,8 +449,12 @@ cmExtraCodeLiteGenerator::GetBuildCommand(const cmMakefile* mf) const buildCommand = make; } else if ( generator == MinGW Makefiles || -generator == Unix Makefiles || -generator == Ninja ) +generator == Unix Makefiles ) +{ +ss make -j this-CpuCount; +buildCommand = ss.str(); +} + else if ( generator == Ninja ) { ss make; buildCommand = ss.str(); --- Summary of changes: Source/CMakeVersion.cmake |2 +- Source/cmExtraCodeLiteGenerator.cxx |8 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits
[Cmake-commits] CMake branch, master, updated. v2.8.12.2-1293-gf35c01e
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project CMake. The branch, master has been updated via f35c01e2a5e3834094fbd98eccfc2a686872fceb (commit) from 078e9e2c397ba25630756bc5c1c28c7262a385fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f35c01e2a5e3834094fbd98eccfc2a686872fceb commit f35c01e2a5e3834094fbd98eccfc2a686872fceb Author: Kitware Robot kwro...@kitware.com AuthorDate: Fri Jan 31 00:01:05 2014 -0500 Commit: Kitware Robot kwro...@kitware.com CommitDate: Fri Jan 31 00:01:05 2014 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 60894b2..27d06e4 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 12) -set(CMake_VERSION_TWEAK 20140130) +set(CMake_VERSION_TWEAK 20140131) #set(CMake_VERSION_RC 1) --- Summary of changes: Source/CMakeVersion.cmake |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits