I had a look at the cmake files in blender and noticed that the SUBDIRS() command is used instead of the newer ADD_SUBDIRECTORY() command.
The main difference between the two is that ADD_SUBDIRECTORY() is processed
immediately, while the directories added with SUBDIRS() are processed after
everything else in the CMakeLists.txt has been processed. This is usually not
what one would expect, so using ADD_SUBDIRECTORY() is usually better.
Example:
src/CMakeLists.txt:
subdirs(somedir)
set(FOO "foo")
src/somedir/CMakeLists.txt
message(STATUS "FOO: ${FOO}")
----------------------------------------
With subdirs() the message() in the subdirectory will print "foo", even although FOO is set _after_ the subdirs() command.
When replacing the subdirs() in this example with add_subdirectory() FOO will be empty in somedir/CMakeLists.txt, as one would expect if everything is processed in order.
The attached changes all SUBDIRS() in blender to ADD_SUBDIRECTORY()
Please apply if you think it makes sense.
Alex
Description
Description
Event Timeline
Comment Actions
There was a bug in subdirs.diff, one SUBDIRS() with two directories was translated to only one ADD_SUBDIRECTORY(). subdirs-2.diff does it correctly.
Alex
Comment Actions
diff reports that the created binary blender executables differ. At least they have exactly the same size in bytes.
When comparing the complete build log for both, the only difference is that the order of building a few source files has changed, nothing else. So maybe that changed order is the only difference.
I did a "make blender" and some grepping to remove the progress reporting to get the logs.
Alex