You can re-use the same CMakeLists.txt with add_subdirectory as long as each call specifies a different binary directory. Not saying this is a particularly good design, but it is allowable. E.g.
# First time with a particular value of someVar set(someVar 1234) add_subdirectory(foo foo1) # Do it again with a different someVar set(someVar abcd) add_subdirectory(foo foo2) Instead of trying to re-use a whole CMakeLists.txt, consider defining a function or macro instead and call that in the places where you want to re-use the same code. On Tue, Nov 7, 2017 at 7:28 AM, Konstantin Tokarev <annu...@yandex.ru> wrote: > > > > I have a CMAKELIST.txt file which can be used for more than 1 > subdirectory. > > > > Is there a way to "reuse" this CMAKELISTS.txt file? > > > > I have tried placing this file at a common folder and then to place a > shortcut or softlink in the sub-directories. > > Instead of link you can create CMakeLists.txt in each directory with > include() of your common file > > > > > But, this does not work. CMAKE does not seem to recognize the link. > > > > Any help would be much appreciated. > -- > Regards, > Konstantin > -- > > 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: > http://public.kitware.com/mailman/listinfo/cmake > -- Craig Scott Melbourne, Australia https://crascit.com
-- 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: http://public.kitware.com/mailman/listinfo/cmake