[CMake] Generated VC8 project don't change the library paths
Radu Mihai
radu at cm-labs.com
Fri Sep 1 14:09:23 EDT 2006
Thank you for the answer.
I tried it out & the right values get propagated in the VC project.
It would be nice to have the same kind of build-type solution for
LINK_DIRECTORIES. Then VC could pick-up different paths depending on
the configuration from the IDE..
ex:
LINK_DIRECTORIES(optimized /foo/libopt
debug /foo/libdbg)
Together with suppressing the addition of $(OutDir) at the end of
paths, this would mean that the paths used could be completely
determined from cmake for all configurations.
--------------------------
Radu Mihai
radu at cm-labs.com
On 1-Sep-06, at 12:06 PM, Brad King wrote:
> Radu Mihai wrote:
>> Hello, first time on the list
>>
>> I am working on a project that links with some external libs that we
>> build ourselves (OpenSceneGraph).
>> To accommodate the use of release and debug versions the current
>> layout
>> looks like this:
>> osg/lib.rel/ .....
>> osg/lib.dbg/ .....
>>
>> The CMakeLists.txt for our code has this to set the directory to
>> add to
>> search for libs:
>>
>> set(tool_libs ${OSG_ROOT}/lib.${${CMAKE_BUILD_TYPE}_DIR}/)
> [snip]
>> Is there any way to set LINK_DIRECTORIES based on the
>> configuration in
>> such a way that VC8(7,6) will have the directory change when the
>> build
>> type is changed in the IDE ?
>
> CMAKE_BUILD_TYPE is not used by the VS generators. It is used by the
> Makefile generators to select which configuration to build. Since VS
> selects the configuration at build time CMake generates all available
> configurations into the project files. The way to change a path on a
> per-configuration basis is to use ${CMAKE_CFG_INTDIR} which expands to
> "." on Makefile generators and "$(OutDir)" on VS generators. For VS
> this will give you "Debug" and "Release" at build time depending on
> the
> configuration chosen.
>
> Instead of using link directories should specify full paths to the
> libraries to be linked. You can switch between release and debug
> libraries like this:
>
> SET(MY_LIBS optimized /path/to/lib.rel/foo_opt.lib
> debug /path/to/lib.dbg/foo_dbg.lib)
>
> Then use TARGET_LINK_LIBRARIES with ${MY_LIBS}.
>
> -Brad
More information about the CMake
mailing list