[CMake] Why is target is not added to default built in Visual Studio?
Dirk Steenpass
dirk.steenpass at gmail.com
Wed Jun 11 11:57:16 EDT 2014
Hi,
this is my second attempt on the topic. As I could not make myself any
clearer I re-post a question by William Deurwaarder on Apr 11, 2014.
Thanks,
Dirk Steenpass
-----------------------------------------------------
Summary: What is the reason that custom-targets that are needed by a
project and its dependencies are not added to the default-build in Visual
Studio in case that target is defined out-side the sub-directory tree of
this project?
I have the following directory-structure:
root/A -> in this CMakeLists.txt a custom-target is defined
root/B -> in this CMakeLists.txt a static-library is defined which depends
on A (A will generate files for this library)
root/C -> in this CMakeLists.txt the executable is defined which depends on
B (there is no dependency added for A; of course that could be done in this
case but my real case is much more complex and I do not want to explicit
lists all custom-target dependencies here)
root -> in this CMakeLists.txt all three sub-directories are added.
The real case is much more complex and I cannot add A under C, or put C in
the root, etc.
With Linux and make this works fine. For Windows and Visual Studio the
solution-file of C (in directory of C) does not add A to the default-build
(although it is added as a dependency for B). This means that A is not
executed which results in compiler-errors as B misses files that should
have been generated by A.
Looking into the code I see that the line to add A to the default-build
(IsPartOfDefaultBuild) is conditional for UTILITY-targets (it is only added
if there is a direct dependency that means or is part of the sub-directory
of C or has a direct dependency which is added by add_dependencies). My
question is what is the reason to exclude A from the default-build in case
it has a transitive dependency (via B)? Would it be possible to change that
so in case A is needed via a transitive dependency A is also included to
the default-build.
Thanks for your insight and answers,
William Deurwaarder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140611/af6cc8d2/attachment.html>
More information about the CMake
mailing list