Blob Blame Raw
--- CMakeLists.txt	2010-02-19 19:18:30.000000000 +0100
+++ CMakeLists2.txt	2010-02-19 19:21:51.000000000 +0100
@@ -197,7 +197,7 @@
 
 IF(NOT GDCM_INSTALL_LIB_DIR)
   #SET(GDCM_INSTALL_LIB_DIR "lib/${PROJECT_NAME}")
-  SET(GDCM_INSTALL_LIB_DIR "lib")
+  SET(GDCM_INSTALL_LIB_DIR "lib${LIB_SUFFIX}")
 ENDIF(NOT GDCM_INSTALL_LIB_DIR)
 
 IF(NOT GDCM_INSTALL_DATA_DIR)
@@ -261,6 +261,11 @@
 OPTION(GDCM_USE_SYSTEM_EXPAT "Use system expat" OFF)
 OPTION(GDCM_USE_SYSTEM_LJPEG "Use system ljpeg (ijg lib)" OFF)
 OPTION(GDCM_USE_SYSTEM_OPENJPEG "Use system openjpeg (1.x)" OFF)
+IF(GDCM_USE_JPEGLS)
+   OPTION(GDCM_USE_SYSTEM_JPEGLS "Use system JPEGLS (CharLS)" OFF)
+   MARK_AS_ADVANCED(GDCM_USE_SYSTEM_JPEGLS)
+ENDIF(GDCM_USE_JPEGLS)
+
 MARK_AS_ADVANCED(GDCM_USE_SYSTEM_ZLIB GDCM_USE_SYSTEM_UUID GDCM_USE_SYSTEM_EXPAT GDCM_USE_SYSTEM_OPENSSL)
 MARK_AS_ADVANCED(GDCM_USE_SYSTEM_OPENJPEG GDCM_USE_SYSTEM_LJPEG)
 OPTION(GDCM_USE_SYSTEM_POPPLER "Use system poppler (pdf)" OFF)
@@ -283,6 +288,14 @@
   SET(GDCM_OPENJPEG_LIBRARIES gdcmopenjpeg)
 ENDIF(GDCM_USE_SYSTEM_OPENJPEG)
 
+IF(GDCM_USE_SYSTEM_JPEGLS)
+  FIND_PACKAGE(CharLS REQUIRED)
+  SET(GDCM_CHARLS_LIBRARIES ${CHARLS_LIBRARIES})
+ELSE(GDCM_USE_SYSTEM_JPEGLS)
+  SET(GDCM_CHARLS_LIBRARIES gdcmcharls)
+ENDIF(GDCM_USE_SYSTEM_JPEGLS)
+
+
 # Very advanced user option:
 # This will cause building of the broken JPEG library released by the Standford PVRG group:
 OPTION(GDCM_USE_PVRG "Use pvrg lib, only turn it on if you know what you are doing." OFF)

--- Utilities/CMakeLists.txt	2009-11-12 23:09:48.000000000 +0100
+++ Utilities/CMakeLists2.txt	2010-02-19 19:21:59.000000000 +0100
@@ -35,12 +35,14 @@
 # Do jpegls (JPEG-LS aka near lossless implementation)
 APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/gdcmcharls/License.txt)
 IF(GDCM_USE_JPEGLS)
-  SET(CHARLS_NAMESPACE "GDCMCHARLS")
-  SET(CHARLS_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
-  SET(CHARLS_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
-  SET(CHARLS_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
-  SET(CHARLS_INSTALL_INCLUDE_DIR  ${GDCM_INSTALL_INCLUDE_DIR})
-  SUBDIRS(gdcmcharls)
+  IF(NOT GDCM_USE_SYSTEM_JPEGLS)
+    SET(CHARLS_NAMESPACE "GDCMCHARLS")
+    SET(CHARLS_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
+    SET(CHARLS_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
+    SET(CHARLS_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
+    SET(CHARLS_INSTALL_INCLUDE_DIR  ${GDCM_INSTALL_INCLUDE_DIR})
+    SUBDIRS(gdcmcharls)
+  ENDIF(NOT GDCM_USE_SYSTEM_JPEGLS)
 ENDIF(GDCM_USE_JPEGLS)
 
 # Do md5
--- Source/MediaStorageAndFileFormat/CMakeLists.txt	2009-11-12 23:09:48.000000000 +0100
+++ Source/MediaStorageAndFileFormat/CMakeLists2.txt	2010-02-19 19:22:23.000000000 +0100
@@ -132,7 +132,7 @@
 TARGET_LINK_LIBRARIES(gdcmMSFF gdcmIOD gdcmDSED gdcmDICT ${GDCM_LJPEG_LIBRARIES} ${GDCM_OPENJPEG_LIBRARIES})
 SET_TARGET_PROPERTIES(gdcmMSFF PROPERTIES ${GDCM_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "gdcmDSED;gdcmDICT;gdcmIOD")
 IF(GDCM_USE_JPEGLS)
-  TARGET_LINK_LIBRARIES(gdcmMSFF gdcmcharls)
+  TARGET_LINK_LIBRARIES(gdcmMSFF ${GDCM_CHARLS_LIBRARIES})
 ENDIF(GDCM_USE_JPEGLS)
 
 IF(CMAKE_COMPILER_IS_GNUCXX AND MINGW)
--- Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx	2009-11-12 23:09:48.000000000 +0100
+++ Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec2.cxx	2010-02-19 19:22:09.000000000 +0100
@@ -18,6 +18,16 @@
 #include "gdcmDataElement.h"
 
 // CharLS includes
+#ifdef GDCM_USE_SYSTEM_EXPAT
+#include "CharLS/stdafx.h" // sigh...
+#include "CharLS/interface.h"
+#include "CharLS/util.h"
+#include "CharLS/defaulttraits.h"
+#include "CharLS/losslesstraits.h"
+#include "CharLS/colortransform.h"
+#include "CharLS/streams.h"
+#include "CharLS/processline.h"
+#else
 #include "gdcmcharls/stdafx.h" // sigh...
 #include "gdcmcharls/interface.h"
 #include "gdcmcharls/util.h"
@@ -26,6 +36,8 @@
 #include "gdcmcharls/colortransform.h"
 #include "gdcmcharls/streams.h"
 #include "gdcmcharls/processline.h"
+#endif
+
 
 
 namespace gdcm