Hi all.<br><br>I believe the reason is that EXCLUDE_FROM_ALL excludes the target from the default &#39;all&#39; target (Makefiles), which is represented by the custom target ALL_BUILD in Visual Studio. EXCLUDE_FROM_DEFAULT_BUILD instead works with Visual Studio&#39;s &quot;Build Solution&quot; command, which has no direct equivalent in the Makefile world.<br>
<br>This means projects using VS solutions as &quot;just a way to do command-line builds on Windows&quot; probably use ALL_BUILD and are fine with setting just EXCLUDE_FROM_ALL. Projects which expect their developers to actively work in the VS IDE (and thus use &quot;Build Solution&quot; and the like) have to set both EXCLUDE_FROM_* properties.<br>
<br>Petr<br><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 11:14 PM, Robert Dailey <span dir="ltr">&lt;<a href="mailto:rcdailey.lists@gmail.com" target="_blank">rcdailey.lists@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The library itself depends on other ones I generated, but it isn&#39;t a<br>
dependency itself.<br>
<br>
I did some more research and setting EXCLUDE_FROM_DEFAULT_BUILD<br>
worked... I find it strange that there are 2 properties that<br>
essentially should do the same thing, but cause different behavior<br>
depending on the selected generator:<br>
<br>
<br>
function( _exclude_target target_name )<br>
    set_target_properties(<br>
        ${target_name} PROPERTIES<br>
        EXCLUDE_FROM_DEFAULT_BUILD TRUE<br>
        EXCLUDE_FROM_ALL TRUE<br>
    )<br>
endfunction()<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Feb 8, 2013 at 4:01 PM, David Cole &lt;<a href="mailto:dlrdave@aol.com">dlrdave@aol.com</a>&gt; wrote:<br>
&gt; Does another library that you add later depend on that one? Or an<br>
&gt; executable?<br>
&gt;<br>
&gt; If so, then the library will be added because it&#39;s required by dependencies,<br>
&gt; despite your request to exclude it from all.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: Robert Dailey &lt;<a href="mailto:rcdailey.lists@gmail.com">rcdailey.lists@gmail.com</a>&gt;<br>
&gt; To: CMake &lt;<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>&gt;<br>
&gt; Sent: Fri, Feb 8, 2013 4:59 pm<br>
&gt; Subject: [CMake] EXCLUDE_FROM_ALL not working?<br>
&gt;<br>
&gt; I am calling add_library like so:<br>
&gt;<br>
&gt; set( project_name mylib )<br>
&gt; set( files main.cpp main.h )<br>
&gt; set( exclude_flag EXCLUDE_FROM_ALL )<br>
&gt; add_library( &quot;${project_name}&quot; SHARED ${exclude_flag} ${files} )<br>
&gt;<br>
&gt; When I generate for Visual Studio 2008, I check the build<br>
&gt; configuration and the mylib project is still setup to build when I<br>
&gt; invoke Build Solution. Why isn&#39;t this flag working?<br>
&gt; --<br>
&gt;<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the CMake FAQ at:<br>
&gt; <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br>