[CMake] Appending paths to a variable
I have a structure where I include all subdirs via FILE(GLOB.. and FOREACH and within each subdir CMakeLists.txt I want to add a path to be used with INCLUDE_DIRECTORIES in the main CMakeLists.txt I tried SET(INCL_DIRS ${INCL_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include) but the INCL_DIRS variable is empty when I get back to the main CMakeLists.txt file... How to? TIA /R ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Appending paths to a variable
Hello, On 2/20/08, Robert Bielik [EMAIL PROTECTED] wrote: I have a structure where I include all subdirs via FILE(GLOB.. and FOREACH and within each subdir CMakeLists.txt I want to add a path to be used with INCLUDE_DIRECTORIES in the main CMakeLists.txt I tried SET(INCL_DIRS ${INCL_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include) but the INCL_DIRS variable is empty when I get back to the main CMakeLists.txt file... How to? To retrieve a variable from a subdirectory (added via ADD_SUBDIRECTORY), you have to do something like: GET_DIRECTORY_PROPERTY (MYVAR DIRECTORY subdirectory DEFINITION INCL_DIRS) Have a look at cmake documentation for more info about GET_DIRECTORY_PROPERTY. Regards, TIA /R ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Olivier DOLE Software Engineer ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] ctest - how to set environment
On Tuesday, 19. February 2008 19:20:46 Philip Lowman wrote: What you're looking for to the best of my knowledge doesn't exist in CMake. I would file a feature request on the bugtracker for it. There probably should be a way for declaring custom environment variables and associating them with tests scheduled with ADD_TEST (the PATH environment variable for Windows comes to mind as one possible use case). done If you're using the makefile generator you can obviously just declare environment variables prior to running your tests. If you're using Visual Studio to execute your tests you're probably out of luck here. Best bet would be to revert to testing them in command line mode: I tried 'set( ENV{ICU_DATA} foo )' with the same result (variable not set within test session). (or for Unix/Makefile generator using bash) [EMAIL PROTECTED]:~/build$ export foo=bar(Unix, bash) [EMAIL PROTECTED]:~/build$ ctest Yes, this is the way it works. But it's not very comfortable. 'make test' would be much easier than 'make depend;export foo=bar;ctest'. Especially if there where more than one environment variable to be set. Thanks, Jörg ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Where to put own FindXXX.cmake
Hi all, I sometimes have to define my own Findxxx.cmake, or update the ones coming with the package. I leave them or put them in the Modules directory. However, when I want to update my CMake version, I guess the files in the Modules directory are deleted or replace by the ones in the new distribution. So, I would like to know how can I set something in CMake to give it another directory to search for my own Findxxx.cmake. Best regards, Olivier ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] ctest - how to set environment
If you use ctest scripts (http://www.cmake.org/Wiki/CMake_Scripting_Of_CTest ) like this one from vtk: http://www.vtk.org/Testing/Sites/hythloth.kitware/Linux-gcc41/20080220-0300-Nightly/Notes.html You can set the CTEST_ENVIRONMENT as it does: # set any extra envionment variables here SET (CTEST_ENVIRONMENT DISPLAY=:50 CC=gcc-4.1 CXX=g++-4.1 CFLAGS=-Wall -W CXXFLAGS=-Wall -W -Woverloaded-virtual -Wunused -Wno-deprecated LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ) Also, the ctest scripts specify all of the cmake cache options for your project. itk ( http://www.itk.org/Testing/Dashboard/MostRecentResults-Nightly/Dashboard.html ) and vtk ( http://www.vtk.org/Testing/Dashboard/MostRecentResults-Nightly/Dashboard.html ) both make extensive use of ctest scripting. On these dashboards, click on the text icon next to the build name to see (for most builds) the ctest script that is used to create that configure/build/test submission. Bill On Wed, Feb 20, 2008 at 10:28 AM, Jörg Becker [EMAIL PROTECTED] wrote: On Tuesday, 19. February 2008 19:20:46 Philip Lowman wrote: What you're looking for to the best of my knowledge doesn't exist in CMake. I would file a feature request on the bugtracker for it. There probably should be a way for declaring custom environment variables and associating them with tests scheduled with ADD_TEST (the PATH environment variable for Windows comes to mind as one possible use case). done If you're using the makefile generator you can obviously just declare environment variables prior to running your tests. If you're using Visual Studio to execute your tests you're probably out of luck here. Best bet would be to revert to testing them in command line mode: I tried 'set( ENV{ICU_DATA} foo )' with the same result (variable not set within test session). (or for Unix/Makefile generator using bash) [EMAIL PROTECTED]:~/build$ export foo=bar(Unix, bash) [EMAIL PROTECTED]:~/build$ ctest Yes, this is the way it works. But it's not very comfortable. 'make test' would be much easier than 'make depend;export foo=bar;ctest'. Especially if there where more than one environment variable to be set. Thanks, Jörg ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] absolute rpath
Hi, I'm wondering if there is a possibility to set relative rpaths with cmake. For our windows people I have to deliver everything with rpath '.', so they can copy all shared objects into the bin directory and everything works (like on windows) without changing any path or environment variable. I understand the problems using relative paths within the cmake process (while configuration and compilation) and I don't have any problem with that. But installing a program means leaving cmake and entering the real world. And here it should be possible to use relative (r)paths. Up to know I used make and automake. Both allowed me to set relative rpaths. I really want to leave the automake hell and use cmake, but I have to use 'rpath .'. Thanks for any suggestion, Jörg ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Where to put own FindXXX.cmake
This is what I do: Inside the top level of your Project directory create a Resources folder. Then in your top level CMakeLists.txt file add the following: # Look in our Resources FIRST for FindXXX modules SET (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${CMAKE_MODULE_PATH} ) Works for me. Not _real_ scalable depending on how many projects you have using the same modules. You could have your own modules directory located somewhere on your system and then just use the above but set the path to your own modules directory.. Mike Jackson On Wed, Feb 20, 2008 at 10:48 AM, Olivier Tournaire [EMAIL PROTECTED] wrote: Hi all, I sometimes have to define my own Findxxx.cmake, or update the ones coming with the package. I leave them or put them in the Modules directory. However, when I want to update my CMake version, I guess the files in the Modules directory are deleted or replace by the ones in the new distribution. So, I would like to know how can I set something in CMake to give it another directory to search for my own Findxxx.cmake. Best regards, Olivier ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] ctest - how to set environment
On Wednesday, 20. February 2008 16:48:39 Bill Lorensen wrote: You can set the CTEST_ENVIRONMENT as it does: As I wrote in my first mail, I'm failed using CTEST_ENVIRONMENT inside a CMakeLists.txt. I have not tried this in a special ctest script because I'm searching for lean solution. Which means write a 'CMakeList.txt' once, run 'cmake' once and be able to run 'make test' for every change on my software. My problem is: there is make test target, I want to use it, but all tests fail because of the missing environment variables. Maintaining a ctest script besides the CMakeLists.txt is too much effort for my current purpose. As described in http://www.cmake.org/Wiki/CMake_Testing_With_CTest Simple Testing (The easiest way to create CTest input files is using CMake.), I just want to generate / call the tests within the build process (with the existing test target), and not define/maintain a parallel build/test process. Jörg ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] ctest - how to set environment
You could detect that your desired env vars are empty in your CMakeLists.txtand have CMake emit an error. IF($ENV{my_env_var} STREQUAL ) MESSAGE(FATAL_ERROR error: required env var not set - please set my_env_var in your environment before running cmake/make/make test) ENDIF($ENV{my_env_var} STREQUAL ) Then at least all your developers would know early on that they have to set env vars before running your cmake/make/make test sequence. On 2/20/08, Jörg Becker [EMAIL PROTECTED] wrote: On Wednesday, 20. February 2008 16:48:39 Bill Lorensen wrote: You can set the CTEST_ENVIRONMENT as it does: As I wrote in my first mail, I'm failed using CTEST_ENVIRONMENT inside a CMakeLists.txt. I have not tried this in a special ctest script because I'm searching for lean solution. Which means write a 'CMakeList.txt' once, run 'cmake' once and be able to run 'make test' for every change on my software. My problem is: there is make test target, I want to use it, but all tests fail because of the missing environment variables. Maintaining a ctest script besides the CMakeLists.txt is too much effort for my current purpose. As described in http://www.cmake.org/Wiki/CMake_Testing_With_CTest Simple Testing (The easiest way to create CTest input files is using CMake.), I just want to generate / call the tests within the build process (with the existing test target), and not define/maintain a parallel build/test process. Jörg ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] absolute rpath
Am Mittwoch 20 Februar 2008 schrieb Alexander Neundorf: On Wednesday 20 February 2008, Jörg Becker wrote: Hi, ... I used make and automake. Both allowed me to set relative rpaths. I really want to leave the automake hell and use cmake, but I have to use 'rpath .'. Use: set_target_properties(hello PROPERTIES INSTALL_RPATH . ) (I think usually this is not considered a good idea) Windows searches in '.' for DLLs by default. You don't have to do anything to achieve that. HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Cmake 2.4.8 dependencies
It's possible to have ctest submit dashboard data files using the xml-rpc protocol. That's why the dependency is there. Not sure how often used that feature is. On 2/20/08, pepone. onrez [EMAIL PROTECTED] wrote: Hi Why CMake-2.4.8 requires xml-rpc package? Can any body explains why this package is needed to build CMake. I can view the reason for this depency inside CMake, but when installing CMake from gentoo portage it require xml-rpc to be instaled with curl or libwww enabled. Thanks ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] GLOB segmentation fault
On Tue, Feb 19, 2008 at 9:49 PM, Alexander Neundorf [EMAIL PROTECTED] wrote: Yes, crashes with 2.4.6, works with cvs. Can you please check with 2.4.8 ? I updated to 2.4.8 crash still reproducible here is the output [EMAIL PROTECTED] ~/kk/cmake-glob-bug/build $ cmake --version cmake version 2.4-patch 8 [EMAIL PROTECTED] ~/kk/cmake-glob-bug/build $ cmake ../ -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Check size of void* -- Check size of void* - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works Segmentation fault [EMAIL PROTECTED] ~/kk/cmake-glob-bug/build $ gdb cmake GNU gdb 6.7.1 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i486-pc-linux-gnu... (no debugging symbols found) Using host libthread_db library /lib/libthread_db.so.1. (gdb) run .. Starting program: /usr/bin/cmake .. (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Check size of void* -- Check size of void* - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works Program received signal SIGSEGV, Segmentation fault. 0x081978eb in cmsys::RegularExpression::find () (gdb) bt #0 0x081978eb in cmsys::RegularExpression::find () #1 0x08196956 in cmsys::Glob::ProcessDirectory () #2 0x08196c75 in cmsys::Glob::FindFiles () #3 0x0811c7c0 in cmFileCommand::HandleGlobCommand () #4 0x0811e87c in cmFileCommand::InitialPass () #5 0x0812f948 in cmCommand::InvokeInitialPass () #6 0x080e23f1 in cmMakefile::ExecuteCommand () #7 0x080e4384 in cmMakefile::ReadListFile () #8 0x0816d13e in cmLocalGenerator::Configure () #9 0x08175398 in cmLocalUnixMakefileGenerator3::Configure () #10 0x08156721 in cmGlobalGenerator::Configure () #11 0x08109b2b in cmake::Configure () #12 0x0810d4bd in cmake::Run () #13 0x080d3988 in do_cmake () #14 0x080d3c34 in main () (gdb) ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Cmake 2.4.8 dependencies
Hi Why CMake-2.4.8 requires xml-rpc package? Can any body explains why this package is needed to build CMake. I can view the reason for this depency inside CMake, but when installing CMake from gentoo portage it require xml-rpc to be instaled with curl or libwww enabled. Thanks ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] absolute rpath
On Wednesday 20 February 2008, Jörg Becker wrote: Hi, ... I used make and automake. Both allowed me to set relative rpaths. I really want to leave the automake hell and use cmake, but I have to use 'rpath .'. Use: set_target_properties(hello PROPERTIES INSTALL_RPATH . ) (I think usually this is not considered a good idea) Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Cmake 2.4.8 dependencies
On Wednesday 20 February 2008, pepone.onrez wrote: Force us to depend in xml-rpc is a bad thing tm. I think most users never needs this feature. But in the way that is used i'm force to install it in any way. Do you mean you have to install xmlrpc ? Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Cmake 2.4.8 dependencies
On Wed, Feb 20, 2008 at 7:42 PM, Alexander Neundorf [EMAIL PROTECTED] wrote: Do you mean you have to install xmlrpc ? At least using the gentoo ebuild you need to have xmlrpc with curl or libwww enabled before you can emerge cmake 2.4.8 in cmake-2.4.6 this isn't necessary. maybe the error is on the gentoo ebuild not sure with this point. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Appending paths to a variable
To retrieve a variable from a subdirectory (added via ADD_SUBDIRECTORY), you have to do something like: GET_DIRECTORY_PROPERTY (MYVAR DIRECTORY subdirectory DEFINITION INCL_DIRS) Have a look at cmake documentation for more info about GET_DIRECTORY_PROPERTY. Thanks Olivier, that was what I was looking for. However, I found that it was easier to accomplish what I wanted with INCLUDE(...) instead. /R ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] ctest - how to set environment
David Cole wrote: As I wrote in my first mail, I'm failed using CTEST_ENVIRONMENT inside a CMakeLists.txt. I have not tried this in a special ctest script because I'm searching for lean solution. Which means write a 'CMakeList.txt' once, run 'cmake' once and be able to run 'make test' for every change on my software. My problem is: there is make test target, I want to use it, but all tests fail because of the missing environment variables. Maintaining a ctest script besides the CMakeLists.txt is too much effort for my current purpose. As described in http://www.cmake.org/Wiki/CMake_Testing_With_CTest Simple Testing (The easiest way to create CTest input files is using CMake.), I just want to generate / call the tests within the build process (with the existing test target), and not define/maintain a parallel build/test process. So, this whole issue has to do with cmake time vs build time. As long as cmake is a running process then you can set env vars. When that process is over then the env is gone. One thing you could do is have your test be run by a cmake script. So, you would wrap your tests in some cmake script that set the environment variable. The scripts would use execute_process to run the tests, and -D options to the script to pass options to your test. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] ctest - how to set environment
Really we need to implement set_property(TEST testname ENVIRONMENT bah=foo;fu=bar;display=:0.0) and have ctest honor it which really should be pretty easy just a matter of coding it up. The property stuff is already there and gets passed to the test in ctest. CTest just has to look for that property and do some setenv calls. Ken Ken Martin PhD Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 -Original Message- From: [EMAIL PROTECTED] [mailto:cmake- [EMAIL PROTECTED] On Behalf Of Bill Hoffman Sent: Wednesday, February 20, 2008 2:21 PM To: David Cole Cc: cmake@cmake.org Subject: Re: [CMake] ctest - how to set environment David Cole wrote: As I wrote in my first mail, I'm failed using CTEST_ENVIRONMENT inside a CMakeLists.txt. I have not tried this in a special ctest script because I'm searching for lean solution. Which means write a 'CMakeList.txt' once, run 'cmake' once and be able to run 'make test' for every change on my software. My problem is: there is make test target, I want to use it, but all tests fail because of the missing environment variables. Maintaining a ctest script besides the CMakeLists.txt is too much effort for my current purpose. As described in http://www.cmake.org/Wiki/CMake_Testing_With_CTest Simple Testing (The easiest way to create CTest input files is using CMake.), I just want to generate / call the tests within the build process (with the existing test target), and not define/maintain a parallel build/test process. So, this whole issue has to do with cmake time vs build time. As long as cmake is a running process then you can set env vars. When that process is over then the env is gone. One thing you could do is have your test be run by a cmake script. So, you would wrap your tests in some cmake script that set the environment variable. The scripts would use execute_process to run the tests, and -D options to the script to pass options to your test. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Pass variables to sub directory CMakeLists.txt
Hi, I want to pass a variable to CMakeLists.txt's in sub directories: Top directory CMakeLists.txt: set( VAR1 ) add_subdirectory (subdir1) add_subdirectory (subdir2) Each subdir CMakeLists.txt: ... set( VAR1 ${VAR1} extend_var1 ) ... I use VAR1 later on in the linker. How can I make this work? Kind regards, Sander. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake