[CMake] Project being (unnecessarily) relinked
Jack Kelly
endgame.dos at gmail.com
Wed Sep 12 04:20:13 EDT 2007
Jesper Eskilson wrote
> Well, that turned out to be a little hasty conclusion.
>
> In case of linking with a DLL, having paths to both the dll and import
> lib in LINK_DIRECTORIES avoids relinking. So far, so good.
>
> However, I still get relinks due to a dependency on a static library. In
> this case, I'm unable to add the path using LINK_DIRECTORIES since the
> path is different depending on the configuration. I'm currently adding
> the path using the LINK_FLAGS_{DEBUG, ...} target property (which
> probably is the cause of the relinking).
>
> So, I would like to be able to do something like, given the debug
> version of MyStaticLib.lib is in lib/win32/debug:
>
> LINK_DIRECTORIES_DEBUG(lib/win32/debug)
> TARGET_LINK_LIBRARIES(Foo MyStaticLib)
>
> To make things more difficult, I cannot do something like:
>
> LINK_DIRECTORIES("lib/win32/$(ConfigurationName)")
>
> because the configurations available for the static library
> (MyStaticLib.lib) do not map cleanly on the values for
> $(ConfigurationName).
Is there any reason why
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
LINK_DIRECTORIES("/path/to/debug/lib")
ELSE("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
LINK_DIRECTORIES("/path/to/release/lib")
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
won't work for you?
-- Jack
More information about the CMake
mailing list