Visual Studio: Multiple BUILD_ALL projects created when using ExternalProject_Add
I have justed added GoogleTest to my CMake project via the "official" way described here (using ExternalProject_Add
): https://github.com/google/googletest/blob/master/googletest/README.md
Now, the Visual Studio solution contains two projects both with the name ALL_BUILD
.
I now have no way to differentiate them and thus cannot do things like this (the incorrect ALL_BUILD
is used in the below example):
add_dependencies(generate_installer ALL_BUILD)
Is this intended behaviour? Can we prevent projects added via ExternalProject_Add
from creating and adding the ALL_BUILD
target to the solution?
- CMake 3.14.2, 3.14.4
- Visual Studio 2017
Simple example demonstrating this issue attached. build_all_issue.zip
It seems like the cause of this is calling add_dependencies
in a separate CMakeLists.txt which is added via a add_subdirectory
call:
add_dependencies(generate_installer ALL_BUILD)
If this command is moved to the top-level CMakeLists.txt, the extra ALL_BUILD
goes away.