Hello List,

In our projects we are using static linkage on Windows (MSVC) and Linux. A
number of static libs are created and then linked into executables, such as
unit tests, tools and the actual production artifacts. Very normal stuff.

add_library(mylib STATIC mysources)
add_excecutable(mytest mytest.cpp)
target_link_libraries(mytest mylib)

Now although I don't understand the exact reasons behind that, over the
years came to accept that depedencies between the lib and the resulting
artifcats are not working. Like, when I change a source file to mylib, the
lib will get rebuilt but the resulting test tool won't be relinked.
For test driven development or busy change cycles that can put quite a
strain on effort, especially on windows. My normal workflow is that I
always click in mytest.cpp, add and remove a space to mark it dirty as
quickly as possible and thereby cause the rebuild. But sometimes I forget
this and this caused me quite a bit of extra work.
My question is, can I fake that dependency somehow? Perhaps by some hack or
using some workaround?

What I want to achieve is that when I change the lib, the unit test (or any
other test tool using it) that depends on it will be relinked, even if it
has not changed.

Is that possible somehow?

Cheers,
Stephan
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to