[CMake] FIND_LIBRARY debug/release
Brad King
brad.king at kitware.com
Wed Oct 18 12:41:27 EDT 2006
Jacob Foshee wrote:
> I am working on updating the FindDCMTK.cmake module.
> It includes a lot of commands like the following:
> FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle
> ${DCMTK_DIR}/dcmimgle/libsrc
> ${DCMTK_DIR}/dcmimgle/libsrc/Release
> ${DCMTK_DIR}/dcmimgle/libsrc/Debug
> )
>
> Shouldn't FIND_LIBRARY look in the "release" and "debug" subfolders by
> default? It does not seem to.
No, because at CMake time the build configuration to be used may not be
known so it cannot know in which to look. You should do something like
this:
FIND_LIBRARY(DCMTK_dcmimgle_LIBRARY_RELEASE
NAMES dcmimgle
PATHS ${DCMTK_DIR}/dcmimgle/libsrc/Release
${DCMTK_DIR}/dcmimgle/libsrc
)
FIND_LIBRARY(DCMTK_dcmimgle_LIBRARY_DEBUG
NAMES dcmimgle # Change name here if debug lib has different name.
PATHS ${DCMTK_DIR}/dcmimgle/libsrc/Debug
${DCMTK_DIR}/dcmimgle/libsrc
)
SET(DCMTK_dcmimgle_LIBRARY
debug ${DCMTK_dcmimgle_LIBRARY_DEBUG}
optimized ${DCMTK_dcmimgle_LIBRARY_RELEASE}
)
See FindQt4.cmake for code that does something similar already.
-Brad
More information about the CMake
mailing list