[CMake] Linking and CMakelists.txt

Brad King brad.king at kitware.com
Thu Jun 22 16:03:04 EDT 2006


Steve Johns wrote:
> Hi.
> 
> I have a project that links to an external library that I've build 
> successfully (in MSVC 7.1) using
> 
> LINK_LIBRARIES()    and    LINK_DIRECTORIES()
> 
> in my CMakelists.txt file.
> 
> When I delete one or both of these directives, the project still 
> builds!   I don't see how it can, without the info on how to find the 
> library.
> 
> Then, if I futz around enough with it (imprecise term, I know), 
> eventually the project will cease to build.
> 
> Then, if I futz some more, restoring  LINK_LIBRARIES()    and 
> LINK_DIRECTORIES() it will build again (eventually).
> 
> I was under the impression that edits to the CMakelists.txt file were 
> detected by CMake, which would then "start over" and act in accord with 
> the current definitions (or lack of) in the CMakelists.txt file.
> 
> It is clear that my understanding requires correction or qualification, 
> and I'd be much obliged if anyone can surmise what's occurring here and 
> clue me in.

The changes are processed by CMake immediately and the project files are 
regenerated.  However, VS 7.1 does not seem to reliably reload the new 
project files always.  Try exiting VS and running CMake by hand and then 
reloading the project in VS after editing a file.

-Brad


More information about the CMake mailing list