Re: [CMake] __FILE__ relative path
Is there any way to define custom macro as given in following answer http://stackoverflow.com/questions/237542/learning-the-source-codes-filename-at-compile-time with cmake regards Vivek Goel On Tue, Dec 27, 2011 at 11:02 PM, Rolf Eike Beer wrote: > Am Dienstag, 27. Dezember 2011, 09:18:15 schrieb J Decker: > > On Tue, Dec 27, 2011 at 1:42 AM, Rolf Eike Beer wrote: > > > Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: > > >> How can I make cmake to compile source with relative path ? > > >> > > >> So that __FILE__ belongs to relative path of the file > > >> > > >> or there is another way I can replace __FILE__ with some other > variable ? > > > > relative path to what? What is it you need the path to be? > > > > > __FILE__ is implemented by the compiler, it has nothing to do with > CMake. > > > What > > Well, it does have a little to do with CMake; the variable is the > > filename passed to the compiler, which comes from cmake. > > Yes, but the compiler is free to convert it to an absolute path or do > whatever > it wants with it. > > Eike > -- > > 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] execute_process appending redirected output
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/27/11 16:16, Belcourt, Kenneth wrote: > Hi, > > I'm trying to get CMake to execute this command > > INSTALL(CODE > "EXECUTE_PROCESS (COMMAND cat \"${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt >> ${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\")" > ) > > but this doesn't work, here's the error I get when I run the install. > > cat: /home/wec_devs/bkn.cn/caslvipre/rpa/deport/onejar_classpath.txt >> /home/wec_devs/bkn.cn/caslvipre/U233_INTEL/onejar/boot-manifest.mf: No such file or directory > > I've checked that both the source and target files exist and are writable. Any ideas on how to get this to work? > > Thanks. > > -- Noel Belcourt > > > -- > > 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 It looks as thought you might be missing some escaped double-quotes. The "/home/wec_devs/bkn.cn/caslvipre/rpa/deport/onejar_classpath.txt >> /home/wec_devs/bkn.cn/caslvipre/U233_INTEL/onejar/boot-manifest.mf" is one argument in your example. Try this: INSTALL(CODE "EXECUTE_PROCESS (COMMAND cat \"${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt\" >> \"${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\")" ) It's also worth noting that this is not a cross-platform command. Maybe look at file(READ ...) followed by file(APPEND ...)? - -- Aaron Ten Clay MadeByAI Consulting -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk76sWQACgkQXXAPYyclsaVZOQCfWGoKsR/oXT7m9MmJzOnzt/l2 M1YAnjthOkhjOqlaUdEqm+XYjj/fU+oc =Z0ID -END PGP SIGNATURE- -- 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] execute_process appending redirected output
Hi, I'm trying to get CMake to execute this command INSTALL(CODE "EXECUTE_PROCESS (COMMAND cat \"${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt >> ${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\")" ) but this doesn't work, here's the error I get when I run the install. cat: /home/wec_devs/bkn.cn/caslvipre/rpa/deport/onejar_classpath.txt >> /home/wec_devs/bkn.cn/caslvipre/U233_INTEL/onejar/boot-manifest.mf: No such file or directory I've checked that both the source and target files exist and are writable. Any ideas on how to get this to work? Thanks. -- Noel Belcourt -- 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] CMake 2.8.7-rc2 ready for testing!
On 2011-12-21 20:42-0500 David Cole wrote: The CMake 2.8.7 release candidate stream continues! You can find the source and binaries here: http://www.cmake.org/files/v2.8/?C=M;O=D This will become the final build of CMake 2.8.7 next Wednesday unless somebody finds and reports a showstopping (crasher, serious behavioral regression) issue between now and then. Hi Dave: Sorry for responding so late for your call for testing. A simple test I did for PLplot seems fine, but from an additional test with FreeEOS I just discovered there is still a potentially nasty regression for FindLAPACK.cmake/FindBLAS.cmake from the good behavour we had for 2.8.5. The issue is that if I set CMAKE_LIBRARY_PATH to find a special version of lapack/blas, only the lapack part of that is honored. For example, if I set export CMAKE_LIBRARY_PATH=/home/software/lapack/install_double/lib Then here are the relevant cache results for 2.8.7 irwin@raven> grep BLAS CMakeCache.txt |grep -v ADV |grep -v NOTFOUND BLAS_atlas_LIBRARY:FILEPATH=/usr/lib/libatlas.so.3gf BLAS_f77blas_LIBRARY:FILEPATH=/usr/lib/libf77blas.so.3gf BLAS_f77blas_atlas_WORKS:INTERNAL=1 irwin@raven> grep LAPACK CMakeCache.txt |grep -v ADV | grep -v NOTFOUND LAPACK_lapack_LIBRARY:FILEPATH=/home/software/lapack/install_double/lib/liblapack.a LAPACK_lapack_WORKS:INTERNAL=1 The resulting LAPACK_LIBRARIES uncached variable is LAPACK_LIBRARIES = /home/software/lapack/install_double/lib/liblapack.a;/usr/lib/libf77blas.so.3gf;/usr/lib/libatlas.so.3gf i.e., a mixture between the very latest lapack results and older system version blas results that I don't want. This inconsistent mixture of libraries (which are for different versions of lapack/blas and probably different compile flags as well) potentially could be a complete disaster. This odd combination of libraries actually worked for my particular (FreeEOS) case, but I think that might be an artifact of building and installing only static versions of lapack/blas in the CMAKE_LIBRARY_PATH location. In comparison here are the relevant cache results for 2.8.5 irwin@raven> grep BLAS CMakeCache.txt |grep -v ADV |grep -v NOTFOUND BLAS_blas_LIBRARY:FILEPATH=/home/software/lapack/install_double/lib/libblas.a BLAS_blas_WORKS:INTERNAL=1 irwin@raven> grep LAPACK CMakeCache.txt |grep -v ADV |grep -v NOTFOUND LAPACK_lapack_LIBRARY:FILEPATH=/home/software/lapack/install_double/lib/liblapack.a LAPACK_lapack_WORKS:INTERNAL=1 The resulting LAPACK_LIBRARIES uncached variable is LAPACK_LIBRARIES = /home/software/lapack/install_double/lib/liblapack.a;/home/software/lapack/install_double/lib/libblas.a which is exactly what I want, i.e., no chance for inconsistency between lapack and blas libraries. There is probably some quick fix you can do to get FindBLAS.cmake to properly honor CMAKE_LIBRARY_PATH, but since it is so late in the release cycle there is not much chance to test such a change. Note an extreme degree of caution is warranted for changes in FindLAPACK.cmake/FindBLAS.cmake because there are so many different variants of those libraries available on various platforms. Furthermore, the new versions of FindLAPACK.cmake/FindBLAS.cmake that were introduced for 2.8.6 have already had two bugs fixed, with this additional library inconsistency issue still to be fixed. So these new versions of the find modules don't appear to be completely matured yet, and my recommendation would therefore be to revert back to the time-tested versions of FindLAPACK.cmake/FindBLAS.cmake for 2.8.5 for your 2.8.7 release, and re-introduce the new (with all known issues fixed) versions of these modules for the next release cycle to give them some additional testing before the next release. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ -- 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] __FILE__ relative path
On Tue, Dec 27, 2011 at 9:32 AM, Rolf Eike Beer wrote: > Am Dienstag, 27. Dezember 2011, 09:18:15 schrieb J Decker: >> On Tue, Dec 27, 2011 at 1:42 AM, Rolf Eike Beer wrote: >> > Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: >> >> How can I make cmake to compile source with relative path ? >> >> >> >> So that __FILE__ belongs to relative path of the file >> >> >> >> or there is another way I can replace __FILE__ with some other variable ? >> >> relative path to what? What is it you need the path to be? >> >> > __FILE__ is implemented by the compiler, it has nothing to do with CMake. >> > What >> Well, it does have a little to do with CMake; the variable is the >> filename passed to the compiler, which comes from cmake. > > Yes, but the compiler is free to convert it to an absolute path or do whatever > it wants with it. But they never do (gcc, watcom, visual studio, lcc) > > Eike > -- > > 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] __FILE__ relative path
Am Dienstag, 27. Dezember 2011, 09:18:15 schrieb J Decker: > On Tue, Dec 27, 2011 at 1:42 AM, Rolf Eike Beer wrote: > > Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: > >> How can I make cmake to compile source with relative path ? > >> > >> So that __FILE__ belongs to relative path of the file > >> > >> or there is another way I can replace __FILE__ with some other variable ? > > relative path to what? What is it you need the path to be? > > > __FILE__ is implemented by the compiler, it has nothing to do with CMake. > > What > Well, it does have a little to do with CMake; the variable is the > filename passed to the compiler, which comes from cmake. Yes, but the compiler is free to convert it to an absolute path or do whatever it wants with it. Eike signature.asc Description: This is a digitally signed message part. -- 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] __FILE__ relative path
On Tue, Dec 27, 2011 at 1:42 AM, Rolf Eike Beer wrote: > Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: >> How can I make cmake to compile source with relative path ? >> >> So that __FILE__ belongs to relative path of the file >> >> or there is another way I can replace __FILE__ with some other variable ? relative path to what? What is it you need the path to be? > > __FILE__ is implemented by the compiler, it has nothing to do with CMake. What Well, it does have a little to do with CMake; the variable is the filename passed to the compiler, which comes from cmake. > you could do is calculate the relative path inside CMake, then write it to a > file using CONFIGURE_FILE() and include that into your project. > > Eike > -- > > -- > > 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] link_directories, MSVC and $(Configuration)
Am Dienstag, 27. Dezember 2011, 16:07:46 schrieb Hauke Heibel: > Hi all, > > I am wondering whether it is intended that the link_directories is > appending the $(Configuration) sub-directory only to the last > directory when a list of directories is passed to it? > > I had to write something like > > foreach(link_dir ${LIBRARY_DIRS}) > link_directories("${link_dir}") > endforeach() > > to override the behaviour. > > Any hint is welcome. Don't use link_directories. Ever. You don't want to use it. Surely. It does not what you think it does. It only exists to create trouble, unexpected behaviour and questions to this list ;) Pass the absolute path of the files you want to link to target_link_libraries(). Use the target name if you want to link against a library you have built in your project. Eike signature.asc Description: This is a digitally signed message part. -- 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] link_directories, MSVC and $(Configuration)
Hi all, I am wondering whether it is intended that the link_directories is appending the $(Configuration) sub-directory only to the last directory when a list of directories is passed to it? I had to write something like foreach(link_dir ${LIBRARY_DIRS}) link_directories("${link_dir}") endforeach() to override the behaviour. Any hint is welcome. Kind regards, Hauke -- CMake 2.8.5 Generator: Visual Studio 10 x64 -- 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] Printing the detailed link command call
Am Dienstag, 27. Dezember 2011, 00:35:41 schrieb Aaron Ten Clay: > On 12/26/2011 6:18 AM, Ceylow wrote: > > Hello, > > > > I'm having some troubles with a linking step and I would like to see > > exactly which parameters are given to my compiler when running the > > Makefile generated by CMake. > > > > Currently it only shows: > > Linking CXX shared library xxx > > > > which isn't enough for me to find out why I have undefined symbols. I > > couldn't find any information about this on the web (maybe searching with > > the wrong words but...). > Try using 'make VERBOSE=1' instead of 'make', this will cause the > command lines to be displayed just before execution. Yes, but that doesn't help him as the linker commandline is hidden in some link.txt somewhere in CMakeFiles directory. So based on what you find out from the make you need to find the correct link.txt and look into it to find out the actual linker commandline. Eike -- signature.asc Description: This is a digitally signed message part. -- 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] __FILE__ relative path
Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: > How can I make cmake to compile source with relative path ? > > So that __FILE__ belongs to relative path of the file > > or there is another way I can replace __FILE__ with some other variable ? __FILE__ is implemented by the compiler, it has nothing to do with CMake. What you could do is calculate the relative path inside CMake, then write it to a file using CONFIGURE_FILE() and include that into your project. Eike -- signature.asc Description: This is a digitally signed message part. -- 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] __FILE__ relative path
How can I make cmake to compile source with relative path ? So that __FILE__ belongs to relative path of the file or there is another way I can replace __FILE__ with some other variable ? -- regards Vivek Goel -- 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] Printing the detailed link command call
On 12/26/2011 6:18 AM, Ceylow wrote: Hello, I'm having some troubles with a linking step and I would like to see exactly which parameters are given to my compiler when running the Makefile generated by CMake. Currently it only shows: Linking CXX shared library xxx which isn't enough for me to find out why I have undefined symbols. I couldn't find any information about this on the web (maybe searching with the wrong words but...). Thanks, Ceylo Ceylo, Try using 'make VERBOSE=1' instead of 'make', this will cause the command lines to be displayed just before execution. -Aaron -- 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