[CMake] Changing the build-mode
Michael Wild
themiwi at gmail.com
Thu Jan 28 05:40:27 EST 2010
On 28. Jan, 2010, at 11:19 , Micha Renner wrote:
> 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
Not sure what's going on, I actually never tried to do that. But you'll certainly want to have a look at the <CONFIG>_POSTFIX target property or the <CONFIG>_POSTFIX variable for setting a postfix (such as "d") depending on the configuration.
Michael
More information about the CMake
mailing list