Re: [CMake] [EXTERNAL] Re: execute_process appending redirected output
On Dec 30, 2011, at 8:05 PM, Michael Hertling wrote: On 12/28/2011 05:39 PM, Belcourt, K. Noel wrote: Hi Aaron, On Dec 27, 2011, at 11:04 PM, Aaron Ten Clay wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/27/11 16:16, Belcourt, Kenneth wrote: 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. I've checked that both the source and target files exist and are writable. Any ideas on how to get this to work? It looks as thought you might be missing some escaped double-quotes. I've tried quite a few quoting permutations, none work. INSTALL(CODE EXECUTE_PROCESS (COMMAND cat \${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt\ \${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\) ) Unfortunately this doesn't work. AFAIK, this is because EXECUTE_PROCESS() doesn't fork a shell to run the COMMANDs, so the redirection operators like are meaningless. It's also worth noting that this is not a cross-platform command. Yup, we're a unix only shop. Then use one of the premier *nix tools: INSTALL(CODE EXECUTE_PROCESS(COMMAND sh -c \cat \\\${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt\\\ \\\${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf)) Eek, that's a lot of quoting. I found a workaround but thanks for this, I may use it if opportunity arises in the future. Perhaps this: AFAIK, this is because EXECUTE_PROCESS() doesn't fork a shell to run the COMMANDs, so the redirection operators like are meaningless. could be entered into the documentation somewhere as this is important to know. Thanks for the help Michael. -- Noel -- 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] [EXTERNAL] Re: execute_process appending redirected output
Hi Aaron, On Dec 27, 2011, at 11:04 PM, Aaron Ten Clay wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/27/11 16:16, Belcourt, Kenneth wrote: 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. I've checked that both the source and target files exist and are writable. Any ideas on how to get this to work? It looks as thought you might be missing some escaped double-quotes. I've tried quite a few quoting permutations, none work. INSTALL(CODE EXECUTE_PROCESS (COMMAND cat \${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt\ \${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\) ) Unfortunately this doesn't work. It's also worth noting that this is not a cross-platform command. Yup, we're a unix only shop. Maybe look at file(READ ...) followed by file(APPEND ...)? Looks promising, I'll check this out. Thanks for the help Aaron. -- Noel -- 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] Patch CMake for Mac static library creation
Hi, This is a long overdue followup. On Dec 4, 2010, at 12:10 PM, Belcourt, K. Noel wrote: On Dec 4, 2010, at 10:08 AM, Ryan Pavlik wrote: You can configure this for your project: http://www.cmake.org/cmake/help/cmake-2-8- docs.html#prop_tgt:STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS are passed to the archiver. On the Mac, I need to run ranlib after ar runs, and pass flags (-c) to ranlib. Another other ideas how to achieve this? Thanks. -- Noel This doesn't seem to do what I want it to. In my CMakeLists.txt file I have this code. ADD_LIBRARY(modules ${SRCS}) set_target_properties(modules PROPERTIES static_library_flags -noel) but my bogus option never appears anywhere, and I am creating a static archive library for this target. Also, it seems this flag is geared more to passing flags to ar, not to ranlib (at least there's been some discussion about using it to pass -X 64 to ar on AIX). Note that I've also tried this approach. -D CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib -c resulting in this error. /usr/bin/ranlib -c libmodules.a Error running link command: No such file or directory make[2]: *** [Modules/libmodules.a] Error 2 Naturally omitting the quotes silently drops the -c option. -- Noel -- 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] Patch CMake for Mac static library creation
On Nov 4, 2011, at 3:56 PM, Belcourt, K. Noel wrote: This is a long overdue followup. On Dec 4, 2010, at 12:10 PM, Belcourt, K. Noel wrote: On Dec 4, 2010, at 10:08 AM, Ryan Pavlik wrote: You can configure this for your project: http://www.cmake.org/cmake/help/cmake-2-8- docs.html#prop_tgt:STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS are passed to the archiver. On the Mac, I need to run ranlib after ar runs, and pass flags (-c) to ranlib. Another other ideas how to achieve this? If I use a custom command like this (physics is the name of the static library): add_custom_command(TARGET physics POST_BUILD COMMAND ranlib -c) I get this error when it tries to run. /usr/bin/ranlib -c libphysics.a Error running link command: No such file or directory make[2]: *** [libs/test/physics/libphysics.a] Error 2 Because the quoted command includes the argument. Any ideas? -- Noel -- 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] Using name other than CMakeLists.txt
Hi, Our multi-physics project depends on product build systems using both stock CMake 2.8.x and an incompatible fork of CMake which also (re)uses the CMake standard project filename (CMakeLists.txt). We need the ability to build this code base with both stock CMake and the CMake fork. We recognize the potential problems with this arrangement but we need to support both of these build capabilities for a while. I'd like to propose a patch that would replace all character literal occurrences of CMakeLists.txt in the CMake source code base with a variable that defaults to CMakeLists.txt, but permit that variable to be configured to a different name when running CMake. This would allow, for example, our project to contain both stock CMakeLists.txt files as well as other CMake project files such as CMakeLists.Trilinos. We could then configure this project with the Trilinos CMake build variant by running CMake like this: cmake -D CMAKE_PROJECT_FILENAME=CMakeLists.Trilinos ... where CMAKE_PROJECT_FILENAME is the new CMake variable. We've found this capability useful for our code coupling environment permitting use of a new CMake build variant while retaining use of the stock CMake build. Is there any interest in adding this capability to CMake? -- 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
[CMake] CDash documentation
Hi, This page http://public.kitware.com/Wiki/CDash:Installation says php 5.3 is required while this page http://www.cdash.org/cdash/resources/software.html says php 5.2 or higher. Which one is it (I'm installing it on a OSX 10.5.8 in case that matters. -- Noel ___ 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] Conditional post test behavior
Hi, I apologize if this has been asked and answered. Is there a way to execute some commands after a test has run where the commands can be different depending on whether the test passes or not? Here's my test. add_test( NAME ex7_2_fmelcor WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND fmelcor.x ex7_variant2.inp ) Because these tests generate enormous files (in both quantity and size) and run for very long times (days in some cases) I want all generated files to be deleted after the test runs, but only if the test passes. If the test fails, I need to leave the files around so I can use them to debug the test. So can I conditionally call this file remove function only if the test passes? file(REMOVE ${Ex7_2_Files}) Is there CMake support for this that I'm not seeing or is this even possible? -- Noel ___ 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] Patch CMake for Mac static library creation
On Dec 4, 2010, at 10:08 AM, Ryan Pavlik wrote: You can configure this for your project: http://www.cmake.org/cmake/help/cmake-2-8- docs.html#prop_tgt:STATIC_LIBRARY_FLAGS Thanks Ryan, I'll try it out. -- Noel ___ 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] Patch CMake for Mac static library creation
Hi Ryan, On Dec 4, 2010, at 10:08 AM, Ryan Pavlik wrote: You can configure this for your project: http://www.cmake.org/cmake/help/cmake-2-8- docs.html#prop_tgt:STATIC_LIBRARY_FLAGS This doesn't seem to do what I want it to. In my CMakeLists.txt file I have this code. ADD_LIBRARY(modules ${SRCS}) set_target_properties(modules PROPERTIES static_library_flags -noel) but my bogus option never appears anywhere, and I am creating a static archive library for this target. Also, it seems this flag is geared more to passing flags to ar, not to ranlib (at least there's been some discussion about using it to pass -X 64 to ar on AIX). Note that I've also tried this approach. -D CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib -c resulting in this error. /usr/bin/ranlib -c libmodules.a Error running link command: No such file or directory make[2]: *** [Modules/libmodules.a] Error 2 Naturally omitting the quotes silently drops the -c option. -- Noel ___ 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] Patch CMake for Mac static library creation
Hi, I'm on Mac OSX 10.5.8 with Intel 12.x compilers and CMake version 2.8.3. CMake doesn't seem to add the -c option to the ranlib command to include common symbols into the library table of contents. Here's the documentation for Apple's ranlib. -c Include common symbols as definitions with respect to the table of contents. This is seldom the intended behavior for linking from a library, as it forces the linking of a library member just because it uses an uninitialized global that is undefined at that point in the linking. This option is included only because this was the original behavior of ranlib. This option is not the default. This behavior is necessary if you have Fortran 90 modules that define data but that don't contain any code (or contains code that isn't called). Can -c be added by default when creating static Fortran libraries on the Mac using ranlib? 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] Fortran 90 modules not rebuilt
On Nov 16, 2010, at 1:59 PM, Brad King wrote: Hi Noel, On 11/16/2010 01:11 PM, K. Noel Belcourt wrote: I've attached my project's top-level Makefile. I'm trying to force all the modules in the project to build first so I created a single library called modules that contains all my Fortran 90 module files. I'm invoking the Makefile explicitly passing the modules as the target to build (so I can build a clean project in two steps: make modules ; make) What CMake code are you using to create this modules target? The modules CMakeLists.txt is attached. The Fortran module dependencies implementation is hidden inside the Makefile generators. There is no API to access any of its timestamp files or scanning rules. I'm not doing anything special. -- Noel # Author K. Noel Belcourt set( MODULES_DIR ${MELCOR_SRC_DIR}/Modules ) set( DCH_DIR ${MELCOR_SRC_DIR}/DCH ) set( SNAP_DIR ${MELCOR_SRC_DIR}/SNAPAdapter ) set( EXEC_DIR ${MELCOR_SRC_DIR}/exec ) set( UTIL_DIR ${MELCOR_SRC_DIR}/Util ) set( H2C_DIR ${MELCOR_SRC_DIR}/H2C ) # uncomment next line to enable Pardiso solver # add_definitions(-DMKL) SET(SRCS ${MODULES_DIR}/M_Arguments.f90 ${MODULES_DIR}/M_BONUS.f90 ${MODULES_DIR}/M_BONUS_MELCOR.f90 ${MODULES_DIR}/M_BUR_SC.f90 ${MODULES_DIR}/M_Bur.f90 ${MODULES_DIR}/M_CAV.f90 ${MODULES_DIR}/M_CAVProp.F90 ${MODULES_DIR}/M_CAV_SC.f90 ${MODULES_DIR}/M_CF-TF.f90 ${MODULES_DIR}/m_cleanstop.f90 ${MODULES_DIR}/M_COR.f90 ${MODULES_DIR}/M_COR_SC.f90 ${MODULES_DIR}/M_COR_Variant.f90 ${MODULES_DIR}/M_CVH.f90 ${MODULES_DIR}/M_CVHFP.f90 ${MODULES_DIR}/M_CVH_SC.f90 ${MODULES_DIR}/M_Const.f90 ${MODULES_DIR}/M_DCH.f90 ${MODULES_DIR}/M_DCH_SC.f90 ${MODULES_DIR}/M_Debug.F90 ${MODULES_DIR}/M_DefaultFlagGlobals.f90 ${MODULES_DIR}/M_dif2.f90 ${MODULES_DIR}/M_DisplayConfiguration.F90 ${MODULES_DIR}/M_Drop.f90 ${MODULES_DIR}/M_EDF.f90 ${MODULES_DIR}/M_ESF.f90 ${MODULES_DIR}/M_ESF_SC.f90 ${MODULES_DIR}/M_EXEC.f90 ${MODULES_DIR}/m_execrtn.f90 ${MODULES_DIR}/M_FDI.f90 ${MODULES_DIR}/M_FDI_SC.f90 ${MODULES_DIR}/M_FP.f90 ${MODULES_DIR}/M_H2O.f90 ${MODULES_DIR}/M_H2OD1.f90 ${MODULES_DIR}/M_H2OD2.f90 ${MODULES_DIR}/M_H2OD3.f90 ${MODULES_DIR}/M_H2OD4.f90 ${MODULES_DIR}/M_H2O_SC.f90 ${MODULES_DIR}/M_HS.f90 ${MODULES_DIR}/M_HS_SC.f90 ${MODULES_DIR}/M_Input.f90 ${MODULES_DIR}/M_isnan.f90 ${MODULES_DIR}/M_kind.f90 ${MODULES_DIR}/M_MP.f90 ${MODULES_DIR}/M_MatCVH.f90 ${MODULES_DIR}/M_MatFP.f90 ${MODULES_DIR}/M_Matrix.f90 ${MODULES_DIR}/M_Melcor.F90 ${MODULES_DIR}/M_MELCOR-MACCS.F90 ${MODULES_DIR}/M_NCG.f90 ${MODULES_DIR}/M_NCG_SC.f90 ${MODULES_DIR}/M_Package.f90 ${MODULES_DIR}/m_packagertn.f90 ${MODULES_DIR}/M_parallel.f90 ${MODULES_DIR}/M_Plot.f90 ${MODULES_DIR}/M_PreFormat.f90 ${MODULES_DIR}/M_PreProcess.F90 ${MODULES_DIR}/M_RN1.F90 ${MODULES_DIR}/M_RN1_SC.f90 ${MODULES_DIR}/m_RstGlobals.f90 ${MODULES_DIR}/M_RW_Restart.f90 ${MODULES_DIR}/M_SHsupport.f ${MODULES_DIR}/M_SPR.f90 ${MODULES_DIR}/M_SPR_SC.f90 ${MODULES_DIR}/M_SouCVH.f90 ${MODULES_DIR}/M_StrCmp.f90 ${MODULES_DIR}/M_StrUp.f90 ${MODULES_DIR}/M_TP.f90 ${MODULES_DIR}/M_Table.f90 ${MODULES_DIR}/M_timer.f90 ${MODULES_DIR}/M_Values.f90 ${MODULES_DIR}/M_isnan.f90 ${MODULES_DIR}/M_util.F90 ${MODULES_DIR}/m_easymessage.F90 # # files from here down copied in from other directories # ${SNAP_DIR}/CSnapFacesM.f90 ${DCH_DIR}/DCH_RW.F90 ${DCH_DIR}/ElemDB.F90 ${UTIL_DIR}/ExecSuspend.f90 ${UTIL_DIR}/FileRoutines.f90 ${UTIL_DIR}/OutputTiming.f90 ${EXEC_DIR}/replace.f90 ${UTIL_DIR}/string.f90 ${SNAP_DIR}/SnapGlobal.f90 ${UTIL_DIR}/PARDISO3_NSI.f90 ) ADD_LIBRARY(modules ${SRCS}) target_link_libraries(modules bonus h2c rn1 rn2) ___ 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 90 modules not rebuilt
On Nov 16, 2010, at 2:05 PM, Belcourt, K. Noel wrote: On Nov 16, 2010, at 1:59 PM, Brad King wrote: On 11/16/2010 01:11 PM, K. Noel Belcourt wrote: I've attached my project's top-level Makefile. I'm trying to force all the modules in the project to build first so I created a single library called modules that contains all my Fortran 90 module files. I'm invoking the Makefile explicitly passing the modules as the target to build (so I can build a clean project in two steps: make modules ; make) The Fortran module dependencies implementation is hidden inside the Makefile generators. There is no API to access any of its timestamp files or scanning rules. What's interesting is that in a project that's fully update to date, running the make modules command gives this curious output: S896822:tools kbelco$ make modules [ 16%] Built target util [ 19%] Built target tp [ 25%] Built target spr [ 35%] Built target rn2 [ 61%] Built target rn1 [ 61%] Built target mp [100%] Built target modules which is the same list of libraries in these SUBDIRS commands in the top-level CMakeLists.txt file (in reverse order). There's a single library in each of these subdirs of the same lower-cased name. ... SUBDIRS(Modules) SUBDIRS(MP) SUBDIRS(Rn1) SUBDIRS(RN2) SUBDIRS(SPR) SUBDIRS(TP) SUBDIRS(Util) So it looks like the subdirs command plays a role in this behavior. -- Noel ___ 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 90 modules not rebuilt
On Nov 16, 2010, at 2:50 PM, Brad King wrote: On 11/16/2010 04:24 PM, Belcourt, K. Noel wrote: which is the same list of libraries in these SUBDIRS commands in the top-level CMakeLists.txt file (in reverse order). There's a single library in each of these subdirs of the same lower-cased name. ... SUBDIRS(Modules) SUBDIRS(MP) SUBDIRS(Rn1) SUBDIRS(RN2) SUBDIRS(SPR) SUBDIRS(TP) SUBDIRS(Util) So it looks like the subdirs command plays a role in this behavior. Is this built on a case-insensitive filesystem by any chance? I get the same behavior on HFS+ Journaled on my Mac and my RHEL5 Linux blade. -- Noel ___ 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 90 modules not rebuilt
On Nov 16, 2010, at 2:48 PM, Eric Noulard wrote: 2010/11/16 Belcourt, K. Noel kbe...@sandia.gov: On Nov 16, 2010, at 2:05 PM, Belcourt, K. Noel wrote: On Nov 16, 2010, at 1:59 PM, Brad King wrote: On 11/16/2010 01:11 PM, K. Noel Belcourt wrote: I've attached my project's top-level Makefile. I'm trying to force all the modules in the project to build first so I created a single library called modules that contains all my Fortran 90 module files. I'm invoking the Makefile explicitly passing the modules as the target to build (so I can build a clean project in two steps: make modules ; make) The Fortran module dependencies implementation is hidden inside the Makefile generators. There is no API to access any of its timestamp files or scanning rules. What's interesting is that in a project that's fully update to date, running the make modules command gives this curious output: S896822:tools kbelco$ make modules [ 16%] Built target util [ 19%] Built target tp [ 25%] Built target spr [ 35%] Built target rn2 [ 61%] Built target rn1 [ 61%] Built target mp [100%] Built target modules which is the same list of libraries in these SUBDIRS commands in the top-level CMakeLists.txt file (in reverse order). Is there any reason you are using SUBDIRS instead of ADD_SUBDIRECTORY? No, didn't know about this SUBDIRS is deprecated and as far as I remember it has a different search-ordering than add_subdirectory Good to know. try replacing your SUBDIRS with add_subdirectory. Will do. -- Noel ___ 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