Ilya Shvetsov wrote:
On Wed, 09 Apr 2008 10:55:35 +0300, Jean Lepropre
<[EMAIL PROTECTED]> wrote:

Hi,

I have a somewhat strange problem when linking with static libraries. I
have an executable that
links to a static library. If I modify only a source (cpp) file of the
static lib, the lib is rebuilt and
reinstalled but the executable is not relinked to the static lib (so
changes are not reflected in the
executable...).


I have the similar problem.
I use MSVC NMake Generator
Library comes from external engine.


You must use a FULL path to the library or CMake will not know what depend information to add. If you have:
add_executable(foo foo.c)
link_directories(foobar)
target_link_libraries(foo A B C)

And A, B and C are libraries in the foobar directory that are not built by CMake, then there will be no depends on the external libraries as CMake does not know where they are.

The correct thing to do would be:

find_library(ALIB A)
find_library(BLIB B)
find_library(CLIB C)
target_link_libraries(foo "${ALIB}" "${BLIB}" "${CLIB}")

Then CMake will have the full path to A,B, and C, and if one of them changes foo will be relinked.

-Bill

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to