Re: [CMake] ?==?utf-8?q? Looking for an explanation: What exactly means "install" in cmake language?
Thanks to both you and J Decker: I would say that this is still the part that I understood! So basically the word "install" in cmake language could be replaced by "copy" more or less in common human language - right? But then, if it is about "installing" a "target", which is libraries in my case, I would expect the shared libraries to be copied - no? And this is exactly what does not happen - for no obvious reason! Because some days ago it even happened in my project ONCE - and then not any more. But debugging is not easy because since that moment I changed many things, and basically the reason for my question is that I have no clear idea what EXACTLY should happen if I put a install(TARGETS mylibrary) into my CMakeLists.txt. Well, like you explained, and like what I also thought I had understood: nothing should happen during the configure and generate runs of cmake, and also not during the "ninja all" build run, but only during the "ninja install". or else cmake --build . --target install (which in turn calls ninja in my case). Indeed I observed that it does a build for "all" first if the initial project is not up to date. But then it tells me that it is successfully "installing" mylibrary, but I see no shared library appearing in the install tree! Or rather: it happened once, but not any more - and I should find out what is missing... My current workaround is indeed that I am trying to avoid the install step altogether and build a crazy construction with configure_file stuff in order to get the libraries to the right place - and I know pretty well that this is NOT the way how things should be done properly. But I am afraid I will be ready with this workaround way faster than I will understand what is going on during this miraculous "install" process! -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] ?==?utf-8?q? Looking for an explanation: What exactly means "install" in cmake language?
A note - INSTALL( FILES ) is only good for data files, if you have scripts that have executable permissions using INSTALL( PROGRAMS ) will get execute flag set too. On Mon, Oct 7, 2019 at 7:49 AM Cornelis Bockemühl wrote: > Thanks to both you and J Decker: I would say that this is still the part > that I understood! So basically the word "install" in cmake language could > be replaced by "copy" more or less in common human language - right? > > But then, if it is about "installing" a "target", which is libraries in my > case, I would expect the shared libraries to be copied - no? > > Targets use ,... depending on add_executable, or add_library was used( and/or if STATIC/SHARED is specified in add library ) > And this is exactly what does not happen - for no obvious reason! Because > some days ago it even happened in my project ONCE - and then not any more. > But debugging is not easy because since that moment I changed many things, > and basically the reason for my question is that I have no clear idea what > EXACTLY should happen if I put a > > install(TARGETS mylibrary) > I usally put it immediately after the thing that added the target... > > into my CMakeLists.txt. Well, like you explained, and like what I also > thought I had understood: nothing should happen during the configure and > generate runs of cmake, and also not during the "ninja all" build run, but > only during the "ninja install". or else cmake --build . --target install > (which in turn calls ninja in my case). Indeed I observed that it does a > build for "all" first if the initial project is not up to date. > right, it's an 'install' target.. make install ; ninja install, ... etc ya > > But then it tells me that it is successfully "installing" mylibrary, but I > see no shared library appearing in the install tree! Or rather: it happened > once, but not any more - and I should find out what is missing... > When I have issues like that, `cmake --trace ...` option gives a good idea of what cmake thinks it's doing... or maybe ninja V=1 install ? It is copy-if-different, so if the build re-builds and generates the same output library it won't re-install... You can set set( CMAKE_INSTALL_MESSAGE "LAZY" ) which only emits messages for things it actually installs (just a side note) But I don't know why it's not going where you think it is ( somewhere in CMAKE_BINARY_DIR IIRC? or did you use CMAKE_CURRENT_BINARY_DIR which can be deeply in install) I do often set my install to 'output' which by default is put into the build directory... > My current workaround is indeed that I am trying to avoid the install step > altogether and build a crazy construction with configure_file stuff in > order to get the libraries to the right place - and I know pretty well that > this is NOT the way how things should be done properly. But I am afraid I > will be ready with this workaround way faster than I will understand what > is going on during this miraculous "install" process! -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] ?==?utf-8?q? Looking for an explanation: What exactly means "install" in cmake language?
>Le lun. 7 oct. 2019 à 16:49, Cornelis Bockemühl a >écrit : > >> Thanks to both you and J Decker: I would say that this is still the part >> that I understood! So basically the word "install" in cmake language could >> be replaced by "copy" more or less in common human language - right? > >Nope I oversimplified. >This is not a bare copy, e.g. the runtime path (a.k.a. RPATH or RUNPATH) is >updated as well. Well yes, I understood that there are "some" other things happening - and I did not think about RPATH or RUNPATH - because so far I never cared for them... At this moment I finally have a setup running where shared libraries are simply copied over with configure_file - without care for RPATH etc. -, and it's working finally! But definitely now like the inventors of cmake have thought it should, with a lot reinventing wheels etc... >> But then, if it is about "installing" a "target", which is libraries in my >> case, I would expect the shared libraries to be copied - no? > >Yes the shared lib should be coped and its RPATH updated. > >> And this is exactly what does not happen - for no obvious reason! Because >> some days ago it even happened in my project ONCE - and then not any more. >> But debugging is not easy because since that moment I changed many things, >> and basically the reason for my question is that I have no clear idea what >> EXACTLY should happen if I put a >> >> install(TARGETS mylibrary) >> >> into my CMakeLists.txt. Well, like you explained, and like what I also >> thought I had understood: nothing should happen during the configure and >> generate runs of cmake, and also not during the "ninja all" build run, but >> only during the "ninja install". or else cmake --build . --target install >> (which in turn calls ninja in my case). Indeed I observed that it does a >> build for "all" first if the initial project is not up to date. >> >> But then it tells me that it is successfully "installing" mylibrary, but >> I see no shared library appearing in the install tree! Or rather: it >> happened once, but not any more - and I should find out what is missing... > >Are building out-of-tree? (Are your source tree and build tree separate dir?) >If so, did you try removing the entire build tree and try again ? Yes, it's out of tree. And also I did this removal and rebuild! This is exactly how I realized my problem: I had done once an "install build" that copied library files to the target - and everything looked find from then on. Until I did that exercise - and realized that nothing is copied any more! And because I could not find any plausible reason why this library copying did not happen any more, I gave this "install" business up for the moment... >May be there is probably some mixup with your install DESTINATION in your >install command. The problem is that I did not even change anything in that part of the project from the moment when it "accidentally" happened once... But sure, it is never pure magic: I MUST have done something "wrong"! >> My current workaround is indeed that I am trying to avoid the install >> step altogether and build a crazy construction with configure_file stuff >> in order to get the libraries to the right place - and I know pretty >> well that this is NOT the way how things should be done properly. But I >> am afraid I will be ready with this workaround way faster than I will >> understand what is going on during this miraculous "install" process! > >Provide us with a stripped down non-working example and we may dig into it. >Otherwise it is very difficult to guess what is happening in your particular >case. That's exactly my problem: I am working on a ParaView custom project, and then trying to "derive" another one from the first! So there is nothing to be easily "stripped down" - it is simply a monster project - and I am almost sure if I am going to write a simple dummy project, everything will just work fine... And this is why I was asking for a more thorough documentation that what you can find at Kitware where not the processes are explained, but just "what to do". So from what I see, if you start a cmake project from scratch, you can start with simple concepts and add towards more complex ones, with growing understanding. However, if you start to build on ParaView, you start in the middle of an already highly complex project setup, with little documentation than just examples - and the entire process feels a bit like learning C++ with only the source code of a C++ compiler at hand: certainly possible, but takes a horrible amount of time... ;-) Side remark: Regarding cmake, this is also the reason why some days ago I was asking for certain improved functionalities for debug support, like a way to simply dump a list of "current targets" (including imported!), plus a way to dump also all valid "properties" of targets! Bottom line: Since such a documentation like I would like to find may not even exist, I think I should be happy that I have a "someh
Re: [CMake] ?==?utf-8?q? Looking for an explanation: What exactly means "install" in cmake language?
> I think that the word install is used consistently between GNU autotools and > CMake: Right, looks like it comes from the "good old times" when on Linux computers software was "installed" by downloading, then doing a "make" and a "make install" in order to get it running, while nowadays "installation" is normally done by a package manager that tries to resolve dependencies and works with binaries only. And CMake does some tricky things to do an "install" in order to later on "export" and "import" the code, or prepare it for "pack" etc. > It's that "prepare it for..." clause that makes it different from a straight > up copy. In my case it looks like it "somehow works" for now without other preparations - but I hate this "solution" because it is against all "good cmake use" that would rather deal with targets and properties only, not with variables and directly copying files around, fiddling with shared library extensions (like so or dll) - but if working "the right way" takes so much time to figure out, it's finally a question of time economy that you finally end up with doing it "the hard way". (...which is of course the opposite of what a build tool should do for you: It should not make project setup more complicated, but more simple! But well - that's the real world ;-) ) -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake