[CMake] File permissions issue
Hi all, I couldn't find much information either on Google or the Wiki or elswhere, so I post my questions here. We are using Cmake under Linux and have experienced some difficulties with CMake due to the multi-user-environment in Linux. In one run, CMake generates files with different file-permissions, eg. in $CMAKE_CURRENT_BINARY_DIR/CMakeFiles a file 'progress.make' with group-permissions set to ReadOnly, whereas a file 'Makefile.cmake' with group-permissions set to ReadWrite. This makes it impossible to have User A to configure and run make, and another User B to run re-configure, even if both users are within the same group of users. I took a look at the CMake 2.8.0 sourcecode and tracked it down to Source/kwsys/ProcessUNIX.c in function kwsysProcessSetupOutputPipeFile I believe. I wonder why CMake sets the permissions explicitly to 644 here. Is this a bug or done intentionally? Greetings, Johannes Felten ___ 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 version of FindMPI
On 11. Jan, 2010, at 22:26 , Moreland, Kenneth wrote: > I have a simple Fortran program that uses MPI that I am trying to configure > with CMake. The problem is that although the FindMPI module finds the C > libraries for MPI, it does not find the Fortran libraries. To get around > this I copied the FindMPI.cmake from the CMake distribution and did some > edits and a few search-and-replaces to find the Fortran version of the > library. It seems to work well enough on my system (using OpenMPI) with the > exception of finding some system 64-bit libraries (which is actually caused > by a CMake bug that I just submitted a report for > http://www.paraview.org/Bug/view.php?id=10119). The module is attached. Is > there any interest in placing this with the CMake distribution or integrating > into the existing FindMPI module? > > -Ken > Hi Ken Wouldn't this be a good case to use COMPONENTS? E.g. find_package(MPI COMPONENTS C) or find_package(MPI COMPONENTS Fortran). If nothing is specified, the default could be to look at global ENABLED_LANGUAGES property and go on from there and discover all components that are listed in there (i.e. C, CXX or Fortran). Michael ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] what is the right way to set CMAKE_USE_RELATIVE_PATHS?
>> There are lots of questions on this CMake variable and the consensus is DO >> NOT USE IT. PERIOD. The implementation is basically broken for all but the >> most trivial case. > >I can tell you one thing. If the original idea of this was an attempt >to create a CMake free build that will not work. These comments agree with the way my software group has used CMake on a daily basis for the past 6 or 7 years (or more?). For our project, with a couple thousand source code files in a few dozen directories, it only takes a minute for CMake to generate our VC++ project files, and we make heavy use of out-of-source builds and different relative paths to source code files, all of which says you'd be crazy to rely on relative paths in the project files. Every once in a while, though, we get some pushback from our parent group, for whom my software project is just one subcomponent of a larger system. For example, today a very influential member of the larger team complained that he can't attach a debugger to our project on one of the test machines because we don't use relative paths in our project files (unlike "everyone else"). Supposedly he can take the source code directory of any other subsystem (including all its VCPROJ files with their relative paths to everything), drop it onto an arbitrary directory on the test machine, open up VC++ and attach the debugger to a running executable of that subsystem. I don't know if relative paths would even work in our case, but it would be very helpful if I could just twiddle some setting in my top-level CMakeLists.txt, produce a version of the project files with all relative paths, and either solve this guy's problem or show him that relative paths aren't the answer after all. NOT having the ability (or at least know-how) to generate projects with relative paths, I leave someone with an unsolved problem that seems to be my fault (because my group keeps on using CMake) and increases the risk that I'll eventually be forced to go back to using individually-crafted VCPROJ files for everything, which IMHO would be a huge step backward in my development process. As a result, even though it's been years since I've even THOUGHT about using relative paths, I'm temporarily setting CMAKE_USE_RELATIVE_PATHS in a copy of my source tree to see what happens. So far, though, it doesn't seem to help much. The paths to libraries that are given by relative paths in CMakeLists.txt seem to stay relative paths rather than being converted to absolute, but all the source files are still identified by absolute paths regardless. David ___ 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] ExternalProject_Add inserting " around *'s "
I found the source of the error: ExternalProject.cmake (line 583) add_custom_command( OUTPUT ${stamp_dir}${cfgdir}/${name}-${step} COMMENT ${comment} COMMAND ${command} COMMAND ${touch} DEPENDS ${depends} WORKING_DIRECTORY ${work_dir} VERBATIM ) nix VERBATIM, and all is well Hope this helps others from wasting hours of their life as I have. Cheers, Tim On Thu, Jan 7, 2010 at 10:45 PM, Tim St. Clair wrote: > For whatever command I am using if I insert a wild card to be passed in e.g. > > INSTALL_COMMAND cp blah/* ${MY_STAGING} > > becomes cp "blah/*" > > which will then yield an error. > > Is there some escape sequence I'm missing to avoid the quoting? > > -- > Cheers, > Timothy St. Clair > -- Cheers, Timothy St. Clair ___ 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] "rule" to generate assembler listings for each c file
On Monday 11 January 2010, Arne Pagel wrote: > > Are you sure you really need that ? > > If you enter "make help" in the directory of your target, you will see > > that there are also rules for building the object files foo.o and also > > for just generating the assembler files (foo.s). > > I.e. you can manually enter "make ...path/foo.s" and this will produce > > the assembler file for you so you can look at it. > > > > From my experience this is the typical use case: if something goes > > wrong, look at the assembler file of the file in question and check > > whether it makes sense. Do you need it for something else ? > > Well, with the compiler Flags I will not have just an assembler file *.s, > then I have a list file with more debug information like high level > language comments, symbols an so on. Well, you can set the CMAKE_(C|CXX)_CREATE_ASSEMBLY_SOURCE variable so that it contains all the flags you need for the listfile. 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] using cmake on windows - query on existing targets
> > I understand what you mean and it is similar to what the macro suggested > > by Alex does. > > However, I do not want a developer to have a need to change setting in > > the cmake GUI for what I need. > > > > What I want is that: > > 1. the user should be able to see a list of components & sub-components, > > using a command from the cmd window from the location where the cmake > > GUI has generated the build files. > > Did you try the Nmake generator and call > > nmake help > Thanks, I tried using nmake generator i.e. - cmake ../ -G "NMake Makefiles"- but it does not work in cmake 2.8. It fails to find the compiler. However the command - cmake ../ -G "Visual Studio 9 2008" - works fine. The errors I get are as: -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set CMAKE_RC_COMPILER to a valid compiler path or name. -- Check for CL compiler version -- Check for CL compiler version - failed -- Check if this is a free VC compiler -- Check if this is a free VC compiler - yes -- Check CL platform -- Check CL platform - 64 bit -- Using FREE VC TOOLS, NO DEBUG available -- Check for working C compiler: cl CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeRCInformation.cmake:22 (GET_FILENAME_COMPONENT): get_filename_component called with incorrect number of arguments Call Stack (most recent call first): C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE) C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE) CMakeLists.txt:2 (PROJECT) CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Check for working C compiler: cl -- broken CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE): The C compiler "cl" is not able to compile a simple test program. It fails with the following output: CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:4 (project) CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: your CXX compiler: "cl" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name. -- Configuring incomplete, errors occurred! > > 2. the user should be able to choose a sub-component to build without > > asking to build the whole component. Also, I do not want to be > > generating build files every time I choose to build a different > > sub-component. > > nmake subcomponent I will try once I get nmake generation to work. > > > Is this possible? > > > > Please note that I am on windows. I guess this is easily possible on > > Linux. As make allows you to query a list of targets & can build > > specific targets as well. Please correct me if I am wrong. > > I bet nmake should support more or less the same set > of target than unix make, but since I'm not a experienced Windows user > I may be wrong. > > If the Nmake generator does not suit your need may be the MSYS Makefile would? > > > -- > 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] "rule" to generate assembler listings for each c file
Hi Luca, thank you for the idea, I will try it. It looks if this could help me, even if I don't understand every command in detail. I think I wouldn't have brought this out with reading the docs. best regards Arne Luca Cappa schrieb: Hi Arne, I think this cmake script shows what you need to do to add a compiler flag for each source file. It adds a dummy flag "/flagadded:FILE_NAME" for each source file according to its name. project(flags_per_file) cmake_minimum_required(VERSION 2.6) set(SOURCES x1.c x2.c x3.c) add_executable(executable ${SOURCES}) foreach(FILE ${SOURCES}) set_source_files_properties (${FILE} PROPERTIES COMPILE_FLAGS "/flagadded:${FILE}") message("${FILE} -->> /flagadded:${FILE}") endforeach(FILE in ${SOURCES}) ___ 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] error while stage install of crosscompiled binaries
On Thursday 07 January 2010, Claus Klein wrote: > Hi > > i want to install a cross compiled (build host is a MAC OS X) project > to a temporary state dir to get an archive to distribute the binaries. > The target is win32 (mingw), compiled to be installed at c:/usr as > CMAKE_INSTALL_PREFIX. > This prefix is used while compile the binaries, so I can't change it. > > I think, that when I use DESTDIR while "make DESTDIR=/tmp/cmake > install", the device (C:) should be removed before to use it as part > of a path like this: > > STRING(REGEX REPLACE "[A-Za-z:/]" "" CMAKE_INSTALL_PREFIX "$ > {CMAKE_INSTALL_PREFIX}") > > head cmake_install.cmake > # Install script for directory: /Users/clausklein/Workspace/c/libsmi/ > trunk > # > # Set the install prefix > IF(NOT DEFINED CMAKE_INSTALL_PREFIX) >SET(CMAKE_INSTALL_PREFIX "C:/usr") > ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) > STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "$ > {CMAKE_INSTALL_PREFIX}") > . . . . > > As you can see, PREFIX is appended to DESDIR without modification. > which is wrong in this special case. > I am not sure if the file is wrong generated or called with wrong > parameters? > > > Any ideas about this? > > //regards > > Claus > -- > > This happens on my Mac Os X: > claus-kleins-macbook-pro:build clausklein$ make DESTDIR=/tmp/cmake > install > [ 30%] Built target smi > [ 34%] Built target smidiff > [ 87%] Built target smidump > [ 90%] Built target smilint > [ 94%] Built target smiquery > [100%] Built target smixlate > Install the project... > -- Install configuration: "Release" > CMake Error at cmake_install.cmake:31 (FILE): >file cannot create directory: >/tmp/cmake/Users/clausklein/Workspace/c/libsmi/trunk/build/C:/usr/ I guess the actual issue is that "C:/usr" is not recognized as absolute path, since on UNIX/OSX it is none, but on the target OS it would be one. I never tried setting CMAKE_INSTALL_PREFIX to a relative path. Ok, just tried it: hammer:~/src/CMake/tests/relativeinstallprefix$ cat CMakeLists.txt add_executable(foo main.c) install(TARGETS foo DESTINATION bin ) hammer:~/src/CMake/tests/relativeinstallprefix$ cmake -DCMAKE_INSTALL_PREFIX=rela/foo . -- Check for working C compiler: /usr/bin/gcc ... -- Configuring done -- Generating done -- Build files have been written to: /home/alex/src/CMake/tests/relativeinstallprefix hammer:~/src/CMake/tests/relativeinstallprefix$ make install Scanning dependencies of target foo [100%] Building C object CMakeFiles/foo.dir/main.o Linking C executable foo [100%] Built target foo Install the project... -- Install configuration: "" -- Installing /home/alex/src/CMake/tests/relativeinstallprefix/rela/foo/bin/foo hammer:~/src/CMake/tests/relativeinstallprefix$ So indeed a relative CMAKE_INSTALL_PREFIX is interpreted relative to the build dir. Do you think this should be handled differently ? Then c:/usr would have to be translated at some point to "/c:/usr" if cross compiling on some UNIX. Would this make sense ? 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] "rule" to generate assembler listings for each c file
> Are you sure you really need that ? > If you enter "make help" in the directory of your target, you will see that > there are also rules for building the object files foo.o and also for just > generating the assembler files (foo.s). > I.e. you can manually enter "make ...path/foo.s" and this will produce the > assembler file for you so you can look at it. > > From my experience this is the typical use case: if something goes wrong, look > at the assembler file of the file in question and check whether it makes > sense. Do you need it for something else ? Well, with the compiler Flags I will not have just an assembler file *.s, then I have a list file with more debug information like high level language comments, symbols an so on. But you are right, at the moment I have always a list file of the last changed file, I can control it easily with a dummy change. I didn't know the make help target, thank you for that hint. But the solution Luca suggest looks very interesting, I will try it out and look if it works. Best regards Arne ___ 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] Fortran version of FindMPI
I have a simple Fortran program that uses MPI that I am trying to configure with CMake. The problem is that although the FindMPI module finds the C libraries for MPI, it does not find the Fortran libraries. To get around this I copied the FindMPI.cmake from the CMake distribution and did some edits and a few search-and-replaces to find the Fortran version of the library. It seems to work well enough on my system (using OpenMPI) with the exception of finding some system 64-bit libraries (which is actually caused by a CMake bug that I just submitted a report for http://www.paraview.org/Bug/view.php?id=10119). The module is attached. Is there any interest in placing this with the CMake distribution or integrating into the existing FindMPI module? -Ken Kenneth Moreland *** Sandia National Laboratories *** *** *** *** email: kmo...@sandia.gov ** *** ** phone: (505) 844-8919 *** web: http://www.cs.unm.edu/~kmorel FindMPIF.cmake Description: FindMPIF.cmake ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] cpack components
I have a project with install commands like so: INSTALL(TARGETS foo RUNTIME DESTINATION bin COMPONENT Runtime LIBRARY DESTINATION bin COMPONENT Runtime ARCHIVE DESTINATION bin COMPONENT Development) INSTALL(FILES ${foo_HDRS} DESTINATION include COMPONENT Development) And I want to create a .tgz or .zip file with a subset of the available components (in my case, Runtime and Help). I've set CPACK_COMPONENTS_ALL to a list of components I want before the include(CPack), but it is being ignored. With generators that support components, I can list a subset of components to install. But it seems with non-component based cpack generators I can't list a subset of components. Any way to get what I want? I looked at the CPACK_INSTALL_CMAKE_PROJECTS variable, but its a list of 4 items, and I don't see how I can fit in a list in the 3rd position of that list. Thanks, Clint ___ 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] "rule" to generate assembler listings for each c file
On Saturday 09 January 2010, Arne Pagel wrote: > Hello, > > I try to use cmake for crosscompiling an embedded project with arm-elf-gcc. > For a simple project, a CMakeLists.txt like this works fine for me: > > cmake_minimum_required(VERSION 2.6) > > SET(CMAKE_SYSTEM_NAME Generic) > SET(CMAKE_C_COMPILER arm-elf-gcc) > > SET (CMAKE_SHARED_LINKER_FLAGS_INIT "") > SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") > > SET (CMAKE_C_FLAGS "-O3 -g3 -Wall -L lib -mcpu=cortex-m3 -mthumb") > SET (CMAKE_EXE_LINKER_FLAGS "-mcpu=cortex-m3 -mthumb -nostartfiles -T > link.ld") > > add_executable (../test.elf startup.c main.c foo.c) > TARGET_LINK_LIBRARIES (../test.elf ${CMAKE_CURRENT_SOURCE_DIR}/lib/bar.a) > > > For debugging, I want gcc to export assembler listings for each c-file it > compiles. > > This can be done with adding -Wa,-ahl=file.lst to the C-Flags > SET (CMAKE_C_FLAGS "-O9 -g3 -Wall -L lib -mcpu=cortex-m3 -mthumb" > -Wa,-ahl=file.lst) > > But this is not exactly what I want, > instead of file.lst I want that "file" is replaced with the filename which > make is currently processing. Are you sure you really need that ? If you enter "make help" in the directory of your target, you will see that there are also rules for building the object files foo.o and also for just generating the assembler files (foo.s). I.e. you can manually enter "make ...path/foo.s" and this will produce the assembler file for you so you can look at it. >From my experience this is the typical use case: if something goes wrong, look at the assembler file of the file in question and check whether it makes sense. Do you need it for something else ? 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] using cmake on windows - query on existing targets
2010/1/11 Chauhan, Vikas : > > I understand what you mean and it is similar to what the macro suggested > by Alex does. > However, I do not want a developer to have a need to change setting in > the cmake GUI for what I need. > > What I want is that: > 1. the user should be able to see a list of components & sub-components, > using a command from the cmd window from the location where the cmake > GUI has generated the build files. Did you try the Nmake generator and call nmake help > 2. the user should be able to choose a sub-component to build without > asking to build the whole component. Also, I do not want to be > generating build files every time I choose to build a different > sub-component. nmake subComponent > Is this possible? > > Please note that I am on windows. I guess this is easily possible on > Linux. As make allows you to query a list of targets & can build > specific targets as well. Please correct me if I am wrong. I bet nmake should support more or less the same set of target than unix make, but since I'm not a experienced Windows user I may be wrong. If the Nmake generator does not suit your need may be the MSYS Makefile would? -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] using cmake on windows - query on existing targets
On Mon, Jan 11, 2010 at 3:51 PM, Chauhan, Vikas wrote: >> > Actually, when I used the macro I found that though this macro gives >> > a >> > useful functionality it is not exactly what I wanted. >> > >> > What I want to do can be illustrated the following example: >> > I have a main project/dir - projectSystem >> > I have three component/dir - projectcomponent1, projectcomponent2, >> > projectcomponent3. >> > >> > Now on windows from the directory where the cmake generated files > are >> > present, at present I issue a command : >> > cmake --build PATH_TO_PROJECTSYSTEM >> > This builds the projectSystem alongwith projectComponent1, >> > projectComponent2 & projectComponent3. >> > >> > Now, I want to do two things on command window(from the dir where >> > cmake >> > build files are generated): >> > 1. Query the list of sub-targets(components) available. In this case >> > the >> > result is a list >> > projectComponent1 >> > projectComponent2 >> > projectComponent3 >> > 2. Now based on the list in 1, optionally build any component. For >> > example issue a command: >> > >> > cmake --build projectComponent1 >> > >> > Can we achieve this? Or is it asking for too much :) >> > >> > Thanks, >> > Vikas >> >> I'm new to CMake too, but it looks like you could do what you want > with the >> option() directive. >> >> So I would have in my CMakeLists.txt something like: >> >> option(ProjectComponent1 "Builds the first project component" OFF) >> etc. >> >> And later on: >> if(ProjectComponent1) >> add_subdirectory(${ProjectComponent1_DIR}) >> endif(ProjectComponent1) >> etc. >> >> and then in ccmake set the option to ON when you want to build with > it. I'd be >> surprised if there wasn't a way to define separate make targets > somewhere >> instead though, so you could do "make projectComponent1", but I'm not > sure >> about how to do that. > > I understand what you mean and it is similar to what the macro suggested > by Alex does. > However, I do not want a developer to have a need to change setting in > the cmake GUI for what I need. > > What I want is that: > 1. the user should be able to see a list of components & sub-components, > using a command from the cmd window from the location where the cmake > GUI has generated the build files. > 2. the user should be able to choose a sub-component to build without > asking to build the whole component. Also, I do not want to be > generating build files every time I choose to build a different > sub-component. > > Is this possible? > > Please note that I am on windows. I guess this is easily possible on > Linux. As make allows you to query a list of targets & can build > specific targets as well. Please correct me if I am wrong. > The options method probably solves this the best. John ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using an external shared library in a cross-compiled project
On Monday 11 January 2010, Mihai Groza wrote: > Hi all, > > I'm using CMake to port a subproject from autotools. The project is > cross-compiled. Other parts of the project are still using autotools, this > is just to see the project can be migrated. ... > Obviously, this path doesn't exist on the target machine, so the executable > fails to run. I've tried setting the INSTALL_RPATH to the path where the > library will be located on the target, yet this doesn't help also. This should work. What doesn't work, what do you get ? Using make VERBOSE=1 you can see the full command used for compiling. 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 to make dependency scanner ignore some paths?
On Monday 11 January 2010, Pavel Shevaev wrote: > On Sat, Dec 26, 2009 at 2:20 PM, Pavel Shevaev wrote: > > Guys, what is the best way to to make the dependency scanner ignore some > > paths? how long does it take if you don't set include_regular_expression() ? > Sorry folks, I'm replying to myself So, no advice here? > > Let me rephrase the original question a bit then: what are the best > practices to speed up the CMake dependencies scanner? 2.8.0 is a bit faster than previous versions. Did you try that ? You can of course try to reduce the number of files which have to be scanned and the number of directories which have to be searched by reducing the number of include directories and by carefully including only what's really necessary. There is currently AFAIK no regexp for skipping paths. 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] using cmake on windows - query on existing targets
> > Actually, when I used the macro I found that though this macro gives > > a > > useful functionality it is not exactly what I wanted. > > > > What I want to do can be illustrated the following example: > > I have a main project/dir - projectSystem > > I have three component/dir - projectcomponent1, projectcomponent2, > > projectcomponent3. > > > > Now on windows from the directory where the cmake generated files are > > present, at present I issue a command : > > cmake --build PATH_TO_PROJECTSYSTEM > > This builds the projectSystem alongwith projectComponent1, > > projectComponent2 & projectComponent3. > > > > Now, I want to do two things on command window(from the dir where > > cmake > > build files are generated): > > 1. Query the list of sub-targets(components) available. In this case > > the > > result is a list > > projectComponent1 > > projectComponent2 > > projectComponent3 > > 2. Now based on the list in 1, optionally build any component. For > > example issue a command: > > > > cmake --build projectComponent1 > > > > Can we achieve this? Or is it asking for too much :) > > > > Thanks, > > Vikas > > I'm new to CMake too, but it looks like you could do what you want with the > option() directive. > > So I would have in my CMakeLists.txt something like: > > option(ProjectComponent1 "Builds the first project component" OFF) > etc. > > And later on: > if(ProjectComponent1) >add_subdirectory(${ProjectComponent1_DIR}) > endif(ProjectComponent1) > etc. > > and then in ccmake set the option to ON when you want to build with it. I'd be > surprised if there wasn't a way to define separate make targets somewhere > instead though, so you could do "make projectComponent1", but I'm not sure > about how to do that. I understand what you mean and it is similar to what the macro suggested by Alex does. However, I do not want a developer to have a need to change setting in the cmake GUI for what I need. What I want is that: 1. the user should be able to see a list of components & sub-components, using a command from the cmd window from the location where the cmake GUI has generated the build files. 2. the user should be able to choose a sub-component to build without asking to build the whole component. Also, I do not want to be generating build files every time I choose to build a different sub-component. Is this possible? Please note that I am on windows. I guess this is easily possible on Linux. As make allows you to query a list of targets & can build specific targets as well. Please correct me if I am wrong. Thanks, Vikas ___ 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 an external shared library in a cross-compiled project
Hi all, I'm using CMake to port a subproject from autotools. The project is cross-compiled. Other parts of the project are still using autotools, this is just to see the project can be migrated. In my subproject, one executable needs an external shared library, added this way: add_library(cee_hal SHARED IMPORTED) set_target_properties(cee_hal PROPERTIES IMPORTED_LOCATION ${PROJ_BUILD_DIR}/src/${OTHER_SUBPROJECT}/lib/libx.so) My problem is that the library is specified with absolute path in the command line to the linker; thus, when I do a ldd on the binary: linux-gate.so.1 => (0x00df1000) libm.so.6 => /lib/libm.so.6 (0x007ae000) librt.so.1 => /lib/librt.so.1 (0x0093) ${PROJ_BUILD_DIR}/src/${OTHER_SUBPROJECT}/lib/libx.so (0x00f9) libc.so.6 => /lib/libc.so.6 (0x00666000) /lib/ld-linux.so.2 (0x00648000) libpthread.so.0 => /lib/libpthread.so.0 (0x007dd000) Obviously, this path doesn't exist on the target machine, so the executable fails to run. I've tried setting the INSTALL_RPATH to the path where the library will be located on the target, yet this doesn't help also. Is there a way to import the library such as every time I use it, something like -L ${PROJ_BUILD_DIR}/src/${OTHER_SUBPROJECT}/lib/ -lx to be added to the linker command line? (Using LINK_FLAGS to set the global link flags seems to me would make the IMPORT attribute superfluous). Thanks, Mihai. ___ 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] Quoting of commands.
Is there a global way to disable all CMake quoting of commands? It appears that CMake is parsing some commands and inserting quotes in places and it is causing me much grief. -- Cheers, Timothy St. Clair ___ 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] Cannot browse www.cmake.org?
Hi Eric, Our IT staff just notified us that we are experiencing external DNS issues and that they hope to have them resolved soon. On Mon, Jan 11, 2010 at 10:36 AM, Eric Noulard wrote: > I'm currently unable to reach CMake web site? > > I'm in Europe (France) with no noticable connectivity loss on other side? > > -- > 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 > ___ 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] Cannot browse www.cmake.org?
I'm currently unable to reach CMake web site? I'm in Europe (France) with no noticable connectivity loss on other side? -- 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] How to make dependency scanner ignore some paths?
On Sat, Dec 26, 2009 at 2:20 PM, Pavel Shevaev wrote: > Guys, what is the best way to to make the dependency scanner ignore some > paths? Sorry folks, I'm replying to myself So, no advice here? Let me rephrase the original question a bit then: what are the best practices to speed up the CMake dependencies scanner? -- Best regards, Pavel ___ 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] Can you add sources to a target library after add_library()?
Hi Eric, Your solution is one possibility to tackle my problem. What I am trying to accomplish is to record version information into some (but not all) of the libraries/executables in my project. So, this version file -- let's call it version.cc -- may, or may not be part of the list of sources to add to a library. Moreover, version.cc is generated, based on information from, a.o., Subversion. I just re-read the thread "Embedding up-to-date version info in built library" from mid-December 2009. I think I'll have to study that solution more carefully, cause the subject is very close to what I'm currently facing. Best regards, Marcel Loose. On Mon, 2010-01-11 at 11:14 +0100, Eric Noulard wrote: > 2010/1/11 Marcel Loose : > > Too bad. I was hoping I could do this without having to use a list > > variable to collect all my sources. In my case, the use of conditionals > > is somewhat awkward. > > Personnally I sometime use several variable like: > > add_library(blah > ${BLAH_SOURCE} > ${BLAH_SOURCE_OPT1} > ${BLAH_SOURCE_OPT2} > ${BLAH_SOURCE_OPT3}) > > xxx_OPTy var may contains source or may be void and off course > should be defined BEFORE add_library is called. > > It is mostly like conditionnally adding the same content to a list but > may required less conditionnal because xxx_OPTy may defaulted to void content. > > Would you explain us why you need to add source AFTER add_library > and may be why conditionnal is awkward? ___ 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] Can you add sources to a target library after add_library()?
2010/1/11 Marcel Loose : > Too bad. I was hoping I could do this without having to use a list > variable to collect all my sources. In my case, the use of conditionals > is somewhat awkward. Personnally I sometime use several variable like: add_library(blah ${BLAH_SOURCE} ${BLAH_SOURCE_OPT1} ${BLAH_SOURCE_OPT2} ${BLAH_SOURCE_OPT3}) xxx_OPTy var may contains source or may be void and off course should be defined BEFORE add_library is called. It is mostly like conditionnally adding the same content to a list but may required less conditionnal because xxx_OPTy may defaulted to void content. Would you explain us why you need to add source AFTER add_library and may be why conditionnal is awkward? -- 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] "rule" to generate assembler listings for each c file
Hi Arne, I think this cmake script shows what you need to do to add a compiler flag for each source file. It adds a dummy flag "/flagadded:FILE_NAME" for each source file according to its name. project(flags_per_file) cmake_minimum_required(VERSION 2.6) set(SOURCES x1.c x2.c x3.c) add_executable(executable ${SOURCES}) foreach(FILE ${SOURCES}) set_source_files_properties (${FILE} PROPERTIES COMPILE_FLAGS "/flagadded:${FILE}") message("${FILE} -->> /flagadded:${FILE}") endforeach(FILE in ${SOURCES}) Greetings, Luca On Sat, 09 Jan 2010 22:02:49 +0100, Arne Pagel wrote: Hello, I try to use cmake for crosscompiling an embedded project with arm-elf-gcc. For a simple project, a CMakeLists.txt like this works fine for me: cmake_minimum_required(VERSION 2.6) SET(CMAKE_SYSTEM_NAME Generic) SET(CMAKE_C_COMPILER arm-elf-gcc) SET (CMAKE_SHARED_LINKER_FLAGS_INIT "") SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") SET (CMAKE_C_FLAGS "-O3 -g3 -Wall -L lib -mcpu=cortex-m3 -mthumb") SET (CMAKE_EXE_LINKER_FLAGS "-mcpu=cortex-m3 -mthumb -nostartfiles -T link.ld") add_executable (../test.elf startup.c main.c foo.c) TARGET_LINK_LIBRARIES (../test.elf ${CMAKE_CURRENT_SOURCE_DIR}/lib/bar.a) For debugging, I want gcc to export assembler listings for each c-file it compiles. This can be done with adding -Wa,-ahl=file.lst to the C-Flags SET (CMAKE_C_FLAGS "-O9 -g3 -Wall -L lib -mcpu=cortex-m3 -mthumb" -Wa,-ahl=file.lst) But this is not exactly what I want, instead of file.lst I want that "file" is replaced with the filename which make is currently processing. The result should be foo.lst while processing foo.c and main.lst for main.c. I know how I can solve it with make, but I have no idea how I could tell this to cmake. I found CMAKE_CURRENT_LIST_FILE, but I don't know if it helps me. Has anyone an Idea? Best Regards Arne ___ 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 -- -- Luca Cappa R&D Sequoia IT s.r.l. Via L. Einaudi, 25 10024 Moncalieri (To) Italy www.sequoia.it CONFIDENZIALE: Questo messaggio e gli eventuali allegati sono confidenziali e riservati. Se vi è stato recapitato per errore e non siete fra i destinatari elencati, siete pregati di darne immediatamente avviso al mittente. Le informazioni contenute non devono essere mostrate ad altri, né utilizzate, memorizzate o copiate in qualsiasi forma. CONFIDENTIALITY: This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium. ___ 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] Can you add sources to a target library after add_library()?
Too bad. I was hoping I could do this without having to use a list variable to collect all my sources. In my case, the use of conditionals is somewhat awkward. Best regards, Marcel Loose. On Sat, 2010-01-09 at 18:38 -0500, Philip Lowman wrote: > I highly doubt it. Best practice is to just use conditionals to add > the necessary source files to a list variable prior to the > add_library() call. > > On Sat, Jan 9, 2010 at 5:48 PM, Marcel Loose wrote: > > Hi all, > > > > I've been searching the manuals, but couldn't find a way to add sources > > to a target library *after* the add_library() command, e.g., using > > set_target_properties()? Is this possible at all? > > > > Best regards, > > Marcel Loose. > > > > > > ___ > > 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