[CMake] How to iterator over a set of directories containing projects?
I have a bunch (50+) of sample programs deep in the hierarchy of my library project. Each of these samples has a similar CMakeLists.txt file, like add_executable( binning binning.cpp ) target_link_libraries( binning ${Boost_LIBRARIES} ) where binning would be the name of the sample as well as the name of the directory. I'm wondering if there would be a way to avoid authoring these similar CMakeLists.txt files and instead somehow iterate over all the projects in the CMakeLists.txt file which is one level higher in the hierarchy? Peter ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to pass -D options when compiling assembly files using gcc?
2009/7/12 Marcel Loose lo...@astron.nl: Hi Eric, Thanks, I'll try that tomorrow. Another option that occurred to me today is that, since I'm using gcc to preprocess and compile the assembly sources, I might add .S as source file extension to CMAKE_C_SOURCE_FILE_EXTENSIONS. Any idea if that might work? I really don't know. Like I said before I have no experience with ASM file and CMake nor the definition of a new compiler variant with CMake. Once you have tried a little more, I'd rather let CMake developer or CMake user with more expeperience in the field answer that one :-) -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org ___ 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://www.cmake.org/mailman/listinfo/cmake
[CMake] Globbing expression
Hello everybody, I would like to know if there exists a way to find all files in a directory with a custom file extension (e.g. *.so) except files beginning by a custom string (here libA). For example I am using the line : FILE( GLOB RESULT path/[^libA]*.so ) but the RESULT variable remains empty. Of cource I am sure of *.so files existance in the path. Has anybody already tried to glob files in a directory, excluding some file name patterns? Thank you in advance for your help. Enjoy Cmake, Arnaud. ___ 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://www.cmake.org/mailman/listinfo/cmake
[CMake] How to iterate over a set of directories containing projects?
I have a bunch (50+) of sample programs deep in the hierarchy of my library project. Each of these samples has a similar CMakeLists.txt file, like add_executable( binning binning.cpp ) target_link_libraries( binning ${Boost_LIBRARIES} ) where binning would be the name of the sample as well as the name of the directory. I'm wondering if there would be a way to avoid authoring these similar CMakeLists.txt files and instead somehow iterate over all the projects in the CMakeLists.txt file which is one level higher in the hierarchy? Peter ___ 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://www.cmake.org/mailman/listinfo/cmake ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Globbing expression
Hi Arnaud, Your mixing globbing with regular expressions. AFAIK it is not possible to do this with one statement. I would just glob for all *.so files and then use string(REGEX REPLACE ...) to replace occurrences of '^libA.* \.so' with an empty string. Best regards, Marcel Loose. On Mon, 2009-07-13 at 10:43 +0200, Arnaud Devalkeneer wrote: Hello everybody, I would like to know if there exists a way to find all files in a directory with a custom file extension (e.g. *.so) except files beginning by a custom string (here libA). For example I am using the line : FILE( GLOB RESULT path/[^libA]*.so ) but the RESULT variable remains empty. Of cource I am sure of *.so files existance in the path. Has anybody already tried to glob files in a directory, excluding some file name patterns? Thank you in advance for your help. Enjoy Cmake, Arnaud. ___ 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://www.cmake.org/mailman/listinfo/cmake ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to pass -D options when compiling assembly files using gcc?
On 13. Jul, 2009, at 10:28, Eric Noulard wrote: 2009/7/12 Marcel Loose lo...@astron.nl: Hi Eric, Thanks, I'll try that tomorrow. Another option that occurred to me today is that, since I'm using gcc to preprocess and compile the assembly sources, I might add .S as source file extension to CMAKE_C_SOURCE_FILE_EXTENSIONS. Any idea if that might work? I really don't know. Like I said before I have no experience with ASM file and CMake nor the definition of a new compiler variant with CMake. Once you have tried a little more, I'd rather let CMake developer or CMake user with more expeperience in the field answer that one :-) -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org Hi I think I remember once having seen that for such a thing the LANGUAGE property on the .S files was being set to C. Might want to give that a shot... set(ASM_SRCS foo.S bar.S) set_source_files_properties(${ASM_SRCS} PROPERTIES LANGUAGE C) Michael ___ 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://www.cmake.org/mailman/listinfo/cmake
[CMake] cdash-ctest, label property
Hello! I've just realized, that following thing doesn't work: CDash 1.4 New features Support for labels on builds, tests, coverage files * use CVS CMake/CTest and set target, test or source file property LABELS ...because there is no CTest code, which provide that information to CDash. I looked into CTest/cmCTestBuildHandler.cxx and didn't find any code, that prints Label.../Label into xml. Also, there is no Label anywhere in the sources of CTest. And in documentation too. But CDash wants to use Label element in build xml file. By the way, Label/Label shouldn't be directly inside Build/Build, you should insert wrapper element because xml_handlers/build_handler.php: 151 if($parent == 'BUILD') 152 { ... 174 } // many else if were skipped 247 else if($element == 'LABEL') 248 { 249 $this-Label-SetText($data); 250 } I think, this is a bug too. Please, correct me if I make a mistake. -- WBR, Vladimir. ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding external DLLs to installer created with CPack
2009/7/13 Tyler Roscoe ty...@cryptio.net: On Mon, Jul 13, 2009 at 12:03:32AM +0200, Robert Matusewicz wrote: everything works great except one thing. I can't fing good way to add external DLLs to the installer. in my case I need QtGui4.dll, QtOpenGL4.dll and libpng.dll. For now, I placed all those dlls into directory that I called DLL and add this install command to CMakeLists.txt install (FILES D:/DLL/QtGui4.dll D:/DLL/QtOpenGL4.dll D:/DLL/libpng.dll DESTINATION bin) But this is obvious that not all developers will want to create this folder and place in it all required DLLs. May be they don't want to install those at all? If they want I think they should be place in the same folder as the applications that are using them and not in a special folder don't you think ? So, is there any way to check where those dlls are? When do you want to check? 1) When building your software? 2) When installing it in order to avoid duplicate install? I tried to look at CMakeCPack.cmake in CMake source but didn't found anything. This isn't really an issue with CPack, so CMakeCPack.cmake isn't the right place to dig around. Agreed. The FindQt4 module (which I assume you're using since you're building a Qt app) should have a variable telling you where the libs are. Then you can just refer to those as ${QT_LIB_DIR_OR_WHATEVER_IT'S_CALLED}/QtGui4.dll, etc. FindPNG should have a similar facility. This would solve the 1) case. The 2) case may be out of the CMake/CPack scope, but more to installer scope. Let me add that including third party libraries in install is fine as long as you do not try to overwrite already installed libraries of the same kind. I would give you two small ideas: 1) make the third party lib install optional in your NSIS installer may be using CPack component support for NSIS: http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack 2) When they are installed better install your third party lib along with your own software this way you may avoid to overwrite already installed lib. 3) Checking if the required libs are already there during install may be the ultimate solution, but this may be difficult to do. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Cpack and NSIS to create installers for UAC-controlled directories under Windows Vista
2009/7/12 Linebarger, John jmli...@sandia.gov: Hello! I have a customer who is running 64-bit Windows Vista Ultimate SP2, and wants installers for 64-bit ParaView and OverView-branded applications. I am able to use NSIS to successfully build installers for 64-bit Windows Vista executables (although the installer itself is a 32-bit application because NSIS is 32-bit). However, I'm running into strange behavior actually installing the application under Vista, evidently due to UAC (User Access Controls). I can install it into C:\Program Files or C:\Program Files (x86), but when I try to run the application, it crashes with a null pointer exception. But when I install it into another directory, one that is not protected by UAC (like D:\Program Files or D:\Program Files (x86)), all is well--the application executes normally. My guess is that the application is trying to write something relative to the install directory, and crashes because UAC is preventing it. In addition, when I try to build the install target for my executable in Visual Studio, it errors when I try to install it to a UAC-controlled directory, but does not error when I try to install it to a non-UAC-controlled directory. What facilities exist in CMake/Cpack/NSIS to tame the UAC beast under Vista? I'd like for everything to just work exactly like it does under 32-bit Windows XP. My guess is that there may be two levels of issues here--one that grants privileges that UAC respects at install time, and the other that grants such privileges at run time. I think similar trouble already pops-up on the list: http://www.cmake.org/pipermail/cmake/2008-August/023576.html which points to NSIS Page: http://nsis.sourceforge.net/UAC_plug-in May be you can ask for follow-up on this, and may be even write a CMake Wiki page when it's solved :-) Good luck. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Globbing expression
Thanks a lot Marcel. Another should be : - make a second GLOB expression gathering all libraries you do not need - make a LIST( REMOVE_ITEM FIRST_GLOB_RESULT SECOND_BLOG_RESULT) but I suspect your solution is much efficient... One additionnal question : do you know how to trigger the GLOB command just before a link target handling. Because in my case, the GLOB command is running at the beginning of the compilation process, regardless the fact that I need to link to some .so's that have not been built yet. Is a custom target is a right way? Thanks again, Arnaud. On Mon, Jul 13, 2009 at 10:58 AM, Marcel Loose lo...@astron.nl wrote: Hi Arnaud, Your mixing globbing with regular expressions. AFAIK it is not possible to do this with one statement. I would just glob for all *.so files and then use string(REGEX REPLACE ...) to replace occurrences of '^libA.* \.so' with an empty string. Best regards, Marcel Loose. On Mon, 2009-07-13 at 10:43 +0200, Arnaud Devalkeneer wrote: Hello everybody, I would like to know if there exists a way to find all files in a directory with a custom file extension (e.g. *.so) except files beginning by a custom string (here libA). For example I am using the line : FILE( GLOB RESULT path/[^libA]*.so ) but the RESULT variable remains empty. Of cource I am sure of *.so files existance in the path. Has anybody already tried to glob files in a directory, excluding some file name patterns? Thank you in advance for your help. Enjoy Cmake, Arnaud. ___ 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://www.cmake.org/mailman/listinfo/cmake ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] cdash-ctest, label property
There are plenty of hits on Label if you grep in CMake/Source/CTest in CVS HEAD of CMake... There will be an article on adding labels and subproject support to your projects coming out in the next issue of the Kitware Source newsletter. To see labels in build results, you need to set the variable CTEST_USE_LAUNCHERS to ON -- with that variable on, ctest produces a different style of error and warning output such that it does not have to scrape any logs for the error information. It simply passes the full stderr and stdout of the failed tool invocation on to CDash. And with that style of error output, it's easy to assign labels based on targets (executables and libraries) to the produced errors and warnings. With the normal log scraping technique used in the past, it would be nearly impossible to tell which errors came from which targets HTH, David On Mon, Jul 13, 2009 at 6:47 AM, Vladimir Chebotarev vladimir.chebota...@gmail.com wrote: Hello! I've just realized, that following thing doesn't work: CDash 1.4 New features Support for labels on builds, tests, coverage files * use CVS CMake/CTest and set target, test or source file property LABELS ...because there is no CTest code, which provide that information to CDash. I looked into CTest/cmCTestBuildHandler.cxx and didn't find any code, that prints Label.../Label into xml. Also, there is no Label anywhere in the sources of CTest. And in documentation too. But CDash wants to use Label element in build xml file. By the way, Label/Label shouldn't be directly inside Build/Build, you should insert wrapper element because xml_handlers/build_handler.php: 151 if($parent == 'BUILD') 152 { ... 174 } // many else if were skipped 247 else if($element == 'LABEL') 248 { 249 $this-Label-SetText($data); 250 } I think, this is a bug too. Please, correct me if I make a mistake. -- WBR, Vladimir. ___ 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://www.cmake.org/mailman/listinfo/cmake ___ 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://www.cmake.org/mailman/listinfo/cmake
[CMake] Eclipse generator - basic macros
Hi I'm working on a project which builds both on linux and windows. I generated an eclipse project out of it which works basically fine but it's not able to recognize i.e. the __GNUC__ macro (and probably any other macro defined per default on gcc) are not recognized by eclipse. That means that by using a header like: #if defined(_MSC_VER) (_MSC_VER = 1300) #ifdef FLOW_DLL_EXPORT #define FLOW_DLL _declspec(dllexport) #else #define FLOW_DLL _declspec(dllimport) #endif #else #ifdef __GNUC__ #define FLOW_DLL #endif #endif and then declaring a class like: class FLOW_DLL something { }; will fool eclipse's parser. When I remove the #ifdef __GNUC__, it works. Is this an issue in the eclipse generator or in the eclipse parser? Thanks Benjamin ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to iterate over a set of directories containing projects?
On Mon, Jul 13, 2009 at 10:56:54AM +0200, Peter wrote: add_executable( binning binning.cpp ) target_link_libraries( binning ${Boost_LIBRARIES} ) where binning would be the name of the sample as well as the name of the directory. I'm wondering if there would be a way to avoid authoring these similar CMakeLists.txt files and instead somehow iterate over all the projects in the CMakeLists.txt file which is one level higher in the hierarchy? foreach (proj proj1 proj2 projN) add_executable (${proj} ${proj}.cpp) ... endforeach () Like that? tyler ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to iterate over a set of directories containing projects?
Am 13.07.2009 16:43, schrieb Tyler Roscoe: On Mon, Jul 13, 2009 at 10:56:54AM +0200, Peter wrote: I'm wondering if there would be a way to avoid authoring these similar CMakeLists.txt files and instead somehow iterate over all the projects in the CMakeLists.txt file which is one level higher in the hierarchy? foreach (proj proj1 proj2 projN) add_executable (${proj} ${proj}.cpp) ... endforeach () Like that? tyler Exactly, thanks a lot. Looks so easy when the solution is shown.Funny that I could not figure that ou myself. Peter ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Starting with Cmake
2009/7/12 Tyler Roscoe ty...@cryptio.net I hope this is a real email address. Posting from a fake one is sketchy. On Sat, Jul 11, 2009 at 06:04:48PM -0700, ML wrote: 1. Is there a doc that describes the 'bare essentials' to a CMake file. What I absolutely need to have in the file. I think there's one somewhere on the wiki, and there are other examples that google will find. The _Mastering CMake_ book has a tutorial chapter that is helpful but not essential. 2. Can I call my Cmake file anything? Or do I have to call it CMakeLists.txt? You can call it something else but I wouldn't recommend it. Actually I'm not sure if add_subdirectory() will take a file name (but it might). 3. Can CMake check out code from SVN? 4. Can CMake e-mail build results to a specified e-mail address? You'll probably want to use CDash for these types of activities. CDash is sort of an automation/continuous integration wrapper for CMake. It has its own website, but it integrates nicely with CMake. 5. Say I have something like: SET(SRCS file1.c file2.c file3.c) Can I write this like: SET(SRCS / file1.c / file2.c / file3.c ) Like one file name per line like I can do in a gnu Make File? What about a long command line in ADD_CUSTOM_COMMAND? Can I break it into multiple lines? I'm not sure why you put those / in there (did you mean \ ?) but CMake is pretty tolerant of whitespace. Just write: set (srcs file1.c file2.c file3.c ) 6. In Make I would define all of my headers too, would I do the same as #5 above? How does the my Add_Executable statement? This isn't necessary in CMake, although it does make those headers available for IDE users. You just add them right alongside the source files: add_executable (${sources} ${headers}). 7. How do I tell Cmake to compile to a static library like a .a or .so or .dll? add_library() takes STATIC and SHARED flags. hth, tyler ___ 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://www.cmake.org/mailman/listinfo/cmake ___ 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Starting with Cmake
If you only quote the interesting part, it makes the thread easier to read. On Tue, Jul 14, 2009 at 11:46:51AM +0800, Dong Tiger wrote: 5. Say I have something like: SET(SRCS file1.c file2.c file3.c) Can I write this like: SET(SRCS / file1.c / file2.c / file3.c ) Like one file name per line like I can do in a gnu Make File? I'm not sure why you put those / in there (did you mean \ ?) but CMake is pretty tolerant of whitespace. Just write: set (srcs file1.c file2.c file3.c ) What about a long command line in ADD_CUSTOM_COMMAND? Can I break it into multiple lines? I would just try it and see what happens. CMake will usually tell you pretty quickly if you've gotten something really wrong. But yes, CMake ignores whitespace unless you do something weird like try to quote it, like this: . tyler ___ 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://www.cmake.org/mailman/listinfo/cmake