Question

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!

Was it helpful?

Solution 2

subdirs is deprecated, use add_subdirectory

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top