f94c63b
diff --git a/CMakeLists.txt b/CMakeLists.txt
f94c63b
index 93a2a24..7076a45 100644
f94c63b
--- a/CMakeLists.txt
f94c63b
+++ b/CMakeLists.txt
f94c63b
@@ -305,7 +305,7 @@ IF(GDCM_USE_SYSTEM_OPENJPEG)
f94c63b
   # For some reason I cannot specify the version I want.
f94c63b
   # FIND_PACKAGE(OpenJPEG 2.0 REQUIRED)
f94c63b
   # oh well we should handle both 1.0 and 2.0 anyway...
f94c63b
-  #FIND_PACKAGE(OpenJPEG REQUIRED)
f94c63b
+  FIND_PACKAGE(OpenJPEG REQUIRED)
f94c63b
   SET(GDCM_OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARIES})
f94c63b
 ELSE(GDCM_USE_SYSTEM_OPENJPEG)
f94c63b
   SET(GDCM_OPENJPEG_LIBRARIES gdcmopenjpeg)
f94c63b
@@ -758,6 +758,11 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
f94c63b
   set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
f94c63b
     "All of the tools you'll ever need to develop software using GDCM")
f94c63b
 
f94c63b
+  if(CMAKE_VERSION VERSION_EQUAL 2.8.3)
f94c63b
+    # The following is needed for CMake 2.8.3 and above to preserve backward compat
f94c63b
+    set(CPACK_MONOLITHIC_INSTALL 1)
f94c63b
+  endif(CMAKE_VERSION VERSION_EQUAL 2.8.3)
f94c63b
+  
f94c63b
   # It doesn't make sense to install the headers without the libraries
f94c63b
   # (because you could never use the headers!), so make the headers component
f94c63b
   # depend on the libraries component.
f94c63b
diff --git a/Source/Common/gdcmConfigure.h.in b/Source/Common/gdcmConfigure.h.in
f94c63b
index a203235..534845a 100644
f94c63b
--- a/Source/Common/gdcmConfigure.h.in
f94c63b
+++ b/Source/Common/gdcmConfigure.h.in
f94c63b
@@ -63,8 +63,7 @@
f94c63b
 #ifndef GDCM_USE_SYSTEM_OPENJPEG
f94c63b
 #define OPENJPEG_MAJOR_VERSION 2
f94c63b
 #else
f94c63b
-//#define OPENJPEG_MAJOR_VERSION @OPENJPEG_MAJOR_VERSION@
f94c63b
-#define OPENJPEG_MAJOR_VERSION 2
f94c63b
+#define OPENJPEG_MAJOR_VERSION @OPENJPEG_MAJOR_VERSION@
f94c63b
 #endif //GDCM_USE_SYSTEM_OPENJPEG
f94c63b
 
f94c63b
 #ifndef OPENJPEG_MAJOR_VERSION
f94c63b
diff --git a/Source/Common/gdcmCryptographicMessageSyntax.cxx b/Source/Common/gdcmCryptographicMessageSyntax.cxx
f94c63b
index ec48f40..054d72a 100644
f94c63b
--- a/Source/Common/gdcmCryptographicMessageSyntax.cxx
f94c63b
+++ b/Source/Common/gdcmCryptographicMessageSyntax.cxx
f94c63b
@@ -102,8 +102,8 @@ public:
f94c63b
     ::X509 *ret = sk_X509_value(recips, i);
f94c63b
     return ret;
f94c63b
   }
f94c63b
-  void SetPrivateKey(::EVP_PKEY* pkey) {
f94c63b
-    this->pkey = pkey;
f94c63b
+  void SetPrivateKey(::EVP_PKEY* thepkey) {
f94c63b
+    this->pkey = thepkey;
f94c63b
   }
f94c63b
   ::EVP_PKEY* GetPrivateKey() const {
f94c63b
     return pkey;
f94c63b
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
f94c63b
index 4c6d95b..3b6c1b6 100644
f94c63b
--- a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
f94c63b
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
f94c63b
@@ -446,6 +446,7 @@ bool JPEG2000Codec::Decode(std::istream &is, std::ostream &os)
f94c63b
     return false;
f94c63b
     }
f94c63b
 
f94c63b
+  int reversible;
f94c63b
 #if OPENJPEG_MAJOR_VERSION == 1
f94c63b
   /* catch events using our callbacks and give a local context */
f94c63b
   opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, NULL);
f94c63b
@@ -484,7 +485,6 @@ bool JPEG2000Codec::Decode(std::istream &is, std::ostream &os)
f94c63b
   /* setup the decoder decoding parameters using user parameters */
f94c63b
   opj_setup_decoder(dinfo, &parameters);
f94c63b
   bool bResult;
f94c63b
-  int reversible;
f94c63b
   OPJ_INT32 l_tile_x0,l_tile_y0;
f94c63b
   OPJ_UINT32 l_tile_width,l_tile_height,l_nb_tiles_x,l_nb_tiles_y;
f94c63b
   bResult = opj_read_header(
f94c63b
@@ -586,7 +586,7 @@ bool JPEG2000Codec::Decode(std::istream &is, std::ostream &os)
f94c63b
   unsigned long len = Dimensions[0]*Dimensions[1] * (PF.GetBitsAllocated() / 8) * image->numcomps;
f94c63b
   char *raw = new char[len];
f94c63b
   //assert( len == fsrc->len );
f94c63b
-  for (unsigned int compno = 0; compno < image->numcomps; compno++)
f94c63b
+  for (unsigned int compno = 0; compno < (unsigned int)image->numcomps; compno++)
f94c63b
     {
f94c63b
     opj_image_comp_t *comp = &image->comps[compno];
f94c63b