[CMake] Undocumented change of behavior when using EXCLUDE_FROM_ALL

Jakub Imriska imriska at photoneo.com
Mon Sep 23 10:24:44 EDT 2019

Hi CMake community,

of *add_subdirectory* command affects in CMake 3.14.3 the content of the
Visual Studio solution file in the added subdirectory.
The difference is subtle: if the subdirectory A added with EXCLUDE_FROM_ALL
from source root contains another subdirectory B, a solution file in A
does *not
contain* project from B.
The behavior changed between versions 3.13.5 and 3.14.3. Tested also on
3.15.0, which produces same output as 3.14.3.Observed on Win 10 using *Visual
Studio 16 2019* and *Visual Studio 12 2013 Win64 *generators.
Test with *CodeBlocks - Unix Makefiles *generator does not show this issue.

Is there a way to retain the old behavior?
Thanks for an advice.

Minimal example (attached):

$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_subdirectory(subdir EXCLUDE_FROM_ALL)

$ cat subdir/CMakeLists.txt

$ cat subdir/subsubdir/CMakeLists.txt
add_executable(util util.cpp)

With CMake 3.13.5 the utilities solution file contains project util,
whereas with CMake 3.14.3 or 3.15.0 it does not.


Jakub Imriška

*Programmer and research developer*, Photoneo s. r. o. - Focused on 3D

Meet us:
CIIF <http://www.ciif-expo.com/en/>, IAS 
<http://www.industrial-automation-show.com/>, booth #C010, Hall 8.1 H, 
17-21 September 2019, Shanghai (CN)
MOTEK <https://www.motek-messe.de/en>, 
booth  #7513, Hall 7,  7-10 October 2019, Stuttgart (DE)
Engineering Fair Brno 2019 <https://www.bvv.cz/en/msv/>, ABB booth #093, 
Hall P, 7-11 October 2019, Brno (CZ)  

tabletop 3, 12-13 November 2019, San Jose (CA)

SPS IPC Drives 
booth #202, Hall 8, 26-28 November 2019, Nuremberg (DE) 


e-mail was sent by Photoneo s.r.o. and may contain confidential and/or 
proprietary information. If you are not the intended addressee, please 
inform the sender immediately and delete this e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190923/ba66eee5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMake_EXCLUDE_FROM_ALL_example.zip
Type: application/x-zip-compressed
Size: 1308 bytes
Desc: not available
URL: <https://cmake.org/pipermail/cmake/attachments/20190923/ba66eee5/attachment.bin>

More information about the CMake mailing list