Re: [CMake] New version forces rebuild all?
On Wed, Dec 5, 2018 at 10:19 PM Andy wrote: > (previously I send this mail not to mail list, but user) > Maybe my cmake files are bad? > I have created test project > https://gitlab.com/andrzejbor/test_rebuild_all > after commit is rebuild whole project > what I might change? > I don't want moving all but .git to one directory src/ > > The problem is that you add the GIT variables as compile time defines, which means that after every commit you will have different compile command lines, which trigger recompilation of whole project because you have used add_definitions. You should instead write those GIT variables in a file, like this: file(WRITE ${CMAKE_BINARY_DIR}/git_version.h.in " #define GIT_SHA1 \"@GIT_SHA@\" #define GIT_TAG \"@GIT_TAG@\" #define GIT_LOCAL_CHANGES \"@GIT_LOCAL_CHANGES@\"" ) configure_file(${CMAKE_BINARY_DIR}/git_version.h.in ${CMAKE_BINARY_DIR}/git_version.h @ONLY) Make sure you have ${CURRENT_BINARY_DIR} as part of your target's include directories. And then somewhere in your code do an #include "git_version.h". Cheers, Cristian. -- 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
[CMake] New version forces rebuild all?
(previously I send this mail not to mail list, but user) Maybe my cmake files are bad? I have created test project https://gitlab.com/andrzejbor/test_rebuild_all after commit is rebuild whole project what I might change? I don't want moving all but .git to one directory src/ -- 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] New version forces rebuild all?
Le mar. 4 déc. 2018 à 11:44, Andy a écrit : > Problem are still. > Alone make also give me problems. > Do you have stripped down project example? > Ninja is replacement od cmake or make? > ninja (https://ninja-build.org/) is make replacement for which there is a CMake generator. https://cmake.org/cmake/help/v3.13/generator/Ninja.html > How work with ninja? > 1) install ninja (on debian the package is called ninja-build) 2) cmake -G Ninja 3) ninja this would rule out generator specific issue. -- Eric -- 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
[CMake] New version forces rebuild all?
I have cmake project, I usuall call "cmake ." followed by make. Now I have installed cmake 3.12.3 (was impossible install by apt-get) I have following problem: If I change one *.cpp file, in most cases make rebuilds all *.cpp files, not related to this file. Sometimes is ok. -- 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