[CMake] Fortran name mangling
First off, I'd like to say thanks to whoever is responsible for the huge improvements in Fortran support in cmake-1.8.0. I've got most of the hdf5 Fortran testing framework essentially running smoothly on win32 intel visual fortran 11.x - no changes necessary to the default Fortran flags and detection stuff in cmake (that's close to a miracle!). However, the same cmake code gave me link errors under linux, so I tried to get the name mangling right using include(FortranCInterface) FortranCInterface_HEADER(${HDF5Fortran_BINARY_DIR}/FCMangle.h MACRO_NAMESPACE H5_FC_FUNC_ SYMBOL_NAMESPACE H5_FC_SYM_ SYMBOLS mysub mymod:my_sub) Which works out of the box under linux (intel fortran, will try PGI/Cray etc later). Superb job with the detection. Really nice, even gets the module prefixes and stuff right (module_mp_func etc). However, for unknown reasons, when I use this code on the win32 machine which is compiling the primary fortran projects happily, this happens [cid:image003.jpg@01CA6DAE.1B56F060] Now if I click through saying Yes, Yes, Yes, several times, the intermediate solution/project files do get loaded behind the scenes and the name mangling is correctly detected. But if I say No, then the try_compile phase is skiped and detection fails. (And if I navigate to the binary dir where the solution files are being created and load the projects manually, the same error is displayed) The question is, why is/are the solution files being corrupted when running in the CFortranInterface try compile stages - when other projects are generated correctly. I will do some digging to try to uncover the problem, but if someone on the core cmake team can guess what's wrong (and fix it), then thanks in advance. JB inline: image003.jpg___ 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 support for Csharp?
Joseph, You can have a look at what I am doing in GDCM. I can build the C++ library and wrap the interface using SWIG in C#. Ref: http://gdcm.sourceforge.net/ What you really want to look at are the CMake files here: http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/ or the bug report: http://cmake.org/Bug/view.php?id=7918 I used custom command, but this is still painfull to use to create the dependencies properly (for parallel make). HTH On Tue, Nov 24, 2009 at 7:06 PM, David Cole david.c...@kitware.com wrote: There has not been anything done in CMake itself related to C# development. I'm biased against putting in partial support for it without full blown generated *.csproj files that support resources, .NET strong name signatures, and everything, so it's a significant chunk of dev work. However, CMake is very good at building things via custom commands, and the C# compiler is pretty easy to get working with CMake custom commands. If you need something in the very short term, I'd recommend using custom commands. If you have a longer time frame and funding to make it happen, please contact me off-list for possible contractual arrangement to add C# support to CMake according to your schedule and funding ability. HTH, David Cole Kitware, Inc. On Tue, Nov 24, 2009 at 12:35 PM, Sarbak, Joseph joseph.sar...@rbccm.com wrote: Hello, any advice would be greatly appreciated. This question appears to have asked in the past. Has there been any new development in support for csharp? I have a project that is a mix of C, C++, and Csharp, and I would like to manage all builds from one tool: cmake. Your answers would be much appreciated. Thank you. Joe Sarbak This E-Mail (including any attachments) may contain privileged or confidential information. It is intended only for the addressee(s) indicated above. The sender does not waive any of its rights, privileges or other protections respecting this information. Any distribution, copying or other use of this E-Mail or the information it contains, by other than an intended recipient, is not sanctioned and is prohibited. If you received this E-Mail in error, please delete it and advise the sender (by return E-Mail or otherwise) immediately. This E-Mail (including any attachments) has been scanned for viruses. It is believed to be free of any virus or other defect that might affect any computer system into which it is received and opened. However, it is the responsibility of the recipient to ensure that it is virus free. The sender accepts no responsibility for any loss or damage arising in any way from its use. E-Mail received by or sent from RBC Capital Markets is subject to review by Supervisory personnel. Such communications are retained and may be produced to regulatory authorities or others with legal rights to the information. IRS CIRCULAR 230 NOTICE: TO COMPLY WITH U.S. TREASURY REGULATIONS, WE ADVISE YOU THAT ANY U.S. FEDERAL TAX ADVISE INCLUDED IN THIS COMMUNICATION IS NOT INTENDED OR WRITTEN TO BE USED, AND CANNOT BE USED, TO AVOID ANY U.S. FEDERAL TAX PENALTIES OR TO PROMOTE, MARKET, OR RECOMMEND TO ANOTHER PARTY ANY TRANSACTION OR MATTER. ___ 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 -- Mathieu ___ 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] problem with add_custom command
cmake -E tar xvf is implemented... Does this happen with other tar files, or just that one? On Tue, Nov 24, 2009 at 11:07 PM, Brian Davis bitmi...@gmail.com wrote: So I found this thread below and tried the command at the promp (Win7): cmake -E tar xvf CMake Error: Problem with tar_open(): No such file or directory CMake Error: Problem extracting tar: ${TARDIR}/mytar.tar cmake -E tar xvf openssl-0.9.8a.tar CMake Error: Problem with tar_open(): No such file or directory CMake Error: Problem extracting tar: openssl-0.9.8a.tar so I do a: CMake Error: cmake version 2.8.0 Usage: cmake -E [command] [arguments ...] Available commands: chdir dir cmd [args]... - run command in a given directory rename oldname newname- rename a file or directory (on one volume) copy file destination - copy file to destination (either file or directory) copy_if_different in-file out-file - copy file if input has changed copy_directory source destination - copy directory 'source' content to directory 'destination' compare_files file1 file2 - check if file1 is same as file2 echo [string]... - displays arguments as text echo_append [string]... - displays arguments as text but no new line environment - display the current enviroment make_directory dir- create a directory md5sum file1 [...]- compute md5sum of files remove_directory dir - remove a directory and its contents remove [-f] file1 file2 ... - remove the file(s), use -f to force it tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive time command [args] ... - run command and return elapsed time touch file- touch a file. touch_nocreate file - touch a file but do not create it. build build_dir - build the project in build_dir. write_regv key value - write registry value delete_regv key - delete registry value comspec - on windows 9x use this for RunCommand And I pay particular attention to tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive and notice no xvf option. Is tar xvf implemnted? If so why tar and no untar? Curious. Brian On 25. Mar, 2009, at 10:28, ankit jain wrote: 2009/3/25 Michael Wild themiwi-re5jqeeqqe8avxtiumw...@public.gmane.orgthemiwi-re5jqeeqqe8avxtiumw...@public.gmane.org On 25. Mar, 2009, at 9:33, ankit jain wrote: 2009/3/25 Michael Wild themiwi-re5jqeeqqe8avxtiumw...@public.gmane.orgthemiwi-re5jqeeqqe8avxtiumw...@public.gmane.org [...] What I usually do is this: add_custom_command( OUTPUT ${TARDIR}/t1 COMMAND ${CMAKE_COMMAND} -E tar xvf ${TARDIR}/mytar.tar WORKING_DIRECTORY ${TARDIR} COMMENT Extracting ${TARDIR}/mytar.tar VERBATIM ) add_custom_target( extract_mytar DEPENDS ${TARDIR}/t1 ) This tells CMake how to obtain the file ${TARDIR}/t1 by unpacking mytar.tar. Then it adds a target which depends on that file. You then can have other targets depend on that by using add_dependencies. Thanks for your suggestions it works but the problem is that iam making a library which requires some source files which will come after extracting it from tar. In that making an custom target for it and then add_dependencies to that library to this custom build target does not solve the purpose. then how to include those files which is required by the library which came from tar. if you add all the files from the tar archive to the OUTPUT list of add_custom_command, CMake should automatically set the GENERATED property of those file to TRUE. If you don't want to do that, you still can set that property manually, using e.g.: set_source_files_properties( ${TARDIR}/t1 ${TARDIR}/t2 PROPERTIES GENERATED TRUE ) you then can use those files in a normal add_library or add_executable command. if you use the first approach (listing all files in the OUTPUT list), you don't even need the custom target, since CMake then will know how to create these files (by invoking the custom command). Is there any way by which we just give the name of folder where files has extracted and add_library command will take it by some means it is becoz if we dont know what files will be genrated inside that folder or if there are large no.of files then listing them in OUTPUT is really cumbersome.. ankit you could use execute_process( COMMAND ${CMAKE_COMMAND} -E tar tf ${TARDIR}/mytar.tar OUTPUT_VARIABLE tar_files ) to get a list of files contained in the tar file. However, I don't recommend this. It is much safer to really write the files out. If it hurts your eyes to put it in the CMakeLists.txt file, you can put the list in e.g. a file called files.cmake and INCLUDE that one from your CMakeLists.txt. DON'T use file(GLOB ...) or similar. That's a pretty bad idea... Michael ___ Powered by www.kitware.com
Re: [CMake] Mac and Win32 bundling
Please do post your info here as well. On Wed, Nov 25, 2009 at 5:01 AM, Filip Wänström filip.wanst...@tii.sewrote: Just wanted to add an update: I have managed to create a stand alone MacOSX OpenSceneGraph app that works. Basically it boils down to scripting the install_name_tool to create loader_paths that points correctly. I will create an example of this and will be posting that to the osg-users mailing list. I will post it here too if that's ok? Best regards /Filip On Tue, Nov 24, 2009 at 3:23 PM, Filip Wänström filip.wanst...@tii.se wrote: Hi my name is Filip Wänström and I'm new to this list. I have recently(a few months) started to use CMake for all my building. I find that it works well in most cases and probably is the best alternative on the market. Anyway, I like to stay cross platform for my projects so I personally develop on a Mac but mostly deliver on win32. Building works fine for me (using Makefile gen for mac and VS for win) but I have huge problems with the bundling process. On the Mac I want to deliver an app using regular drag and drop as a self contained bundle and on windows I want to deliver an installer. I have managed to get a win32 installer working using the NSIS facilities but it took a lot of extra scripting. On the Mac I have been able to create the dragndrop bundle installer but it doesn't really work. I assume there are some issues with rpath/loader_path/executable_path. For reference the app is an Openscenegraph app that is dependant on quite a few libraries that need to be bundled as dll:s on win and dylibs/.so on mac. The question is: what is the current best practices approaches on these platforms? I have found no complete examples. Finally: parts of my cmake test case for win32: THis works fine and creates a usable app that bundles the osg libs as well as a plugin and data. It just doesn't feel very neat for being user code. #Basic app test (packaging exercise) SET(TARGET_BASIC_APP_SRC BasicApp.cpp BasicAppMain.cpp) ADD_EXECUTABLE(BasicApp ${TARGET_BASIC_APP_SRC} ) TARGET_LINK_LIBRARIES(BasicApp ${MY_COMMON_LIBS}) IF(WIN32 AND NOT UNIX) SET(CPACK_GENERATOR NSIS) INSTALL( TARGETS BasicApp DESTINATION bin ) SET(OSG_DLL_DIR $ENV{OSG_ROOT}\\bin) FILE(TO_CMAKE_PATH ${OSG_DLL_DIR} OSG_DLL_DIR_CPATH) SET(CMAKE_INSTALL_DEBUG_LIBRARIES) INCLUDE(InstallRequiredSystemLibraries) SET(CPACK_PACKAGE_EXECUTABLES BasicApp Basic App) CONFIGURE_FILE( ${CMAKE_MODULE_PATH}/dependencies.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake @ONLY ) INSTALL(CODE set(input_file \\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/BasicApp.exe \)) INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake) SET(OSG_PLUGINS_DIR ${OSG_DLL_DIR_CPATH}/osgPlugins-${OPENSCENEGRAPH_VERSION}) MESSAGE(Installing plugins from: ${OSG_PLUGINS_DIR}) # Extra plugin installs that the dependency checker can't find INSTALL( FILES ${OSG_PLUGINS_DIR}/osgdb_obj.dll DESTINATION bin) # Install data that uses (at runtime) the plugin above INSTALL(FILES ${Dope_SOURCE_DIR}/data/models/clogo.obj ${Dope_SOURCE_DIR}/data/models/clogo.mtl DESTINATION data/models) # Create shortcuts usin NSIS commands SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS CreateShortCut '$INSTDIRshortcut.lnk' '$INSTDIRbinBasicApp.exe' ) # Install vc90 sp1 redist # windows update broke a lot of things so lets add an vcdist dependant installer INSTALL(FILES ${Dope_SOURCE_DIR}/external/win32_vc9/win_extras/vcredist_x86.exe DESTINATION win32_extras/) SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS ExecWait '$INSTDIRwin32_extrasvcredist_x86.exe') ENDIF(WIN32 AND NOT UNIX) # dependcies.cmake.in is: if(NOT DEFINED input_file) message(FATAL_ERROR input file is not defined) endif(NOT DEFINED input_file) message(Using ${input_file}) INCLUDE(GetPrerequisites) GET_PREREQUISITES(${input_file} DEPENDENCIES 1 1 ) FOREACH(DEPENDENCY ${DEPENDENCIES}) MESSAGE(DEPENDENCY: ${DEPENDENCY}) GET_FILENAME_COMPONENT(DEPENDENCY_NAME ${DEPENDENCY} NAME) GET_FILENAME_COMPONENT(DEPENDENCY_ACTUAL ${DEPENDENCY} REALPATH) MESSAGE(DEPENDENCY_NAME: ${DEPENDENCY_NAME}) MESSAGE(DEPENDENCY_ACTUAL: ${DEPENDENCY_ACTUAL}) FIND_FILE(${DEPENDENCY_NAME}_REAL_PATH ${DEPENDENCY_NAME} ) MESSAGE(DEPENDENCY_REAL_PATH: ${${DEPENDENCY_NAME}_REAL_PATH}) MESSAGE(installing into: ${CMAKE_INSTALL_PREFIX}/bin) FILE(COPY ${${DEPENDENCY_NAME}_REAL_PATH} DESTINATION
Re: [CMake] problem with add_custom command
Works fine for me on my Mac. Can't help with Windows 7 (or rather, 6.1, but then the marketing guys at MS probably figured to round that up to 7... ;-)) as I don't have access to it. $ mkdir test $ echo Hello World test/hello.txt $ cmake -E tar cvf test.tar test drwxr-xr-x mwildstaff0 Nov 25 12:58 2009 test/ -rw-r--r-- mwildstaff 12 Nov 25 12:58 2009 test/hello.txt $ rm -rf test $ cmake -E tar xvf test.tar drwxr-xr-x mwildstaff0 Nov 25 12:58 2009 test/ -rw-r--r-- mwildstaff 12 Nov 25 12:58 2009 test/hello.txt $ cat test/hello.txt Hello World Michael On 25. Nov, 2009, at 5:07 , Brian Davis wrote: So I found this thread below and tried the command at the promp (Win7): cmake -E tar xvf CMake Error: Problem with tar_open(): No such file or directory CMake Error: Problem extracting tar: ${TARDIR}/mytar.tar cmake -E tar xvf openssl-0.9.8a.tar CMake Error: Problem with tar_open(): No such file or directory CMake Error: Problem extracting tar: openssl-0.9.8a.tar so I do a: CMake Error: cmake version 2.8.0 Usage: cmake -E [command] [arguments ...] Available commands: chdir dir cmd [args]... - run command in a given directory rename oldname newname- rename a file or directory (on one volume) copy file destination - copy file to destination (either file or directory) copy_if_different in-file out-file - copy file if input has changed copy_directory source destination - copy directory 'source' content to directory 'destination' compare_files file1 file2 - check if file1 is same as file2 echo [string]... - displays arguments as text echo_append [string]... - displays arguments as text but no new line environment - display the current enviroment make_directory dir- create a directory md5sum file1 [...]- compute md5sum of files remove_directory dir - remove a directory and its contents remove [-f] file1 file2 ... - remove the file(s), use -f to force it tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive time command [args] ... - run command and return elapsed time touch file- touch a file. touch_nocreate file - touch a file but do not create it. build build_dir - build the project in build_dir. write_regv key value - write registry value delete_regv key - delete registry value comspec - on windows 9x use this for RunCommand And I pay particular attention to tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive and notice no xvf option. Is tar xvf implemnted? If so why tar and no untar? Curious. Brian On 25. Mar, 2009, at 10:28, ankit jain wrote: 2009/3/25 Michael Wild themiwi-re5jqeeqqe8avxtiumw...@public.gmane.orgthemiwi-re5jqeeqqe8avxtiumw...@public.gmane.org On 25. Mar, 2009, at 9:33, ankit jain wrote: 2009/3/25 Michael Wild themiwi-re5jqeeqqe8avxtiumw...@public.gmane.orgthemiwi-re5jqeeqqe8avxtiumw...@public.gmane.org [...] What I usually do is this: add_custom_command( OUTPUT ${TARDIR}/t1 COMMAND ${CMAKE_COMMAND} -E tar xvf ${TARDIR}/mytar.tar WORKING_DIRECTORY ${TARDIR} COMMENT Extracting ${TARDIR}/mytar.tar VERBATIM ) add_custom_target( extract_mytar DEPENDS ${TARDIR}/t1 ) This tells CMake how to obtain the file ${TARDIR}/t1 by unpacking mytar.tar. Then it adds a target which depends on that file. You then can have other targets depend on that by using add_dependencies. Thanks for your suggestions it works but the problem is that iam making a library which requires some source files which will come after extracting it from tar. In that making an custom target for it and then add_dependencies to that library to this custom build target does not solve the purpose. then how to include those files which is required by the library which came from tar. if you add all the files from the tar archive to the OUTPUT list of add_custom_command, CMake should automatically set the GENERATED property of those file to TRUE. If you don't want to do that, you still can set that property manually, using e.g.: set_source_files_properties( ${TARDIR}/t1 ${TARDIR}/t2 PROPERTIES GENERATED TRUE ) you then can use those files in a normal add_library or add_executable command. if you use the first approach (listing all files in the OUTPUT list), you don't even need the custom target, since CMake then will know how to create these files (by invoking the custom command). Is there any way by which we just give the name of folder where files has extracted and add_library command will take it by some means it is becoz if we dont know what files will be genrated inside that folder or if there are large no.of files then listing them in OUTPUT is really cumbersome.. ankit you could use execute_process( COMMAND ${CMAKE_COMMAND} -E tar tf ${TARDIR}/mytar.tar OUTPUT_VARIABLE tar_files ) to get a
[CMake] including generated cmake-files from a ExternalPackage
Hello, I have a problem relating to ExterlalPackage I have to project (main and lib in this example) that is placed in two directories next to each other where main needs lib to be able to link. I have created a set up so that the main procject uses ExternalProject to compile lib. This works flawless but since lib is cmake based I have a export command that creates a include file that I want to use when configuring main, but since that is not created until build time I have problems with using it in main/CMakeLists.txt. A workaround I have used is distributing a empty include file so that the configure steps goes through but the linking of main fails on the first run of make, on the second cmake notices that the include file is updated and reconfigures. Anyone have any sugestions about how to solve this? Side note, I don't know if it complicates things but the builds have to be runnable in tree (no install step). Thanks in advance /jp Example files below: main/CMakeLists.txt INCLUDE(ExternalProject) INCLUDE(../lib/module_toc.cmake) add_executable(tester main.c ) target_link_libraries(tester mylib) ExternalProject_Add(mylib_a DOWNLOAD_COMMAND SOURCE_DIR ../lib CONFIGURE_COMMAND ${CMAKE_COMMAND} . BUILD_IN_SOURCE 1 INSTALL_COMMAND lib/CMakeLists.txt: PROJECT (lib) CMAKE_MINIMUM_REQUIRED (VERSION 2.6) CMAKE_POLICY (VERSION 2.6) add_library(mylib bar.c foo.c ) export( TARGETS mylib FILE module_toc.cmake ) -- jens persson j...@persson.cx Mäster Olofsväg 24 S-224 66 LUND;SWEDEN ___ 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] Fortran name mangling
Biddiscombe, John A. wrote: However, for unknown reasons, when I use this code on the win32 machine which is compiling the primary fortran projects happily, this happens [snip] The question is, why is/are the solution files being corrupted when running in the CFortranInterface try compile stages – when other projects are generated correctly. I don't think this was ever fully tested with the IDE generators. My guess is that CMake is generating a bad .vfproj file, perhaps due to the presence of both C and Fortran sources in one of the detection project targets. I'll have time next week to investigate further. -Brad ___ 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] problem with add_custom command
If you'd read on, you would see that I first CREATE a tar file, then EXTRACT it and then show that the contents have been restored. Michael On 25. Nov, 2009, at 14:56 , Brian J. Davis wrote: In your example you use cvf. This creates a tar file which is not what I want to do. I want to extract a tar file (source) and then get to configuring the build for it. What I need is xvf ... extract a tar file. http://amath.colorado.edu/computing/software/man/tar.html • Extract files from an archive (recover all the files+directories from the tar file) tar xvf archivefile.tar Brian. Michael Wild wrote: Works fine for me on my Mac. Can't help with Windows 7 (or rather, 6.1, but then the marketing guys at MS probably figured to round that up to 7... ;-)) as I don't have access to it. $ mkdir test $ echo Hello World test/hello.txt $ cmake -E tar cvf test.tar test drwxr-xr-x mwildstaff0 Nov 25 12:58 2009 test/ -rw-r--r-- mwildstaff 12 Nov 25 12:58 2009 test/ hello.txt $ rm -rf test $ cmake -E tar xvf test.tar drwxr-xr-x mwildstaff0 Nov 25 12:58 2009 test/ -rw-r--r-- mwildstaff 12 Nov 25 12:58 2009 test/ hello.txt $ cat test/hello.txt Hello World Michael On 25. Nov, 2009, at 5:07 , Brian Davis wrote: So I found this thread below and tried the command at the promp (Win7): cmake -E tar xvf CMake Error: Problem with tar_open(): No such file or directory CMake Error: Problem extracting tar: ${TARDIR}/mytar.tar cmake -E tar xvf openssl-0.9.8a.tar CMake Error: Problem with tar_open(): No such file or directory CMake Error: Problem extracting tar: openssl-0.9.8a.tar so I do a: CMake Error: cmake version 2.8.0 Usage: cmake -E [command] [arguments ...] Available commands: chdir dir cmd [args]... - run command in a given directory rename oldname newname- rename a file or directory (on one volume) copy file destination - copy file to destination (either file or directory) copy_if_different in-file out-file - copy file if input has changed copy_directory source destination - copy directory 'source' content to directory 'destination' compare_files file1 file2 - check if file1 is same as file2 echo [string]... - displays arguments as text echo_append [string]... - displays arguments as text but no new line environment - display the current enviroment make_directory dir- create a directory md5sum file1 [...]- compute md5sum of files remove_directory dir - remove a directory and its contents remove [-f] file1 file2 ... - remove the file(s), use -f to force it tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive time command [args] ... - run command and return elapsed time touch file- touch a file. touch_nocreate file - touch a file but do not create it. build build_dir - build the project in build_dir. write_regv key value - write registry value delete_regv key - delete registry value comspec - on windows 9x use this for RunCommand And I pay particular attention to tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive and notice no xvf option. Is tar xvf implemnted? If so why tar and no untar? Curious. Brian On 25. Mar, 2009, at 10:28, ankit jain wrote: 2009/3/25 Michael Wild themiwi-re5jqeeqqe8avxtiumw...@public.gmane.orgthemiwi-re5jqeeqqe8avxtiumw...@public.gmane.org On 25. Mar, 2009, at 9:33, ankit jain wrote: 2009/3/25 Michael Wild themiwi-re5jqeeqqe8avxtiumw...@public.gmane.orgthemiwi-re5jqeeqqe8avxtiumw...@public.gmane.org [...] What I usually do is this: add_custom_command( OUTPUT ${TARDIR}/t1 COMMAND ${CMAKE_COMMAND} -E tar xvf ${TARDIR}/mytar.tar WORKING_DIRECTORY ${TARDIR} COMMENT Extracting ${TARDIR}/mytar.tar VERBATIM ) add_custom_target( extract_mytar DEPENDS ${TARDIR}/t1 ) This tells CMake how to obtain the file ${TARDIR}/t1 by unpacking mytar.tar. Then it adds a target which depends on that file. You then can have other targets depend on that by using add_dependencies. Thanks for your suggestions it works but the problem is that iam making a library which requires some source files which will come after extracting it from tar. In that making an custom target for it and then add_dependencies to that library to this custom build target does not solve the purpose. then how to include those files which is required by the library which came from tar. if you add all the files from the tar archive to the OUTPUT list of add_custom_command, CMake should automatically set the GENERATED property of those file to TRUE. If you don't want to do that, you still can set that property manually, using e.g.: set_source_files_properties( ${TARDIR}/t1 ${TARDIR}/t2 PROPERTIES GENERATED TRUE ) you then can use those files in a normal add_library or add_executable command. if
Re: [CMake] cmake HEAD: cpack rpm generator seems broken on openSuse 11.2
2009/11/25 Eric Noulard eric.noul...@gmail.com: Moreover would you try to replace the current CPackRPM.cmake with the one I attach to this mail and retry with the very same CMakeLists.txt. For the list, the problem seems to be e regression due to a Fedora specific bug fix!! I did re-open that bug: http://public.kitware.com/Bug/view.php?id=9872 -- 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] problem about Fortran and C mixing
Rather than try to explain, have a look at this one I made earlier it inherits stuff from the parent project, but you should see what’s going on. http://gitorious.org/hdf5/hdf5-v18/blobs/master/fortran/CMakeLists.txt scroll down until you see #- # Setup the Fortran auto-detection utilities # H5test_kind(_SIZEOF).f90 used to generate H5fortran_detect.f90 # H5fortran_detect.f90 used to generate H5fort_type_defines.h # H5fort_type_defines.hused to generate H5f90i_gen.h + H5fortran_types.f90 #- and then you’ll see chained targets, which generate the next one. Mixing C/Fortran will be ok, - note that some of the generated files are listed as sources in the next one - this ensures that the rules are defined in succession. JB From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of ?? Sent: 24 November 2009 16:22 To: CMake List Subject: [CMake] problem about Fortran and C mixing Hi all, I have decided to mix Fortran with C, due to a library that only has C interface. Here is the scienario: suppose there are several programs, file1.f90, file2.f90, file3.c and a C library lib. 1. file1.f90 calls file2.f90 to generate a executable 2. file2.f90 calls file3.c to generate a module mod 3. file3.c calls lib so how to setup CMakeLists.txt? Thanks for Help! Best regards, DONG Li ___ 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] enable_language( ... OPTIONAL) causes error or second cmake run
Hi Alex, Maybe I'm overlooking all kinds of side effects, but the problem is in line 6 of CMakeFortranInformation.cmake, where get_filename_component() is called with an incorrect number of arguments. This happens because ${CMAKE_Fortran_COMPILER} is empty. If I simply put quotes around ${CMAKE_Fortran_COMPILER} the problem is solved. Or so it seems. Right, or wrong? Best regards, Marcel Loose. On Tue, 2009-11-24 at 19:48 +0100, Alexander Neundorf wrote: On Tuesday 24 November 2009, Marcel Loose wrote: Hi all, I've been experimenting a bit with enable_language() and stumbled upon what I think is a bug. Yes: http://public.kitware.com/Bug/view.php?id=9220 It's not trivial to make it work. Alex ___ 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] Eclipse CDT 4.0 + CMake (2.8.0)
The downside of Option #2 is that Eclipse will end up putting the .project and .cproject files in your source directory which some folks did not like, which is why they wrote the Eclise CDT generator. For me, Option #2 is worth the couple of downsides. disclaimer I also wrote the Wiki entry for option #2 so I am partial to it./disclaimer If you are using CMake with Eclipse you might want to have a look at http://cmakeed.sourceforge.net . If you _do_ use CMakeEd, please do post feedback to the CMakeEd forums on Sourceforge letting us know if you find it useful or not. disclaimer-2I helped write CMakeEd/disclaimer-2 _ Mike Jackson mike.jack...@bluequartz.net BlueQuartz Softwarewww.bluequartz.net Principal Software Engineer Dayton, Ohio On Nov 25, 2009, at 4:14 AM, Peter Kluger wrote: Hi Mike, thanks for your fast reply! After setting everything according to Option #2, further cmake calls wont overwrite my personal settings. I even added A Make Target To Run CMake which works fine as well! Thanks again, it solved my problem and you made my day :) Im sorry i didnt find the wiki-page on my own and had to bother, i just found the Option #1 Eclipse CDT4 Generator http://www.cmake.org/Wiki/Eclipse_CDT4_Generator via google search. Next time i will use the wiki-page search! Kind regards, Peter Kluger Michael Jackson wrote: You may want to try option #2 from the following page: http://www.cmake.org/Wiki/CMake:Eclipse_UNIX_Tutorial This would solve your problem as the .project and .cproject files are never actually generated. It is up to you to generate those files. But this means that you can customize the project in any way you would like and CMake will never mess with those files. I personally use this technique on a daily basis and it seems to work very well. _ Mike Jackson mike.jack...@bluequartz.net BlueQuartz Softwarewww.bluequartz.net Principal Software Engineer Dayton, Ohio On Nov 24, 2009, at 10:00 AM, Peter Kluger wrote: Hi to all, i recently start using eclipse in our project and am very happy how it works with the CMake Eclipse CDT 4.0 generator. Unfortunately, every time i recall cmake it writes the .project (+.cproject) file for eclipse and overwrites my personal settings within that file prior set, like when i set extra make parameters (../gmake -j X -k). It is kind of annoying since i have to call it every now and then and must reset those settings. I thought about writing my own script which is called after cmake and retains those settings but i figured it could be something cmake does. Maybe i overlooked a special flag i must set for cmake to keep certain settings in the project file if it already exsists but i haven't found anything related to my problem in the internetz. You could discuss if its something, eclipse shouldnt store in the project file to begin with, but i would like to have a workaround. Any help would be appreciated and thank you in advanced. -- Mit freundlichen Grüßen / Kind regards, Peter Kluger ___ Kluger Peter DevelopmentSIMPACK AG Phone: + 49 8105 77266-62 Friedrichshafener Strasse 1 Fax:+ 49 8105 77266-11 82205 Gilching, Germany E-Mail: peter.klu...@simpack.dei...@simpack.de Web:www.simpack.com Simulation Software SIMPACK - Consulting - Training ___ Executive Board: Dr. Alexander Eichberger, Dr. Lutz Mauer; Chair of Supervisory Board: Silvia Förster (CPA); Commercial Register München HRB 181 229 ___ 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 . -- Mit freundlichen Grüßen / Kind regards, Peter Kluger ___ Kluger Peter DevelopmentSIMPACK AG Phone: + 49 8105 77266-62 Friedrichshafener Strasse 1 Fax:+ 49 8105 77266-11 82205 Gilching, Germany E-Mail: peter.klu...@simpack.dei...@simpack.de Web:www.simpack.com Simulation Software SIMPACK - Consulting - Training ___ Executive Board: Dr. Alexander Eichberger, Dr. Lutz Mauer; Chair of Supervisory Board: Silvia Förster (CPA); Commercial Register München HRB 181 229 ___ Powered by www.kitware.com Visit other Kitware open-source projects at
[CMake] cmake deletes cache when source patch contains symlink to complier directory
(I tried to create a Mantis bug, but Mantis won't let me log in, and when I try to reset the password, I see This account is protected. You are not allowed to access this until the account protection is lifted. I tried creating a completely new account, and I see the same message with that.) Simple set of steps to reproduce this bug: mkdir /usr/bug_test ln -s /usr test_symlink cd test_symlink/bug_test echo project(test) CMakeLists.txt cmake -DCMAKE_C_COMPILER=/usr/bin/gcc . cmake . The bug is that the second CMake command outputs: You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. This warning is invalid because no variables were changed, and it is a problem because after CMake deletes the cache, the configuration can be hosed. The reason why for the warning and CMake deleting the cache on the second invocation is that the first invocation incorrectly saves different CMAKE_C_COMPILER paths to CMakeCache.txt and CMakeFiles/CMakeCCompiler.cmake files. The CMakeCCompiler file has the original path: SET(CMAKE_C_COMPILER /usr/bin/gcc) But the cache looks something like: CMAKE_C_COMPILER:FILEPATH=/home/russ/test_symlink/bin/gcc The reason for the discrepency is that cache path gets transformed with the SystemTools::CollapseFullPath function, while the CCompiler path uses the original path specified on the command line. This bug is difficult to work around because the SystemTools::CollapseFullPath uses logic that resolves symlinks in reverse, which is something that would require some path crawling outside of CMake. I think a safe and straightforward fix would be to make cmake use SystemTools::CollapseFullPath for the path it writes to CMakeFiles/CMakeCCompiler.cmake, but I didn't see an obvious way of implementing this, because the file is generated by CMake code, and not C++ code. I wonder if it makes sense to expose the CollapseFullPath function to CMake scripts so CMake code can use it. This bug just started happening for me recently, after my project layout changed, but I tested with a few CMake versions and the behavior is the same in CMake 2.8.0, 2.6.4, 2.6.2, and 2.6.0. I do want to say thanks to CMake developers for making this powerful and well thought-out tool. I've had my share of learning experiences with CMake but given complexity of what CMake does, I've been amazed to never have encountered any real bugs until now, and this bug just seems like an unhandled corner case. - Russ ___ 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 deletes cache when source patch contains symlink to complier directory
Hi Russ I can't claim to fully understand your explanation, but I tried your steps on Mac OS X 10.6 and CMake-2.8 and I can reproduce this error. Really, really weird stuff! Bet it took you quite some time, effort and nerves to track this one down... Michael On 25. Nov, 2009, at 17:35 , Russell Yanofsky wrote: (I tried to create a Mantis bug, but Mantis won't let me log in, and when I try to reset the password, I see This account is protected. You are not allowed to access this until the account protection is lifted. I tried creating a completely new account, and I see the same message with that.) Simple set of steps to reproduce this bug: mkdir /usr/bug_test ln -s /usr test_symlink cd test_symlink/bug_test echo project(test) CMakeLists.txt cmake -DCMAKE_C_COMPILER=/usr/bin/gcc . cmake . The bug is that the second CMake command outputs: You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. This warning is invalid because no variables were changed, and it is a problem because after CMake deletes the cache, the configuration can be hosed. The reason why for the warning and CMake deleting the cache on the second invocation is that the first invocation incorrectly saves different CMAKE_C_COMPILER paths to CMakeCache.txt and CMakeFiles/CMakeCCompiler.cmake files. The CMakeCCompiler file has the original path: SET(CMAKE_C_COMPILER /usr/bin/gcc) But the cache looks something like: CMAKE_C_COMPILER:FILEPATH=/home/russ/test_symlink/bin/gcc The reason for the discrepency is that cache path gets transformed with the SystemTools::CollapseFullPath function, while the CCompiler path uses the original path specified on the command line. This bug is difficult to work around because the SystemTools::CollapseFullPath uses logic that resolves symlinks in reverse, which is something that would require some path crawling outside of CMake. I think a safe and straightforward fix would be to make cmake use SystemTools::CollapseFullPath for the path it writes to CMakeFiles/CMakeCCompiler.cmake, but I didn't see an obvious way of implementing this, because the file is generated by CMake code, and not C++ code. I wonder if it makes sense to expose the CollapseFullPath function to CMake scripts so CMake code can use it. This bug just started happening for me recently, after my project layout changed, but I tested with a few CMake versions and the behavior is the same in CMake 2.8.0, 2.6.4, 2.6.2, and 2.6.0. I do want to say thanks to CMake developers for making this powerful and well thought-out tool. I've had my share of learning experiences with CMake but given complexity of what CMake does, I've been amazed to never have encountered any real bugs until now, and this bug just seems like an unhandled corner case. - Russ ___ 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] cmake deletes cache when source patch contains symlink to complier directory
Hi Michael, Thanks for trying this out. It wasn't too hard to debug after I noticed the discrepancy in the CMake output. The simple explanation of the bug is that when CMake runs, it writes the CMAKE_C_COMPILER value out to two different files: CMakeCache.txt CMakeFiles/CMakeCCompiler.cmake The problem is it writes out different paths to each file, because SystemTools::CollapseFullPath is called on the first path and not the second. I think a good fix would be to call CollapseFullPath on both paths, but I'm not sure how to do this because CollapseFullPath is a C++ function, and the second file isn't generated by C++. - Russ On Wed, 2009-11-25 at 18:04 +0100, Michael Wild wrote: Hi Russ I can't claim to fully understand your explanation, but I tried your steps on Mac OS X 10.6 and CMake-2.8 and I can reproduce this error. Really, really weird stuff! Bet it took you quite some time, effort and nerves to track this one down... Michael On 25. Nov, 2009, at 17:35 , Russell Yanofsky wrote: (I tried to create a Mantis bug, but Mantis won't let me log in, and when I try to reset the password, I see This account is protected. You are not allowed to access this until the account protection is lifted. I tried creating a completely new account, and I see the same message with that.) Simple set of steps to reproduce this bug: mkdir /usr/bug_test ln -s /usr test_symlink cd test_symlink/bug_test echo project(test) CMakeLists.txt cmake -DCMAKE_C_COMPILER=/usr/bin/gcc . cmake . The bug is that the second CMake command outputs: You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. This warning is invalid because no variables were changed, and it is a problem because after CMake deletes the cache, the configuration can be hosed. The reason why for the warning and CMake deleting the cache on the second invocation is that the first invocation incorrectly saves different CMAKE_C_COMPILER paths to CMakeCache.txt and CMakeFiles/CMakeCCompiler.cmake files. The CMakeCCompiler file has the original path: SET(CMAKE_C_COMPILER /usr/bin/gcc) But the cache looks something like: CMAKE_C_COMPILER:FILEPATH=/home/russ/test_symlink/bin/gcc The reason for the discrepency is that cache path gets transformed with the SystemTools::CollapseFullPath function, while the CCompiler path uses the original path specified on the command line. This bug is difficult to work around because the SystemTools::CollapseFullPath uses logic that resolves symlinks in reverse, which is something that would require some path crawling outside of CMake. I think a safe and straightforward fix would be to make cmake use SystemTools::CollapseFullPath for the path it writes to CMakeFiles/CMakeCCompiler.cmake, but I didn't see an obvious way of implementing this, because the file is generated by CMake code, and not C++ code. I wonder if it makes sense to expose the CollapseFullPath function to CMake scripts so CMake code can use it. This bug just started happening for me recently, after my project layout changed, but I tested with a few CMake versions and the behavior is the same in CMake 2.8.0, 2.6.4, 2.6.2, and 2.6.0. I do want to say thanks to CMake developers for making this powerful and well thought-out tool. I've had my share of learning experiences with CMake but given complexity of what CMake does, I've been amazed to never have encountered any real bugs until now, and this bug just seems like an unhandled corner case. - Russ ___ 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] Eclipse CDT 4.0 + CMake (2.8.0)
On Wednesday 25 November 2009, Michael Jackson wrote: The downside of Option #2 is that Eclipse will end up putting the .project and .cproject files in your source directory which some folks did not like, which is why they wrote the Eclise CDT generator. Some folks being the cmake developers. The problem is that when a project generator does that, it is not possible anymore to have multiple buildtrees for one source tree. So this is indeed something ugly. But the reason is that _eclipse_ does not work properly if the project files are not in the source directory somehow. For me, Option #2 is worth the couple of downsides. disclaimer I also wrote the Wiki entry for option #2 so I am partial to it./disclaimer In cmake 2.8.0 the support for eclipse has improved compared to 2.6.x. Now eclipse knows all the include dirs and builtin macros so completion should work better. Also It now nicely fills in all the available targets provided by the makefiles into the targets tab of Eclipse. And probably more which I can't remember right now. If you are using CMake with Eclipse you might want to have a look at http://cmakeed.sourceforge.net . If you _do_ use CMakeEd, please do post feedback to the CMakeEd forums on Sourceforge letting us know if you find it useful or not. We use it, it's nice :-) Alex ___ 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 consider pre build
Hi One Problem. There's one file in my sources that produces a cxx file in a pre build step (similar to qt_ui or moc, swig ...) But the source file isn't a h,c,cxx, file. It's a .if file thus I caonnot put this to the project source files without getting an error. Ok, but step by step... #input file: file.if #generated file: gen_file.cxx ADD_CUSTOM_COMMAND(OUTPUT gen_file.cxx PRE_BUILD COMMAND echo on \n ..\if.exe ARGS -c++ ${include_dirs} ${preProcessorDefs} -o gen_file.cxx file.if MAIN_DEPENDENCY file.if DEPENDS file.if COMMENT generating gen_file.cxx ) SET_SOURCE_FILES_PROPERTIES(gen_file.cxx PROPERTIES GENERATED 1) lets use this stuff (LINUX gxx): cmake make -- first run - generates gen_file.cxx make clean -- gen_file.cxx gets deleted becaus eit's generated make -- error: gen_file.cxx : No such file or directory On Windows with VS 200x the file.if appears in my project witout adding it explecitly. And the gen_file.cxx will be rebuild if missing. How can I ensure that the cxx is rebuilded if it's missing on Linux? Best, SirAnn -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser ___ 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] enable_language( ... OPTIONAL) causes error or second cmake run
On Wednesday 25 November 2009, Marcel Loose wrote: Hi Alex, Maybe I'm overlooking all kinds of side effects, but the problem is in line 6 of CMakeFortranInformation.cmake, where get_filename_component() is called with an incorrect number of arguments. This happens because ${CMAKE_Fortran_COMPILER} is empty. If I simply put quotes around ${CMAKE_Fortran_COMPILER} the problem is solved. Or so it seems. Right, or wrong? I think there's more to it IIRC, the rest of the enable-language process has to be canceled correctly, which is probably not the case with your fix. But please put this comment in the bugtracker, so it doesn't get lost. Alex ___ 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 consider pre build
On Wednesday 25 November 2009, Sören Freudiger wrote: Hi One Problem. There's one file in my sources that produces a cxx file in a pre build step (similar to qt_ui or moc, swig ...) But the source file isn't a h,c,cxx, file. It's a .if file thus I caonnot put this to the project source files without getting an error. Did you try that ? What error do you get ? With which generator ? If it's an extension unknown to cmake (.if should be) then I thought this was supposed to work. Alex ___ 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] get_file_name_component - how to return true extension
Yes so I did find the string regexp functions and the following seems to be working for me. For example (in case anyone else sees this thread and finds it helpful) SET( FILE_NAME openssl-0.9.8a.tar.gz ) STRING( REGEX REPLACE [.]gz FILE_NAME_NO_EXT ${FILE_NAME} ) STRING( REGEX REPLACE [.]tar FILE_NAME_NO_EXT ${FILE_NAME_NO_EXT} ) MESSAGE( STATUS File name only is ${FILE_NAME_NO_EXT} ) Displays the following in the CMake GUI output window File name only is openssl-0.9.8a STRING( REGEX REPLACE .*([.]tar).* \\1 TAR_EXT ${FILE_NAME} ) STRING( REGEX REPLACE .*([.]gz).* \\1 GZ_EXT ${FILE_NAME} ) MESSAGE( STATUS File extension is ${TAR_EXT} ) MESSAGE( STATUS File extension is ${GZ_EXT} ) Outputs: File extension is .tar File extension is .gz So TAR_EXT and GZ_EXT can be tested for and zxvf or xvf can then be used appropriately amd TAR_OPTS set accordingly. Thanks, Brian On Wed, Nov 25, 2009 at 3:24 PM, Eric Noulard eric.noul...@gmail.comwrote: 2009/11/25 Brian Davis bitmi...@gmail.com: for a given file of the form: openssl-0.9.8a.tar.gz I call as an example: get_filename_component( TAR_EXT openssl-0.9.8a.tar.gz EXT ) and I get for TAR_EXT .9.1.tar.gz you should be getting: .9.8a.tar.gz but I think it's a copy/paste typo Which is not quite what I was expecting. I was expecting .gz and with successive calls I would get .tar Is there a mechanism in CMake for getting the trailing extension? With get_filename_component I don't think so but may be you can use some string() calls. example attached. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org -- Brian J. Davis ___ 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] enable_language( ... OPTIONAL) causes error or second cmake run
Done, see Note 0018597 Best regards, Marcel Loose. On Wed, 2009-11-25 at 19:16 +0100, Alexander Neundorf wrote: On Wednesday 25 November 2009, Marcel Loose wrote: Hi Alex, Maybe I'm overlooking all kinds of side effects, but the problem is in line 6 of CMakeFortranInformation.cmake, where get_filename_component() is called with an incorrect number of arguments. This happens because ${CMAKE_Fortran_COMPILER} is empty. If I simply put quotes around ${CMAKE_Fortran_COMPILER} the problem is solved. Or so it seems. Right, or wrong? I think there's more to it IIRC, the rest of the enable-language process has to be canceled correctly, which is probably not the case with your fix. But please put this comment in the bugtracker, so it doesn't get lost. Alex ___ 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