Thanks very much for taking a careful look at this, Bill.

The source files in my test were more or less the same as yours but I
changed them to be identical.

Most of my previous tests were with the 2013 Express version of VS but
I had also done a couple of tests with 2010 Express. Previously, I
was seeing the same dependency behavior problem with both versions.
I did this latest test with 2010 Express. The version of that I currently
have installed is: Version 10.0.40219.1 SP1Rel.

After I change MySub.cpp, either with "touch" or by editing the file in the
GUI, and rebuild either with the F7 key or by selecting the "Build Solution"
menu item, I see something like this:

$ ls -l cmTest*/Debug
cmTestLib/Debug:
total 4
----------+ 1 bgreene None 2742 Oct  6 13:59 cmTestLib.lib

cmTestMain/Debug:
total 692
----------+ 1 bgreene None  28160 Oct  6 13:46 cmTestMain.exe
----------+ 1 bgreene None 312688 Oct  6 13:46 cmTestMain.ilk
----------+ 1 bgreene None 363520 Oct  6 13:46 cmTestMain.pdb

If I do, "Rebuild Solution", not surprisingly, both the lib and exe get
rebuilt.

 >This could be a bug in VS as CMake has very little to do with depends
like this and the VS IDE.

I'm certainly not an expert with Visual Studio but this sure has all the
appearances of a VS bug.
The VS solution generated by cmake looks "right" to me. However, the fact
that this behavior occurs
in both VS 2010 and VS 2013 seems surprising.

Bill

On Mon, Oct 6, 2014 at 10:51 AM, Bill Hoffman <[email protected]>
wrote:

> Bill,
>
> I want to reset this conversation a bit.  What you are doing should work
> no problem.  Most of the suggestions should not be needed.  I do agree that
> glob is bad, but it will cause different problems.   Anyway, I created the
> following example based on your posts and it works with VS 2010.   Can you
> try this and report back?  This could be a bug in VS as CMake has very
> little to do with depends like this and the VS IDE.
>
> I did this to test:
> $ ls -l b/cmTestMain/Debug/
> total 684
> -rwxr-xr-x 1 hoffman Domain Users  28160 Oct  6 10:47 cmTestMain.exe
>
> hoffman@quasar ~/Work/dep
> $ touch cmTestLib/MySub.cpp
>
> #build from VS IDE and exe relinks
> hoffman@quasar ~/Work/dep
> $ ls -l b/cmTestMain/Debug/
> total 684
> -rwxr-xr-x 1 hoffman Domain Users  28160 Oct  6 10:48 cmTestMain.exe
>
>
> hoffman@quasar ~/Work/dep
> $ touch cmTestLib/MySub.h
>
> # build from VS IDE exe relinks again
> hoffman@quasar ~/Work/dep
> $ ls -l b/cmTestMain/Debug
> total 684
> -rwxr-xr-x 1 hoffman Domain Users  28160 Oct  6 10:49 cmTestMain.exe
>
>
>
>
> top level:
> -----------
> cmake_minimum_required (VERSION 2.8)
> project(cmTest)
> add_subdirectory (cmTestLib)
> add_subdirectory (cmTestMain)
>
> cmTestLib
> --------------
> add_library (cmTestLib STATIC MySub.cpp MySub.h)
>
> ------ cmTestLib/MySub.cpp
> #include "MySub.h"
>
> int hello()  { return 0;}
>
> ----- cmTestLib/MySub.h
> int hello();
>
> cmTestMain
> ----------------
> include_directories (${cmTest_SOURCE_DIR}/cmTestLib)
> add_executable (cmTestMain cmTestMain.cpp)
> target_link_libraries (cmTestMain cmTestLib)
>
>
> Here are the source files:
>
> ------ cmTestLib/MySub.cpp
> #include "MySub.h"
>
> int hello()  { return 0;}
>
> ----- cmTestLib/MySub.h
> int hello();
>
> cmTestMain/cmTestMain.cpp
>
> #include "MySub.h"
>
> int main()
> {
>   return hello();
>
> }
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to