Re: [CMake] Extra include/lib paths - multiple entries
On Wed, 17 Nov 2010 13:12:42 +0100 Yngve Inntjore Levinsen wrote: > On Wednesday 17 November 2010 12:30:06 Adam J Richardson wrote: > > Is this a correct specification for multiple include/lib paths in > > environment variables? If not, what should I use instead? Sometimes > > it seems to work, other times not... > > > > CMAKE_INCLUDE_PATH=C:/Compilers/Includes;C:/Compilers/MinGW/include > > CMAKE_LIBRARY_PATH=C:/Compilers/Libs;C:/Compilers/MinGW/lib > > This is how I would write it: > INCLUDE_DIRECTORIES(C:/Compilers/Includes C:/Compilers/MinGW/include) > TARGET_LINK_LIBRARIES( C:/Compilers/Libs > C:/Compilers/MinGW/lib) > > I mostly use *nix systems though, so I am not perfectly sure how to > get it correct on Windows.. Thanks for the reply Yngve. I wasn't clear: I need to specify the paths in the environment, not the CMakeLists.txt file. I use mostly *nix too, so adding Win-specific bits to the CMakeLists.txt isn't acceptable. I'm guessing on the *nix buildslaves I would have env vars: CMAKE_INCLUDE_PATH=/usr/include:/usr/myfunkylib/include CMAKE_LIBRARY_PATH=/usr/lib:/usr/myfunkylib/lib using colons as separators rather than semicolons as on Windows. Right? Or not? Should I be using one or the other for both types of environment, since CMake is xplat? Or is my approach entirely wrong? I would like to use CMAKE_*_PATH since those are included automatically and I'm a lazy developer. ;) signature.asc Description: PGP signature ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Problems with parallel builds
Dear All, I am using CMake 2.8.1 on Linux x86. I have a project that needs to be built two times. One with -fPIC, the other - without. The project depends on header files that need to be generated by an external script. When I build this project with several parallel jobs (gmake -j5, for example) to my disappointment CMake calls external script several times so at the end I get corrupted header files. Does anybody know a cross-platform way of implementing a mutex (or something like that) to make sure that scripts that generate files are called only once? So far for me parallel builds do not work with CMake at all. Thanks. Denis ___ 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] Problems with parallel builds
>>> On 18-11-2010 at 13:06, in message <306960.51089...@web65407.mail.ac4.yahoo.com>, Denis Scherbakov wrote: > Dear All, > > I am using CMake 2.8.1 on Linux x86. I have a project that needs to be built > two times. One with -fPIC, the other - without. The project depends on header > files that need to be generated by an external script. > > When I build this project with several parallel jobs (gmake -j5, for example) > to my disappointment CMake calls external script several times so at the end > I get corrupted header files. > > Does anybody know a cross-platform way of implementing a mutex (or something > like that) to make sure that scripts that generate files are called only > once? > > So far for me parallel builds do not work with CMake at all. > > Thanks. > Denis > > > > ___ > 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 Hi Denis, If you have two different build directories, which you need to have anyway when compiling with and without -fPIC, then you shouldn't have a problem, as long as you generate those header files in the build directory, which is IMHO the only sensible place to put generated files (your source tree might even be read-only!). Or maybe I completely misunderstood your question. 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
Re: [CMake] Problems with parallel builds
2010/11/18 Denis Scherbakov : > Dear All, > > I am using CMake 2.8.1 on Linux x86. I have a project that needs to be built > two times. One with -fPIC, the other - without. The project depends on header > files that need to be generated by an external script. > > When I build this project with several parallel jobs (gmake -j5, for example) > to my disappointment CMake calls external script several times so at the end > I get corrupted header files. Could you give us the exact CMake rule/command you use to generate those headers? configure_file? add_custom_command? add_custom_target? execute_process? ... combination of those ? > Does anybody know a cross-platform way of implementing a mutex (or something > like that) to make sure that > scripts that generate files are called only once? > > So far for me parallel builds do not work with CMake at all. I did never had any trouble with parallel building with CMake on Linux with makefile generator so far. For build host ranging from 1 processors to 4 processors with various -j values. -- 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] Problems with parallel builds
Hi! What I mean is: PROJECT(MYPROJECT) ADD_CUSTOM_COMMAND( OUTPUT "${PROJECT_BINARY_DIR}/MyFile.hh" COMMAND ${CMAKE_COMMAND} -P MyScript.cmake) SET_SOURCE_FILE_PROPERTIES("${PROJECT_BINARY_DIR}/MyFile.hh" PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE) SET (MYPROJECT_SRCS MyFile.hh MyFile.cc ) ADD_LIBRARY(MYLIB ${MYPROJECT_SRCS}) ADD_LIBRARY(MYLIBpic ${MYPROJECT_SRCS}) SET_TARGET_PROPERTIES(MYLIBpic PROPERTIES COMPILE_FLAGS "-FPIC -DPIC") $ gmake -j2 all ... MyFile.hh is written two times So far I understand two targets try to generate MyFile.hh at the same time and there is no way to tell one of them that the file is being built by someone else already. Denis --- On Thu, 11/18/10, Eric Noulard wrote: > From: Eric Noulard > Subject: Re: [CMake] Problems with parallel builds > To: "Denis Scherbakov" > Cc: cmake@cmake.org > Date: Thursday, November 18, 2010, 5:13 AM > 2010/11/18 Denis Scherbakov : > > Dear All, > > > > I am using CMake 2.8.1 on Linux x86. I have a project > that needs to be built two times. One with -fPIC, the other > - without. The project depends on header files that need to > be generated by an external script. > > > > When I build this project with several parallel jobs > (gmake -j5, for example) to my disappointment CMake calls > external script several times so at the end I get corrupted > header files. > > Could you give us the exact CMake rule/command you use to > generate > those headers? > > configure_file? > add_custom_command? > add_custom_target? > execute_process? > ... combination of those ? > > > Does anybody know a cross-platform way of implementing > a mutex (or something like that) to make sure that > > scripts that generate files are called only once? > > > > So far for me parallel builds do not work with CMake > at all. > > I did never had any trouble with parallel building with > CMake on Linux > with makefile generator so far. > For build host ranging from 1 processors to 4 processors > with various -j values. > > -- > 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] Problems with parallel builds
On Thu, Nov 18, 2010 at 8:34 AM, Denis Scherbakov wrote: > Hi! > > What I mean is: > > PROJECT(MYPROJECT) > > ADD_CUSTOM_COMMAND( OUTPUT "${PROJECT_BINARY_DIR}/MyFile.hh" COMMAND > ${CMAKE_COMMAND} -P MyScript.cmake) > > SET_SOURCE_FILE_PROPERTIES("${PROJECT_BINARY_DIR}/MyFile.hh" PROPERTIES > GENERATED TRUE HEADER_FILE_ONLY TRUE) > > SET (MYPROJECT_SRCS > MyFile.hh > MyFile.cc > ) > > ADD_LIBRARY(MYLIB ${MYPROJECT_SRCS}) > ADD_LIBRARY(MYLIBpic ${MYPROJECT_SRCS}) > SET_TARGET_PROPERTIES(MYLIBpic PROPERTIES COMPILE_FLAGS "-FPIC -DPIC") > > $ gmake -j2 all > ... MyFile.hh is written two times > > So far I understand two targets try to generate MyFile.hh at the same time > and there is no way to tell one of them that the file is being built by > someone else already. > > Denis > > --- On Thu, 11/18/10, Eric Noulard wrote: > >> From: Eric Noulard >> Subject: Re: [CMake] Problems with parallel builds >> To: "Denis Scherbakov" >> Cc: cmake@cmake.org >> Date: Thursday, November 18, 2010, 5:13 AM >> 2010/11/18 Denis Scherbakov : >> > Dear All, >> > >> > I am using CMake 2.8.1 on Linux x86. I have a project >> that needs to be built two times. One with -fPIC, the other >> - without. The project depends on header files that need to >> be generated by an external script. >> > >> > When I build this project with several parallel jobs >> (gmake -j5, for example) to my disappointment CMake calls >> external script several times so at the end I get corrupted >> header files. >> >> Could you give us the exact CMake rule/command you use to >> generate >> those headers? >> >> configure_file? >> add_custom_command? >> add_custom_target? >> execute_process? >> ... combination of those ? >> >> > Does anybody know a cross-platform way of implementing >> a mutex (or something like that) to make sure that >> > scripts that generate files are called only once? >> > >> > So far for me parallel builds do not work with CMake >> at all. >> >> I did never had any trouble with parallel building with >> CMake on Linux >> with makefile generator so far. >> For build host ranging from 1 processors to 4 processors >> with various -j values. >> >> -- >> 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 > The easiest way to make this work is to have a separate custom target that depends on the output of the custom command, and then to have the two libraries depend on that custom target with add_dependencies... ___ 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] Problems with parallel builds
Hi, Marcel, What I mean is that I have a huge source tree and many CMake files and there is a source file inside this tree that needs to be built two times, because there will be an executable using it (non-PIC) and a shared library (PIC). So I have to create two targets (say MYLIB and MYLIBpic) that depend on the same source: SET(MYPROJECT_SRCS MyFile.hh MyFile.cc) MyFile.hh is generated by a ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) SET_SOURCE_FILE_PROPERTIES(MyFile.hh GENERATED TRUE HEADER_FILE_ONLY TRUE) When two targets MYLIB and MYLIBpic are build in parallel, they both try to generate MyFile.hh without checking that MyFile.hh is already being generated by someone else. So sometimes I end up with MyFile.hh where each line appears two times. Sometimes, #endif appears in the middle of the file, etc. Denis --- On Thu, 11/18/10, Marcel Loose wrote: > Hi Denis, > > If you have two different build directories, which you need > to have > anyway when compiling with and without -fPIC, then you > shouldn't have a > problem, as long as you generate those header files in the > build > directory, which is IMHO the only sensible place to put > generated files > (your source tree might even be read-only!). Or maybe I > completely > misunderstood your question. > > 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
[CMake] CTest cannot determine repository type
When configuring ParaView (and other applications), I see this: CTest cannot determine repository type. Please set UPDATE_TYPE to 'cvs' or 'svn'. CTest update will not work. Is CTest aware of git? Thanks, 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] Problems with parallel builds
Hi, David, I did as you suggested: ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) ADD_CUTSOM_TARGET(MyHeaders DEPENDS MyFile.hh) ADD_LIBRARY(MYLIB ${MYLIB_SRCS}) ADD_DEPENDENCIES(MYLIB MyHeaders) ADD_LIBRARY(MYLIBpic ${MYLIB_SRCS}) ADD_DEPENDENCIES(MYLIBpic MyHeaders) Didn't work. Target "MyHeaders" is build two times when I do "gmake -j2" I see two "Generating MyFile.hh" lines and MyFile.hh has duplicate lines. Denis > David Cole wrote: > > The easiest way to make this work is to have a separate > custom target > that depends on the output of the custom command, and then > to have the > two libraries depend on that custom target with > add_dependencies... > ___ 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] Problems with parallel builds
Try: ADD_CUSTOM_TARGET(MyHeaders ALL DEPENDS MyFile.hh) Without the "ALL" your target is not included in the set of targets built by a "make" or a "make all" -- without your target included in "make" there is nothing for the subsequent targets to depend on. Perhaps we should add a warning to add_dependencies if expressing a dependency on something not in "all" by default On Thu, Nov 18, 2010 at 9:33 AM, Denis Scherbakov wrote: > Hi, David, > > I did as you suggested: > > ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) > ADD_CUTSOM_TARGET(MyHeaders DEPENDS MyFile.hh) > > ADD_LIBRARY(MYLIB ${MYLIB_SRCS}) > ADD_DEPENDENCIES(MYLIB MyHeaders) > > ADD_LIBRARY(MYLIBpic ${MYLIB_SRCS}) > ADD_DEPENDENCIES(MYLIBpic MyHeaders) > > Didn't work. Target "MyHeaders" is build two times when I do "gmake -j2" > I see two "Generating MyFile.hh" lines and MyFile.hh has duplicate lines. > > Denis > >> David Cole wrote: >> >> The easiest way to make this work is to have a separate >> custom target >> that depends on the output of the custom command, and then >> to have the >> two libraries depend on that custom target with >> add_dependencies... >> > > > > ___ 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] Problems with parallel builds
David, Thank you for spending your time to resolve my problem. Unfortunately you suggestion did not help. Introduction of new custom targets in my case leads to the fact that I have one custom target that depends on another custom target. I get: gmake[3]: *** No rule to make target 'customTargetA', needed by 'customTargetB'. Stop. And in this case it is not even a parallel build. Now I remember that I already tried this custom-target trick about a year ago and it failed with "gmake" error I specified above. So CMake is not parallel build ready. BTW, "gmake -j4 targetA targetB" also fails. You need to "gmake -j4 targetA" and then "gamake -j4 targetB" to get correct results. Denis --- On Thu, 11/18/10, David Cole wrote: > From: David Cole > Subject: Re: [CMake] Problems with parallel builds > To: "Denis Scherbakov" > Cc: cmake@cmake.org > Date: Thursday, November 18, 2010, 6:43 AM > Try: > ADD_CUSTOM_TARGET(MyHeaders ALL DEPENDS MyFile.hh) > > Without the "ALL" your target is not included in the set of > targets > built by a "make" or a "make all" -- without your target > included in > "make" there is nothing for the subsequent targets to > depend on. > Perhaps we should add a warning to add_dependencies if > expressing a > dependency on something not in "all" by default > > > On Thu, Nov 18, 2010 at 9:33 AM, Denis Scherbakov > > wrote: > > Hi, David, > > > > I did as you suggested: > > > > ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) > > ADD_CUTSOM_TARGET(MyHeaders DEPENDS MyFile.hh) > > > > ADD_LIBRARY(MYLIB ${MYLIB_SRCS}) > > ADD_DEPENDENCIES(MYLIB MyHeaders) > > > > ADD_LIBRARY(MYLIBpic ${MYLIB_SRCS}) > > ADD_DEPENDENCIES(MYLIBpic MyHeaders) > > > > Didn't work. Target "MyHeaders" is build two times > when I do "gmake -j2" > > I see two "Generating MyFile.hh" lines and MyFile.hh > has duplicate lines. > > > > Denis > > > >> David Cole wrote: > >> > >> The easiest way to make this work is to have a > separate > >> custom target > >> that depends on the output of the custom command, > and then > >> to have the > >> two libraries depend on that custom target with > >> add_dependencies... > >> > > > > > > > > > ___ 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] Placement of .rule files under MSVS 2010 generator
Hello, I'm using CMake custom commands to copy files from a source directory to a project binary one. The copying commands itself looks this way: add_custom_command( OUTPUT "${dest_file}" COMMAND "${CMAKE_COMMAND}" -E copy "${src_file}" "${dest_file}" DEPENDS "${src_file}" ) After all "add_custom_command" calls a custom target is created that depends on all copied files add_custom_target( copy_files_targ ALL DEPENDS ${dest_file1} ${dest_file2} ) After generation of Visual Studio's solution and project files I found out that a whole bunch of .rule had been created in the output directory. So, while the source dir has the following contents: config1.xml, config2.xml, config3.xml, the destination directory contains two times more files: config1.xml, config2.xml, config3.xml and config1.xml.rule, config2.xml.rule, config3.xml.rule. I don't want to have all those additional files in the destination folder. So the question is: is there a way to put ".rule" files into another dir? Thanks in advance. ___ 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] Problems with parallel builds
Here is a sample CMakeLists.txt to illustrate that two custom targets cannot depend on each other: PROJECT(BUG C) CMAKE_MINIMUM_REQUIRED(VERSION 2.8) ADD_CUSTOM_COMMAND( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fileOne" COMMAND "${CMAKE_COMMAND}" ARGS "-E" "touch" "${CMAKE_CURRENT_BINARY_DIR}/fileOne") ADD_CUSTOM_TARGET(targetFileOne DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/fileOne") ADD_CUSTOM_COMMAND( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s" COMMAND "${CMAKE_COMMAND}" ARGS "-E" "touch" "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") ADD_CUSTOM_TARGET(targetFileOneS ALL DEPENDS targetFileOne "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") $ gmake Scanning dependencies of target targetFileOne [ 0%] Generating fileOne [ 50%] Built target targetFileOne Scanning dependencies of target targetFileOneS gmake[2]: *** No rule to make target `targetFileOne', needed by `CMakeFiles/targetFileOneS'. Stop. gmake[1]: *** [CMakeFiles/targetFileOneS.dir/all] Error 2 gmake: *** [all] Error 2 So I am back to my problem that I cannot compile my project in parallel. The question is: How to implement mutexes in CMake scripts? Denis --- On Thu, 11/18/10, David Cole wrote: > From: David Cole > Subject: Re: [CMake] Problems with parallel builds > To: "Denis Scherbakov" > Cc: cmake@cmake.org > Date: Thursday, November 18, 2010, 6:43 AM > Try: > ADD_CUSTOM_TARGET(MyHeaders ALL DEPENDS MyFile.hh) > > Without the "ALL" your target is not included in the set of > targets > built by a "make" or a "make all" -- without your target > included in > "make" there is nothing for the subsequent targets to > depend on. > Perhaps we should add a warning to add_dependencies if > expressing a > dependency on something not in "all" by default > > > On Thu, Nov 18, 2010 at 9:33 AM, Denis Scherbakov > > wrote: > > Hi, David, > > > > I did as you suggested: > > > > ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) > > ADD_CUTSOM_TARGET(MyHeaders DEPENDS MyFile.hh) > > > > ADD_LIBRARY(MYLIB ${MYLIB_SRCS}) > > ADD_DEPENDENCIES(MYLIB MyHeaders) > > > > ADD_LIBRARY(MYLIBpic ${MYLIB_SRCS}) > > ADD_DEPENDENCIES(MYLIBpic MyHeaders) > > > > Didn't work. Target "MyHeaders" is build two times > when I do "gmake -j2" > > I see two "Generating MyFile.hh" lines and MyFile.hh > has duplicate lines. > > > > Denis > > > >> David Cole wrote: > >> > >> The easiest way to make this work is to have a > separate > >> custom target > >> that depends on the output of the custom command, > and then > >> to have the > >> two libraries depend on that custom target with > >> add_dependencies... > >> > > > > > > > > > ___ 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] Problems with parallel builds
On Thu, Nov 18, 2010 at 1:08 PM, Denis Scherbakov wrote: > Here is a sample CMakeLists.txt to illustrate that two custom targets cannot > depend on each other: > > PROJECT(BUG C) > > CMAKE_MINIMUM_REQUIRED(VERSION 2.8) > > ADD_CUSTOM_COMMAND( > OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fileOne" > COMMAND "${CMAKE_COMMAND}" > ARGS "-E" > "touch" > "${CMAKE_CURRENT_BINARY_DIR}/fileOne") > > ADD_CUSTOM_TARGET(targetFileOne DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/fileOne") > > ADD_CUSTOM_COMMAND( > OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s" > COMMAND "${CMAKE_COMMAND}" > ARGS "-E" > "touch" > "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") > > ADD_CUSTOM_TARGET(targetFileOneS ALL DEPENDS targetFileOne > "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") > > $ gmake > Scanning dependencies of target targetFileOne > [ 0%] Generating fileOne > [ 50%] Built target targetFileOne > Scanning dependencies of target targetFileOneS > gmake[2]: *** No rule to make target `targetFileOne', needed by > `CMakeFiles/targetFileOneS'. Stop. > gmake[1]: *** [CMakeFiles/targetFileOneS.dir/all] Error 2 > gmake: *** [all] Error 2 > > So I am back to my problem that I cannot compile my project in parallel. > The question is: How to implement mutexes in CMake scripts? > > Denis > > --- On Thu, 11/18/10, David Cole wrote: > >> From: David Cole >> Subject: Re: [CMake] Problems with parallel builds >> To: "Denis Scherbakov" >> Cc: cmake@cmake.org >> Date: Thursday, November 18, 2010, 6:43 AM >> Try: >> ADD_CUSTOM_TARGET(MyHeaders ALL DEPENDS MyFile.hh) >> >> Without the "ALL" your target is not included in the set of >> targets >> built by a "make" or a "make all" -- without your target >> included in >> "make" there is nothing for the subsequent targets to >> depend on. >> Perhaps we should add a warning to add_dependencies if >> expressing a >> dependency on something not in "all" by default >> >> >> On Thu, Nov 18, 2010 at 9:33 AM, Denis Scherbakov >> >> wrote: >> > Hi, David, >> > >> > I did as you suggested: >> > >> > ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) >> > ADD_CUTSOM_TARGET(MyHeaders DEPENDS MyFile.hh) >> > >> > ADD_LIBRARY(MYLIB ${MYLIB_SRCS}) >> > ADD_DEPENDENCIES(MYLIB MyHeaders) >> > >> > ADD_LIBRARY(MYLIBpic ${MYLIB_SRCS}) >> > ADD_DEPENDENCIES(MYLIBpic MyHeaders) >> > >> > Didn't work. Target "MyHeaders" is build two times >> when I do "gmake -j2" >> > I see two "Generating MyFile.hh" lines and MyFile.hh >> has duplicate lines. >> > >> > Denis >> > >> >> David Cole wrote: >> >> >> >> The easiest way to make this work is to have a >> separate >> >> custom target >> >> that depends on the output of the custom command, >> and then >> >> to have the >> >> two libraries depend on that custom target with >> >> add_dependencies... >> >> >> > >> > >> > >> > >> > > > > Instead of: > ADD_CUSTOM_TARGET(targetFileOneS ALL DEPENDS targetFileOne > "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") Try: ADD_CUSTOM_TARGET(targetFileOneS ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") ADD_DEPENDENCIES(targetFileOneS targetFileOne) And you cannot specify more than one target name to parallel make and expect it to work. It only works if you do "make" or "make singleTarget". ___ 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] Problems with parallel builds
On 2010-11-18 07:18-0800 Denis Scherbakov wrote: David, Thank you for spending your time to resolve my problem. Unfortunately you suggestion did not help. Introduction of new custom targets in my case leads to the fact that I have one custom target that depends on another custom target. I get: gmake[3]: *** No rule to make target 'customTargetA', needed by 'customTargetB'. Stop. And in this case it is not even a parallel build. Now I remember that I already tried this custom-target trick about a year ago and it failed with "gmake" error I specified above. So CMake is not parallel build ready. BTW, "gmake -j4 targetA targetB" also fails. You need to "gmake -j4 targetA" and then "gamake -j4 targetB" to get correct results. Denis: I have been following this discussion with interest and assumed you would quickly find the source of your parallel build issue. I assure you cmake is parallel build ready, i.e., lots of people including me use parallel builds with cmake with no problems for quite complex builds. It is not completely trivial to set it up right for a given complex project, but it can be done. Since you are having problems with setting it up right for your complex project, I suggest you try making the simplest example of your issue: a generated one-line header and two simple libraries (each with only a few lines of code) that depend upon it. Then wrap that simple example up in a tarball so others can verify the issue you are finding (or make the fix to your simple example so that it works properly with parallel builds). The other big advantage of the "simple example" approach is that 99 times out of 100 (at least in my case) the simple example works fine and it turns out the source of the problem is the implementation of the logic of the simple example isn't done consistently in the complex project (e.g., some third library you forgot about also depends on your generated header) or there is some other CMake logic in your complex project that needs changing to make your project ready for parallel builds. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Problems with parallel builds
2010/11/18 David Cole : > On Thu, Nov 18, 2010 at 1:08 PM, Denis Scherbakov > wrote: >> Here is a sample CMakeLists.txt to illustrate that two custom targets cannot >> depend on each other: >> >> PROJECT(BUG C) >> >> CMAKE_MINIMUM_REQUIRED(VERSION 2.8) >> >> ADD_CUSTOM_COMMAND( >> OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fileOne" >> COMMAND "${CMAKE_COMMAND}" >> ARGS "-E" >> "touch" >> "${CMAKE_CURRENT_BINARY_DIR}/fileOne") >> >> ADD_CUSTOM_TARGET(targetFileOne DEPENDS >> "${CMAKE_CURRENT_BINARY_DIR}/fileOne") >> >> ADD_CUSTOM_COMMAND( >> OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s" >> COMMAND "${CMAKE_COMMAND}" >> ARGS "-E" >> "touch" >> "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") >> >> ADD_CUSTOM_TARGET(targetFileOneS ALL DEPENDS targetFileOne >> "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") [...] > Instead of: >> ADD_CUSTOM_TARGET(targetFileOneS ALL DEPENDS targetFileOne >> "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") > > Try: > ADD_CUSTOM_TARGET(targetFileOneS ALL DEPENDS > "${CMAKE_CURRENT_BINARY_DIR}/fileOne-s") > ADD_DEPENDENCIES(targetFileOneS targetFileOne) This solution works for me on Linux + CMake 2.8.1 and up. -- 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] autoconf to cmake conversion
On Wednesday 17 November 2010, luxInteg wrote: > Greetings, > > I am learning cmake. > > I am looking for a tool to converta build system fom autoconf to > cmake. II came across am2cmake available at > http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ > > It is very kde3 specific, I was wondering if there is anything more > generic available. It may work somewhat also for non-KDE projects. You may be able to remove the KDE specific stuff, and it should produce some skeleton. The result will not be working CMakeLists.txt, but the boring translation work will have been done for you. E.g. all the configure checks you have to convert yourself. I usually take the config.h created from the autotools build and start adding the tests to the cmake files until the generated config.h are (basically) identical. 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] cmake, latex docbook
Greetings I am learning cmake I downloaded CMakeUseLatex from http://www.cmake.org/Wiki/CMakeUserUseLATEX and I scanned through the pdf file but I did not see any references to TEX binaries such docbook2html, dblatex etc. So lets say I have a couple a docbook_xml files xyxy.docbook abab.docbook that I want to transform to html and to pdf respectvely how do I do this with CMakeUserUseLATEX.cmake? advice would be appreciated luxInteg ___ 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, latex docbook
UseLATEX.cmake has no facilites for docbook. It was designed strictly with the latex and pdflatex programs in mind. -Ken On 11/18/10 2:59 PM, "luxInteg" wrote: Greetings I am learning cmake I downloaded CMakeUseLatex from http://www.cmake.org/Wiki/CMakeUserUseLATEX and I scanned through the pdf file but I did not see any references to TEX binaries such docbook2html, dblatex etc. So lets say I have a couple a docbook_xml files xyxy.docbook abab.docbook that I want to transform to html and to pdf respectvely how do I do this with CMakeUserUseLATEX.cmake? advice would be appreciated luxInteg ___ 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] selecting correct g++/libstdc++.so pair
Hi all, I have three g++ versions installed. Debian's native g++-4.3 and g++-4.4 both use /usr/lib/libstdc++.so.6.13, while /usr/local/bin/g++-4.5 needs /usr/local/lib64/libstdc++.so.6.14. If I use CXX=/usr/local/bin/g++-4.5 at configure time, executables are linked against /usr/lib/libstdc++.so.6.13, which is not what I want. What is the approved Cmake Way for insuring that executables using g++-4.5 link against libstdc++.so.6.14? Thanks, Russell ___ 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] Letting the user choose an install directory
Hi, I apologize of this is a trivial question but I cannot seem to find an answer or get it to work. I am building an installation package for MacOS X using package maker. I cannot figure out how to let the user override the installation directory when they open the .mpkg file. Can anyone help? Matthias ___ 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] selecting correct g++/libstdc++.so pair
On 11/18/2010 11:01 PM, Russell L. Carter wrote: > Hi all, > I have three g++ versions installed. Debian's native g++-4.3 and > g++-4.4 both use /usr/lib/libstdc++.so.6.13, while > /usr/local/bin/g++-4.5 needs /usr/local/lib64/libstdc++.so.6.14. > > If I use CXX=/usr/local/bin/g++-4.5 at configure time, executables > are linked against /usr/lib/libstdc++.so.6.13, which is not what > I want. What is the approved Cmake Way for insuring that executables > using g++-4.5 link against libstdc++.so.6.14? The selection of libstdc++ takes place by the usual library searching mechanism, so you must ensure that /usr/local/lib64/libstdc++.so.6.14 takes precedence over /usr/lib/libstdc++.so.6.13 for runtime linking. Use ldconfig in connection with /etc/ld.so.conf, the LD_LIBRARY_PATH environment variable et al., or pass appropriate rpath settings to the linker, whatever suits your needs best. Regards, 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] cmake, latex docbook
BRL-CAD's experimental CMake build is using xsltproc and fop currently rather than TEX binaries, but the techniques probably can be adapted to other tools - you might want to take a look at: http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/branches/cmake/doc/docbook/CMakeLists.txt?revision=40516&view=markup and subdirectories to see if that logic is helpful. Don't know if it's the best/right way, but it does work in testing here. Cheers, and good luck! CY ___ 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] Trouble with install()
Hi. I'm having some issues with the install() command in CMake. I have the following code: #Install headers set(HEADERS test.hpp) foreach(HEADER ${HEADERS}) install(TARGETS ${CMAKE_CURRENT_SOURCE_DIR}/include/${HEADER} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/PROJECT/${HEADER}) endforeach() When I run CMake on the script, I get: CMake Error at CMakeLists.txt:55 (install): install TARGETS given target "/home/HOME/Documents/Development/PROJECT/include/test.hpp" which does not exist in this directory. The path listed in that file does exist, though; I've checked to make sure. What could be causing this problem? Thanks in advance. ___ 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] Trouble with install()
On Thu, Nov 18, 2010 at 10:55:15PM -0500, Braden Walters wrote: > #Install headers > set(HEADERS > test.hpp) > foreach(HEADER ${HEADERS}) > install(TARGETS ${CMAKE_CURRENT_SOURCE_DIR}/include/${HEADER} > DESTINATION ${CMAKE_INSTALL_PREFIX}/include/PROJECT/${HEADER}) > endforeach() Try install(FILES ...) instead. TARGETS is for installing CMake targets. tyler ___ 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, latex docbook
On 11/18/2010 10:59 PM, luxInteg wrote: > Greetings > > I am learning cmake > I downloaded CMakeUseLatex from > http://www.cmake.org/Wiki/CMakeUserUseLATEX > > and I scanned through the pdf file but I did not see any references to TEX > binaries such docbook2html, dblatex etc. Those are NOT TeX binaries... > So lets say I have a couple a > docbook_xml files xyxy.docbook abab.docbook > that I want to transform to html and to pdf respectvely > > how do I do this with CMakeUserUseLATEX.cmake? Use the same techniques as in UseLATEX.cmake, but adapted to your needs. > > > advice would be appreciated > > luxInteg 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
[CMake] Dependency not executed, why?
Hi, I've found an example to use bison and flex in cmake. I have a static library where I want to add the generated sources but the dependencies are not triggered. Why? project(test) include_directories(. ${CMAKE_BINARY_DIR}/libs/test) add_custom_target(ScannerAndParser echo "Creating scanner.cxx and parser.cxx") add_custom_command( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l COMMAND flex ARGS -o ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l TARGET ScannerAndParser DEPENDS ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx OUTPUTS ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx) add_custom_command( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/parser.y COMMAND bison ARGS -y -d ${CMAKE_CURRENT_SOURCE_DIR}/parser.y -o ${CMAKE_BINARY_DIR}/libs/test/parser.cxx TARGET ScannerAndParser DEPENDS ${CMAKE_BINARY_DIR}/libs/test/parser.cxx OUTPUTS ${CMAKE_BINARY_DIR}/libs/test/parser.cxx) file(GLOB lib_sources *.cxx ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx ${CMAKE_BINARY_DIR}/libs/test/parser.cxx) set_source_files_properties(${CMAKE_BINARY_DIR}/libs/test/parser.cxx GENERATED) add_library(test STATIC ${lib_sources}) add_dependencies(test ScannerAndParser) Thomas Lehmann Scrum Master [cid:rts-logo.png@fbda10bfcd534b0b8e20728cd423552e] RTS Realtime Systems Software GmbH, Rembrandtstrasse 13, D-60596 Frankfurt am Main T: +49.69.61009.0 / F: +49.69.61009.181 Sitz: Frankfurt am Main - HRB 84467 Amtsgericht Frankfurt am Main Gesch?ftsf?hrer: Steffen Gemuenden, Igor Sluga www.rtsgroup.net This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify me immediately by return email and promptly delete this message and its attachments from your computer system. <>___ 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] Dependency not executed, why?
2010/11/19 Thomas Lehmann > > Hi, > > > > I’ve found an example to use bison and flex in cmake. > > I have a static library where I want to add the generated > > sources but the dependencies are not triggered. Why? > > > > project(test) > > > > include_directories(. > > ${CMAKE_BINARY_DIR}/libs/test) > > > > add_custom_target(ScannerAndParser echo "Creating scanner.cxx and parser.cxx") > > > > add_custom_command( > > SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l > > COMMAND flex > > ARGS -o ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx > > ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l > > TARGET ScannerAndParser > > DEPENDS ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx > > OUTPUTS ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx) OUTPUTS (with 'S') should be OUTPUT (without 'S') I don't know the SOURCE option ? Which version of CMake do you use? -- 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