[CMake] Location of library to be linked changing over time

Bill O'Hara billtohara at gmail.com
Thu Apr 30 20:41:32 EDT 2009


Thanks for the suggestion - a useful trick to have. I'd love an automatic
way to trigger it though rather than having to run make rebuild_cache or
thiis unset of the variable.


On Thu, Apr 30, 2009 at 5:16 PM, Philip Lowman <philip at yhbt.com> wrote:

> 2009/4/30 Bill O'Hara <billtohara at gmail.com>
>
>> Thanks - I wasn't sure I was explaining very clearly! I think
>> "retriggering find_library" is a far more concise way to say it.
>>
>> Could perhaps a cmake developer comment on whether its possible to do
>> this? Is there some workaround we could currently use to retrigger the
>> find_library to check whether we need to relink before running an executable
>> via a make target?
>>
>
> I'm not really a cmake developer, but you might try Bill's suggestion of
> unset(VAR CACHE).
> You could consider something like this, if you're looking for an
> interactive way to do it.
>
> if(RETRIGGER_SEARCH_FOR_FOO)
>    unset(FOO_LIBRARY CACHE)
>    unset(FOO_INCLUDE_DIR CACHE)
>    # etc.
>    unset(RETRIGGER_SEARCH_FOR_FOO CACHE)
> endif()
> option(RETRIGGER_SEARCH_FOR_FOO "Search again for Foo" OFF)
>
> find_package(FOO)
>
>
> Also, often this goes unspoken on the mailing list but do bear in mind that
> not all IDEs force recompilation of source files when you change include
> directories or force relinking when you change library filenames (VS with
> CMake generated project files is a prime example).  Unless you know exactly
> what you're doing in terms of changing preprocessor definitions, include
> directories, or import libraries, it's usually safest to clean the entire
> solution after changing your build configuration.
>
> --
> Philip Lowman
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090430/6c757241/attachment.htm>


More information about the CMake mailing list