简体   繁体   中英

in CMake, What's the difference between command SUBDIRS() and ADD_SUBDIRECTORY()

in CMake, What's the difference between command SUBDIRS() and ADD_SUBDIRECTORY()

when i read PoDoFo src, i found some CMakeLists.txt use SUBDIRS some use ADD_SUBDIRECTORY, I am novice! thanks!

From the CMake Mailing List :

ADD_SUBDIRECTORY() processes the subdir at the time it is called, whereas SUBDIRS() pushes the dirs onto a list which is processed at the end of the current CMakeLists file - this is the old behaviour and some vars are initialized 'out of order', or at least in unexpected order.

(...)

So, if you set variables in the parent directory they will not be seen in the subdir when SUBDIRS() is used.

Furthermore it is recommended in CMake's Documentation that you should use ADD_SUBDIRECTORY() instead, as SUBDIRS() is deprecated.

subdirs is deprecated, use add_subdirectory

http://www.cmake.org/cmake/help/git-next/command/subdirs.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM