[CMake] Changing the build-mode

Micha Renner Micha.Renner at t-online.de
Thu Jan 28 05:19:11 EST 2010


There is a library, which has the suffix d, if it is compiled in
Debug-Mode

ADD_LIBRARY(${_targetname} SHARED ${_src} ${_imIncludeFiles})
SET_TARGET_PROPERTIES(${_targetname} PROPERTIES DEBUG_OUTPUT_NAME
${_targetname}d)
INSTALL(TARGETS ${_targetname} EXPORT SLibName 
	RUNTIME DESTINATION dll
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib)
INSTALL(EXPORT SLibName NAMESPACE mp_ DESTINATION lib/SLibName)

In an other project an application uses the library:
INCLUDE(${CMAKE_INSTALL_PREFIX}/lib/SLibName/SLibName.cmake)
ADD_EXECUTABLE(TestDll12 testC.c)
TARGET_LINK_LIBRARIES(TestDll12 mp_SLib1)

If I set CMAKE_BUILD_TYPE to "Debug" (CMAKE-GUI), the application
program uses debug-library.
After switching into the "Release"-Mode, the application program still
uses the debug-library.
The trick is to delete the cache, then it works.

So is it really always necessary to delete the cache, if I change the
build-mode?

Micha





More information about the CMake mailing list