[CMake] Generated VC8 project don't change the library paths

Radu Mihai radu at cm-labs.com
Fri Sep 1 11:17:11 EDT 2006


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}/)
link_directories(${tool_libs})

The problem is that at project generation time CMAKE_BUILD_TYPE is  
set to, for example, DEBUG, so the debug path is burned into the  
project files and it does not get re-evaluated when the IDE changes  
to RELEASE.

I thought that using double variable referencing might confuse the  
generator and I rewrote the first line as an if statement  
(pseudocode, I don't find the proper version now):

IF(${CMAKE_BUILD_TYPE} EQUAL 'DEBUG')
	set(tool_libs ${OSG_ROOT}/lib.dbg/)
ELSE(${CMAKE_BUILD_TYPE} EQUAL 'DEBUG')
	IF(${CMAKE_BUILD_TYPE} EQUAL 'RELEASE')
		set(tool_libs ${OSG_ROOT}/lib.rel/)
	ENDIF(${CMAKE_BUILD_TYPE} EQUAL 'RELEASE')
ENDIF(${CMAKE_BUILD_TYPE} EQUAL 'DEBUG')

But this would not be adjusted either.

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 ?

Thank you

--------------------------
Radu Mihai
radu at cm-labs.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060901/4a7c9097/attachment-0001.htm


More information about the CMake mailing list