[CMake] Fake dependencies of executables to static libs
Hello List, In our projects we are using static linkage on Windows (MSVC) and Linux. A number of static libs are created and then linked into executables, such as unit tests, tools and the actual production artifacts. Very normal stuff. add_library(mylib STATIC mysources) add_excecutable(mytest mytest.cpp) target_link_libraries(mytest mylib) Now although I don't understand the exact reasons behind that, over the years came to accept that depedencies between the lib and the resulting artifcats are not working. Like, when I change a source file to mylib, the lib will get rebuilt but the resulting test tool won't be relinked. For test driven development or busy change cycles that can put quite a strain on effort, especially on windows. My normal workflow is that I always click in mytest.cpp, add and remove a space to mark it dirty as quickly as possible and thereby cause the rebuild. But sometimes I forget this and this caused me quite a bit of extra work. My question is, can I fake that dependency somehow? Perhaps by some hack or using some workaround? What I want to achieve is that when I change the lib, the unit test (or any other test tool using it) that depends on it will be relinked, even if it has not changed. Is that possible somehow? Cheers, Stephan -- 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] Does enable_language(CUDA) still have the problem with reconfiguring?
Yes, we are dependent on the CUDA extensions for ms-build working correctly. On Mon, Apr 1, 2019 at 5:02 PM Mojca Miklavec wrote: > > On Mon, 1 Apr 2019 at 22:11, Robert Maynard via CMake wrote: > > > > For MSBuild we rely on the CUDA extensions written by nvidia which do > > proper dependency tracking. > > Except when they don't. It drove me nearly crazy that any given > trivial change had to be followed by a complete rebuild of the > project. > > But I see that someone commented an hour ago: > > https://stackoverflow.com/questions/48183845/visual-studio-2017-not-detecting-change-in-cu-cuda-files > saying that the fix has finally arrived (in March). > > Mojca -- 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] Does enable_language(CUDA) still have the problem with reconfiguring?
On Mon, 1 Apr 2019 at 22:11, Robert Maynard via CMake wrote: > > For MSBuild we rely on the CUDA extensions written by nvidia which do > proper dependency tracking. Except when they don't. It drove me nearly crazy that any given trivial change had to be followed by a complete rebuild of the project. But I see that someone commented an hour ago: https://stackoverflow.com/questions/48183845/visual-studio-2017-not-detecting-change-in-cu-cuda-files saying that the fix has finally arrived (in March). Mojca -- 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] Does enable_language(CUDA) still have the problem with reconfiguring?
It doesn't have this behavior. For Makefile and Ninja generators we get the proper header dependencies at compile time just like we do for C or C++. For MSBuild we rely on the CUDA extensions written by nvidia which do proper dependency tracking. On Sat, Mar 30, 2019 at 4:12 PM JR Cary wrote: > > Re the thread below, > > Does the newer, enable_languagedo a better job of not having the > repeated reconfigurations and full project rebuilds as described at > > https://cmake.org/pipermail/cmake/2011-January/042173.html > > and many times after? > > John > > > > On 3/30/19 6:45 AM, cmake-requ...@cmake.org wrote: > > - > > Message: 4 > > Date: Sat, 30 Mar 2019 12:45:07 + > > From: Luis Caro Campos > > > > I believe the closest equivalent to settinga CUDA_TOOLKIT_ROOT_DIR when > > using enable_language(CUDA) is to set either the environment variable > > CUDACXX or the CMake cache entry CMAKE_CUDA_COMPILER to point to the > > location of the nvcc compiler. > > > > However I think there are still some "features" of FindCUDA that > > enable_language don't support, e.g. variables and/or import targets with > > locations, see https://gitlab.kitware.com/cmake/cmake/issues/17816 > > > > Kind regards, > > Luis > > > > On Fri, Mar 29, 2019 at 4:57 PM Dustyn Blasig wrote: > > > >> "we should not try to combine enable_language(CUDA) with > >> find_package(CUDA). They do not work together, either use one or another." > >> > >> Absolutely, my goal is to move to the new built-in language support. I'm > >> having trouble doing that because I can't find any documentation on it. For > >> instance, what is the new equivalent CUDA_TOOLKIT_ROOT_DIR? Without > >> find_package(CUDA), I don't see anything set that have the equivalent. > >> Also, in some cases the CUDA include directory is added to targets, and in > >> other cases it isn't, even if the target depends on source with .cu. What > >> is the documented behavior for this? > >> > >> I'm sure there has to be a page somewhere on this, but going to page 4 on > >> Google search didn't uncover anything, and the first 2 pages all point to > >> various versions of FindCUDA : ) > >> > >> On Fri, Mar 29, 2019 at 11:28 AM Dmitry Mikushin < > >> dmi...@parallel-computing.pro> wrote: > >> > >>> Hi, > >>> > >>> That was my confusion as well: to my understanding, we should not try to > >>> combine enable_language(CUDA) with find_package(CUDA). They do not work > >>> together, either use one or another. > >>> > >>> Kind regards, > >>> - Dmitry. > >>> > >>> ??, 29 ???. 2019 ?. ? 19:58, Dustyn Blasig : > >>> > Hi All, > > I can't find any documentation on the new-ish "native" CUDA support. I > need to know all the variables that we can use, and (for instance) > whether > checking the CUDA version is now supported. When searching online, I'm > always directed to the old FindCUDA pages which don't seem to match what > is > available with the native language support. > > Currently, I'm "hacking" my way through things by using both flows. I > add CUDA as a language, use the found CUDA compiler to construct a > CUDA_TOOLKIT_ROOT_DIR and then call find_package(CUDA) to get the old > environment variables set up. > > Cheers! > > > -- > > 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