[CMake] MSVC and different link_directories for release and debug

Michael Schildt michael.schildt at ifn-magdeburg.de
Wed Mar 24 13:42:24 EDT 2010


Hello,

I use GDCM libaries in one project. Unfurtunally, i couldn't find a 
findGDCM module and i'm not experienced enough to write one. I have seen 
that GDCM is used in ITK, so there must be a module like this. GDCM is 
using cmake too, so inclusion should be easy. But i have problems to 
link the correkt library version depending on the configuration type.

IF(WIN32)
  INCLUDE_DIRECTORIES(C:/Programme/GDCM\ 2.0/include/gdcm-2.0)
  IF(CMAKE_BUILD_TYPE MATCHES "Debug")
    LINK_DIRECTORIES("C:/Program Files/GDCM/bin/Debug")
  ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
    LINK_DIRECTORIES("C:/Program Files/GDCM/bin/Release")
  ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
  SET(GDCM_LIBRARIES gdcmcharls.lib gdcmCommon.lib gdcmDICT.lib 
gdcmDSED.lib gdcmexpat.lib gdcmgetopt.lib gdcmIOD.lib gdcmjpeg8.lib 
gdcmjpeg12.lib gdcmjpeg16.lib gdcmMSFF.lib gdcmopenjpeg.lib gdcmzlib.lib)
ELSE(WIN32)
    # Linux
    INCLUDE_DIRECTORIES(/usr/include/gdcm-2.0)
    SET(GDCM_LIBRARIES gdcmCommon gdcmDICT gdcmDSED gdcmIOD gdcmjpeg8 
gdcmjpeg12 gdcmjpeg16 gdcmMSFF)
ENDIF(WIN32)

He always includes the Relase Directory. What is a solution for this issue?

Best reguards,
    Michael Schildt



More information about the CMake mailing list