changeset 2367:2aff870c2c58

refactoring of BoostConfiguration.cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Aug 2017 17:32:13 +0200
parents 26f3a346226f
children 5998f81bfbd1
files CMakeLists.txt Core/Logging.cpp Core/SystemToolbox.cpp Core/SystemToolbox.h Core/Toolbox.cpp Core/Toolbox.h Resources/CMake/BoostConfiguration.cmake Resources/CMake/LibIconvConfiguration.cmake Resources/CMake/OpenSslConfiguration.cmake
diffstat 9 files changed, 407 insertions(+), 385 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Aug 21 21:21:48 2017 +0200
+++ b/CMakeLists.txt	Tue Aug 22 17:32:13 2017 +0200
@@ -69,8 +69,11 @@
 
 # Path to the root folder of the Orthanc distribution
 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR})
-set(ENABLE_DCMTK_NETWORK ON)
-set(USE_BOOST_LOCALE_BACKEND OFF)
+
+# These options must be set to "ON" if compiling Orthanc, but might be
+# set to "OFF" in some plugins if their support is not required
+set(ENABLE_DCMTK_NETWORK ON)  # Enable support for DICOM networking in DCMTK
+set(ENABLE_LOCALE ON)         # Enable support for locales (notably in Boost)
 
 # Some basic inclusions
 include(CheckIncludeFiles)
@@ -306,6 +309,7 @@
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibIconvConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake)
 
 # These are the two most heavyweight dependencies. We put them as the
 # last includes to quickly spot problems when configuring static
@@ -316,7 +320,6 @@
 
 if (ENABLE_SSL)
   add_definitions(-DORTHANC_ENABLE_SSL=1)
-  include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake)
 else()
   add_definitions(-DORTHANC_ENABLE_SSL=0)
 endif()
@@ -343,6 +346,13 @@
 endif()
 
 
+if (ENABLE_LOCALE)
+  add_definitions(-DORTHANC_ENABLE_LOCALE=1)
+else()
+  add_definitions(-DORTHANC_ENABLE_LOCALE=0)
+endif()
+
+
 if (ENABLE_PKCS11)
   if (ENABLE_SSL)
     include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibP11Configuration.cmake)
--- a/Core/Logging.cpp	Mon Aug 21 21:21:48 2017 +0200
+++ b/Core/Logging.cpp	Tue Aug 22 17:32:13 2017 +0200
@@ -161,12 +161,7 @@
 #include <fstream>
 #include <boost/filesystem.hpp>
 #include <boost/thread.hpp>
-
-#if BOOST_HAS_DATE_TIME == 1
-#  include <boost/date_time/posix_time/posix_time.hpp>
-#else
-#  error Boost::date_time is required
-#endif
+#include <boost/date_time/posix_time/posix_time.hpp>
 
 
 namespace
--- a/Core/SystemToolbox.cpp	Mon Aug 21 21:21:48 2017 +0200
+++ b/Core/SystemToolbox.cpp	Tue Aug 22 17:32:13 2017 +0200
@@ -35,11 +35,6 @@
 #include "SystemToolbox.h"
 
 
-#if BOOST_HAS_DATE_TIME == 1
-#  include <boost/date_time/posix_time/posix_time.hpp>
-#endif
-
-
 #if defined(_WIN32)
 #  include <windows.h>
 #  include <process.h>   // For "_spawnvp()" and "_getpid()"
@@ -86,6 +81,7 @@
 
 #include <boost/filesystem.hpp>
 #include <boost/filesystem/fstream.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
 
 
 namespace Orthanc
@@ -565,13 +561,13 @@
   }
 
 
-#if BOOST_HAS_DATE_TIME == 1
   std::string SystemToolbox::GetNowIsoString()
   {
     boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
     return boost::posix_time::to_iso_string(now);
   }
 
+  
   void SystemToolbox::GetNowDicom(std::string& date,
                                   std::string& time)
   {
@@ -586,5 +582,4 @@
     sprintf(s, "%02d%02d%02d.%06d", tm.tm_hour, tm.tm_min, tm.tm_sec, 0);
     time.assign(s);
   }
-#endif
 }
--- a/Core/SystemToolbox.h	Mon Aug 21 21:21:48 2017 +0200
+++ b/Core/SystemToolbox.h	Tue Aug 22 17:32:13 2017 +0200
@@ -95,11 +95,9 @@
 
     std::string GenerateUuid();
 
-#if BOOST_HAS_DATE_TIME == 1
     std::string GetNowIsoString();
 
     void GetNowDicom(std::string& date,
                      std::string& time);
-#endif
   }
 }
--- a/Core/Toolbox.cpp	Mon Aug 21 21:21:48 2017 +0200
+++ b/Core/Toolbox.cpp	Tue Aug 22 17:32:13 2017 +0200
@@ -40,7 +40,7 @@
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/lexical_cast.hpp>
-#include <boost/locale.hpp>
+#include <boost/regex.hpp> 
 #include <boost/uuid/sha1.hpp>
  
 #include <string>
@@ -49,13 +49,6 @@
 #include <algorithm>
 #include <ctype.h>
 
-#if BOOST_HAS_REGEX == 1
-#  include <boost/regex.hpp> 
-#endif
-
-#if BOOST_HAS_LOCALE != 1
-#  error Since version 0.7.6, Orthanc entirely relies on boost::locale
-#endif
 
 #if ORTHANC_ENABLE_MD5 == 1
 #  include "../Resources/ThirdParty/md5/md5.h"
@@ -65,6 +58,10 @@
 #  include "../Resources/ThirdParty/base64/base64.h"
 #endif
 
+#if ORTHANC_ENABLE_LOCALE == 1
+#  include <boost/locale.hpp>
+#endif
+
 
 #if defined(_MSC_VER) && (_MSC_VER < 1800)
 // Patch for the missing "_strtoll" symbol when compiling with Visual Studio < 2013
@@ -369,7 +366,6 @@
   }
 
 
-#  if BOOST_HAS_REGEX == 1
   bool Toolbox::DecodeDataUriScheme(std::string& mime,
                                     std::string& content,
                                     const std::string& source)
@@ -389,7 +385,6 @@
       return false;
     }
   }
-#  endif
 
 
   void Toolbox::EncodeDataUriScheme(std::string& result,
@@ -470,6 +465,7 @@
   }
 
 
+#if ORTHANC_ENABLE_LOCALE == 1
   std::string Toolbox::ConvertToUtf8(const std::string& source,
                                      Encoding sourceEncoding)
   {
@@ -496,8 +492,10 @@
       return ConvertToAscii(source);
     }
   }
+#endif
+  
 
-
+#if ORTHANC_ENABLE_LOCALE == 1
   std::string Toolbox::ConvertFromUtf8(const std::string& source,
                                        Encoding targetEncoding)
   {
@@ -524,6 +522,7 @@
       return ConvertToAscii(source);
     }
   }
+#endif
 
 
   bool Toolbox::IsAsciiString(const void* data,
@@ -779,7 +778,6 @@
   }
 
 
-#if BOOST_HAS_REGEX == 1
   std::string Toolbox::WildcardToRegularExpression(const std::string& source)
   {
     // TODO - Speed up this with a regular expression
@@ -807,8 +805,6 @@
 
     return result;
   }
-#endif
-
 
 
   void Toolbox::TokenizeString(std::vector<std::string>& result,
@@ -1254,6 +1250,7 @@
   }
 
 
+#if ORTHANC_ENABLE_LOCALE == 1
   static std::auto_ptr<std::locale>  globalLocale_;
 
   static bool SetGlobalLocale(const char* locale)
@@ -1329,6 +1326,7 @@
   {
     globalLocale_.reset();
   }
+#endif
 
   
   std::string Toolbox::ToUpperCaseWithAccents(const std::string& source)
--- a/Core/Toolbox.h	Mon Aug 21 21:21:48 2017 +0200
+++ b/Core/Toolbox.h	Tue Aug 22 17:32:13 2017 +0200
@@ -45,6 +45,10 @@
 #  error The macro ORTHANC_ENABLE_BASE64 must be defined
 #endif
 
+#if !defined(ORTHANC_ENABLE_LOCALE)
+#  error The macro ORTHANC_ENABLE_LOCALE must be defined
+#endif
+
 #if !defined(ORTHANC_ENABLE_MD5)
 #  error The macro ORTHANC_ENABLE_MD5 must be defined
 #endif
@@ -53,10 +57,6 @@
 #  error The macro ORTHANC_ENABLE_PUGIXML must be defined
 #endif
 
-#if !defined(BOOST_HAS_REGEX)
-#  error The macro BOOST_HAS_REGEX must be defined
-#endif
-
 
 /**
  * NOTE: GUID vs. UUID
@@ -132,22 +132,22 @@
     void EncodeBase64(std::string& result, 
                       const std::string& data);
 
-#  if BOOST_HAS_REGEX == 1
     bool DecodeDataUriScheme(std::string& mime,
                              std::string& content,
                              const std::string& source);
-#  endif
 
     void EncodeDataUriScheme(std::string& result,
                              const std::string& mime,
                              const std::string& content);
 #endif
 
+#if ORTHANC_ENABLE_LOCALE == 1
     std::string ConvertToUtf8(const std::string& source,
                               Encoding sourceEncoding);
 
     std::string ConvertFromUtf8(const std::string& source,
                                 Encoding targetEncoding);
+#endif
 
     bool IsAsciiString(const void* data,
                        size_t size);
@@ -161,9 +161,7 @@
 
     Endianness DetectEndianness();
 
-#if BOOST_HAS_REGEX == 1
     std::string WildcardToRegularExpression(const std::string& s);
-#endif
 
     void TokenizeString(std::vector<std::string>& result,
                         const std::string& source,
@@ -207,9 +205,11 @@
 
     bool StartsWithUuid(const std::string& str);
 
+#if ORTHANC_ENABLE_LOCALE == 1
     void InitializeGlobalLocale(const char* locale);
 
     void FinalizeGlobalLocale();
+#endif
 
     std::string ToUpperCaseWithAccents(const std::string& source);
   }
--- a/Resources/CMake/BoostConfiguration.cmake	Mon Aug 21 21:21:48 2017 +0200
+++ b/Resources/CMake/BoostConfiguration.cmake	Tue Aug 22 17:32:13 2017 +0200
@@ -7,8 +7,12 @@
   #set(Boost_DEBUG 1)
   #set(Boost_USE_STATIC_LIBS ON)
 
+  if (ENABLE_LOCALE)
+    list(APPEND ORTHANC_BOOST_COMPONENTS locale)
+  endif()
+
   find_package(Boost
-    COMPONENTS filesystem thread system date_time regex locale ${ORTHANC_BOOST_COMPONENTS})
+    COMPONENTS filesystem thread system date_time regex ${ORTHANC_BOOST_COMPONENTS})
 
   if (NOT Boost_FOUND)
     message(FATAL_ERROR "Unable to locate Boost on this system")
@@ -27,19 +31,16 @@
       )
   endif()
 
-  #if (${Boost_VERSION} LESS 104800)
-  # boost::locale is only available from 1.48.00
-  #message("Too old version of Boost (${Boost_LIB_VERSION}): Building the static version")
-  #  set(BOOST_STATIC 1)
-  #endif()
-
   include_directories(${Boost_INCLUDE_DIRS})
   link_libraries(${Boost_LIBRARIES})
 endif()
 
 
 if (BOOST_STATIC)
-  # Parameters for Boost 1.64.0
+  ##
+  ## Parameters for static compilation of Boost 
+  ##
+  
   set(BOOST_NAME boost_1_64_0)
   set(BOOST_BCP_SUFFIX bcpdigest-1.3.0)
   set(BOOST_MD5 "ecb266cf46adcc7f695ad12685871174")
@@ -49,80 +50,102 @@
 
   DownloadPackage(${BOOST_MD5} ${BOOST_URL} "${BOOST_SOURCES_DIR}")
 
-  set(BOOST_SOURCES)
+
+  ##
+  ## Generic configuration of Boost
+  ## 
+
+  if (CMAKE_COMPILER_IS_GNUCXX)
+    add_definitions(-isystem ${BOOST_SOURCES_DIR})
+  endif()
+
+  include_directories(
+    ${BOOST_SOURCES_DIR}
+    )
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl32" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl64")
+  add_definitions(
+    # Static build of Boost
+    -DBOOST_ALL_NO_LIB 
+    -DBOOST_ALL_NOLIB 
+    -DBOOST_DATE_TIME_NO_LIB 
+    -DBOOST_THREAD_BUILD_LIB
+    -DBOOST_PROGRAM_OPTIONS_NO_LIB
+    -DBOOST_REGEX_NO_LIB
+    -DBOOST_SYSTEM_NO_LIB
+    -DBOOST_LOCALE_NO_LIB
+    )
+
+
+  ##
+  ## Configuration of Boost core
+  ##
+  
+  set(BOOST_SOURCES
+    ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
+    )
+
+  if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
+      CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
+      CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
+      CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" OR
+      CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
+      CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
+      CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
+      CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
     list(APPEND BOOST_SOURCES
       ${BOOST_SOURCES_DIR}/libs/atomic/src/lockpool.cpp
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
       )
-    add_definitions(
-      -DBOOST_LOCALE_NO_WINAPI_BACKEND=1
-      -DBOOST_LOCALE_NO_STD_BACKEND=1
-      )
 
     if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl32" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl64")
+        CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
+        CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
+        CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
       add_definitions(-DBOOST_HAS_SCHED_YIELD=1)
     endif()
 
-  elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
     list(APPEND BOOST_SOURCES
       ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp
       ${BOOST_SOURCES_DIR}/libs/thread/src/win32/thread.cpp
       ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp
-      ${BOOST_FILESYSTEM_SOURCES_DIR}/windows_file_codecvt.cpp
       )
 
-    add_definitions(
-      -DBOOST_LOCALE_NO_POSIX_BACKEND=1
-      -DBOOST_LOCALE_NO_STD_BACKEND=1
-      )
-
-  elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
-    add_definitions(
-      -DBOOST_LOCALE_NO_POSIX_BACKEND=1
-      -DBOOST_LOCALE_NO_STD_BACKEND=1
-      )
+  elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
 
   else()
     message(FATAL_ERROR "Support your platform here")
   endif()
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
-    list(APPEND BOOST_SOURCES
-      ${BOOST_SOURCES_DIR}/libs/filesystem/src/utf8_codecvt_facet.cpp
-      )
-  endif()
 
+  ##
+  ## Configuration of boost::regex
+  ##
+  
   aux_source_directory(${BOOST_SOURCES_DIR}/libs/regex/src BOOST_REGEX_SOURCES)
 
   list(APPEND BOOST_SOURCES
     ${BOOST_REGEX_SOURCES}
-    ${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp
-    ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
     )
 
-  if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
-    list(APPEND BOOST_SOURCES
-      ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
-      )
-  endif()
+
+  ##
+  ## Configuration of boost::datetime
+  ##
+  
+  list(APPEND BOOST_SOURCES
+    ${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp
+    )
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl32" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl64")
+
+  ##
+  ## Configuration of boost::filesystem
+  ## 
+
+  if (CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
+      CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
+      CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
     # boost::filesystem is not available on PNaCl
     add_definitions(
       -DBOOST_HAS_FILESYSTEM_V3=0
@@ -133,51 +156,22 @@
       -DBOOST_HAS_FILESYSTEM_V3=1
       )
     list(APPEND BOOST_SOURCES
-      ${BOOST_FILESYSTEM_SOURCES_DIR}/codecvt_error_category.cpp
       ${BOOST_FILESYSTEM_SOURCES_DIR}/operations.cpp
       ${BOOST_FILESYSTEM_SOURCES_DIR}/path.cpp
       ${BOOST_FILESYSTEM_SOURCES_DIR}/path_traits.cpp
       )
   endif()
 
-  if (USE_BOOST_LOCALE_BACKEND)
-    if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl32" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl64")
-      list(APPEND BOOST_SOURCES
-        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/codecvt.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/collate.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/converter.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/numeric.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/posix_backend.cpp
-        )
-    elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-      list(APPEND BOOST_SOURCES
-        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/collate.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/converter.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/lcid.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/numeric.cpp
-        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/win_backend.cpp
-        )
-    else()
-      message(FATAL_ERROR "Support your platform here")
-    endif()
+
+  ##
+  ## Configuration of boost::locale
+  ## 
 
+  if (NOT ENABLE_LOCALE)
+    message("boost::locale is disabled")
+  else()
     list(APPEND BOOST_SOURCES
-      ${BOOST_REGEX_SOURCES}
-      ${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp
-      ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
-
       ${BOOST_FILESYSTEM_SOURCES_DIR}/codecvt_error_category.cpp
-      ${BOOST_FILESYSTEM_SOURCES_DIR}/operations.cpp
-      ${BOOST_FILESYSTEM_SOURCES_DIR}/path.cpp
-      ${BOOST_FILESYSTEM_SOURCES_DIR}/path_traits.cpp
-
       ${BOOST_SOURCES_DIR}/libs/locale/src/shared/generator.cpp
       ${BOOST_SOURCES_DIR}/libs/locale/src/shared/date_time.cpp
       ${BOOST_SOURCES_DIR}/libs/locale/src/shared/formatting.cpp
@@ -191,39 +185,81 @@
       ${BOOST_SOURCES_DIR}/libs/locale/src/util/info.cpp
       ${BOOST_SOURCES_DIR}/libs/locale/src/util/locale_data.cpp
       )        
+
+    if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
+        CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
+        CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
+        CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" OR
+        CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
+        CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
+        CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
+        CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
+      list(APPEND BOOST_SOURCES
+        ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/codecvt.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/collate.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/converter.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/numeric.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/posix/posix_backend.cpp
+        )
+
+      add_definitions(
+        -DBOOST_LOCALE_WITH_ICONV=1
+        -DBOOST_LOCALE_NO_WINAPI_BACKEND=1
+        -DBOOST_LOCALE_NO_STD_BACKEND=1
+        )
+      
+    elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
+      list(APPEND BOOST_SOURCES
+        ${BOOST_FILESYSTEM_SOURCES_DIR}/windows_file_codecvt.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/collate.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/converter.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/lcid.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/numeric.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/win32/win_backend.cpp
+        )
+
+      add_definitions(
+        -DBOOST_LOCALE_NO_POSIX_BACKEND=1
+        -DBOOST_LOCALE_NO_STD_BACKEND=1
+        )
+
+      # Starting with release 0.8.2, Orthanc statically links against
+      # libiconv, even on Windows. Indeed, the "WCONV" library of
+      # Windows XP seems not to support properly several codepages
+      # (notably "Latin3", "Hebrew", and "Arabic").
+
+      if (USE_BOOST_ICONV)
+        add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
+      else()
+        add_definitions(-DBOOST_LOCALE_WITH_WCONV=1)
+      endif()
+
+    elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
+            CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+      list(APPEND BOOST_SOURCES
+        ${BOOST_SOURCES_DIR}/libs/filesystem/src/utf8_codecvt_facet.cpp
+        ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
+        )
+      
+      add_definitions(
+        -DBOOST_LOCALE_WITH_ICONV=1
+        )
+      
+    elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+      add_definitions(
+        -DBOOST_LOCALE_WITH_ICONV=1
+        -DBOOST_LOCALE_NO_POSIX_BACKEND=1
+        -DBOOST_LOCALE_NO_STD_BACKEND=1
+        )
+      
+    else()
+      message(FATAL_ERROR "Support your platform here")
+    endif()
   endif()
 
-  add_definitions(
-    # Static build of Boost
-    -DBOOST_ALL_NO_LIB 
-    -DBOOST_ALL_NOLIB 
-    -DBOOST_DATE_TIME_NO_LIB 
-    -DBOOST_THREAD_BUILD_LIB
-    -DBOOST_PROGRAM_OPTIONS_NO_LIB
-    -DBOOST_REGEX_NO_LIB
-    -DBOOST_SYSTEM_NO_LIB
-    -DBOOST_LOCALE_NO_LIB
-    -DBOOST_HAS_LOCALE=1
-    )
-
-  if (CMAKE_COMPILER_IS_GNUCXX)
-    add_definitions(-isystem ${BOOST_SOURCES_DIR})
-  endif()
-
-  include_directories(
-    ${BOOST_SOURCES_DIR}
-    )
-
+  
   source_group(ThirdParty\\boost REGULAR_EXPRESSION ${BOOST_SOURCES_DIR}/.*)
 
-else()
-  add_definitions(
-    -DBOOST_HAS_LOCALE=1
-    )
 endif()
-
-
-add_definitions(
-  -DBOOST_HAS_DATE_TIME=1
-  -DBOOST_HAS_REGEX=1
-  )
--- a/Resources/CMake/LibIconvConfiguration.cmake	Mon Aug 21 21:21:48 2017 +0200
+++ b/Resources/CMake/LibIconvConfiguration.cmake	Tue Aug 22 17:32:13 2017 +0200
@@ -1,24 +1,12 @@
-if (NOT USE_BOOST_ICONV)
-  message("Not using libiconv")
+if (NOT ENABLE_LOCALE)
+  message("Support for locales is disabled")
 
-  if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
-    # Starting with release 0.8.2, Orthanc statically links against
-    # libiconv, even on Windows. Indeed, the "WCONV" library of
-    # Windows XP seems not to support properly several codepages
-    # (notably "Latin3", "Hebrew", and "Arabic"). The flag
-    # "USE_BOOST_ICONV" allows to force the use of "WCONV".
-    add_definitions(-DBOOST_LOCALE_WITH_WCONV=1)
-  else()
-    message(FATAL_ERROR "Support your platform here")
-  endif()
+elseif (NOT USE_BOOST_ICONV)
+  message("Not using libiconv")
 
 else()
   message("Using libiconv")
 
-  add_definitions(
-    -DBOOST_LOCALE_WITH_ICONV=1
-    )
-
   if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV)
     set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15)
     set(LIBICONV_URL "http://www.orthanc-server.com/downloads/third-party/libiconv-1.15.tar.gz")
@@ -28,8 +16,8 @@
 
     # Disable the support of libiconv that is shipped by default with
     # the C standard library on Linux. Setting this macro redirects
-    # calls from "iconv*()" to "libiconv*()" in the source code of
-    # "libiconv-1.15".
+    # calls from "iconv*()" to "libiconv*()" by defining macros in the
+    # C headers of "libiconv-1.15".
     add_definitions(-DLIBICONV_PLUG=1)
 
     # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ
--- a/Resources/CMake/OpenSslConfiguration.cmake	Mon Aug 21 21:21:48 2017 +0200
+++ b/Resources/CMake/OpenSslConfiguration.cmake	Tue Aug 22 17:32:13 2017 +0200
@@ -1,230 +1,232 @@
-if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
-  # WARNING - We had to repack the upstream ".tar.gz" file to a ZIP
-  # file, as the upstream distribution ships symbolic links that are
-  # not always properly handled when uncompressing on Windows.
-
-  SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.0.2d)
-  SET(OPENSSL_URL "http://www.orthanc-server.com/downloads/third-party/openssl-1.0.2d.zip")
-  SET(OPENSSL_MD5 "4b2ac15fc6db17f3dadc54482d3eee85")
+if (ENABLE_SSL)
+  if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
+    # WARNING - We had to repack the upstream ".tar.gz" file to a ZIP
+    # file, as the upstream distribution ships symbolic links that are
+    # not always properly handled when uncompressing on Windows.
 
-  if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
-    set(FirstRun OFF)
-  else()
-    set(FirstRun ON)
-  endif()
+    SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.0.2d)
+    SET(OPENSSL_URL "http://www.orthanc-server.com/downloads/third-party/openssl-1.0.2d.zip")
+    SET(OPENSSL_MD5 "4b2ac15fc6db17f3dadc54482d3eee85")
 
-  DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
+    if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
+      set(FirstRun OFF)
+    else()
+      set(FirstRun ON)
+    endif()
 
-  add_definitions(
-    -DOPENSSL_THREADS
-    -DOPENSSL_IA32_SSE2
-    -DOPENSSL_NO_ASM
-    -DOPENSSL_NO_DYNAMIC_ENGINE
-    -DNO_WINDOWS_BRAINDEATH
+    DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
 
-    -DOPENSSL_NO_BF 
-    -DOPENSSL_NO_CAMELLIA
-    -DOPENSSL_NO_CAST 
-    -DOPENSSL_NO_EC_NISTP_64_GCC_128
-    -DOPENSSL_NO_GMP
-    -DOPENSSL_NO_GOST
-    -DOPENSSL_NO_HW
-    -DOPENSSL_NO_JPAKE
-    -DOPENSSL_NO_IDEA
-    -DOPENSSL_NO_KRB5 
-    -DOPENSSL_NO_MD2 
-    -DOPENSSL_NO_MDC2 
-    -DOPENSSL_NO_MD4
-    -DOPENSSL_NO_RC2 
-    -DOPENSSL_NO_RC4 
-    -DOPENSSL_NO_RC5 
-    -DOPENSSL_NO_RFC3779
-    -DOPENSSL_NO_SCTP
-    -DOPENSSL_NO_STORE
-    -DOPENSSL_NO_SEED
-    -DOPENSSL_NO_WHIRLPOOL
-    -DOPENSSL_NO_RIPEMD
-    )
+    add_definitions(
+      -DOPENSSL_THREADS
+      -DOPENSSL_IA32_SSE2
+      -DOPENSSL_NO_ASM
+      -DOPENSSL_NO_DYNAMIC_ENGINE
+      -DNO_WINDOWS_BRAINDEATH
+
+      -DOPENSSL_NO_BF 
+      -DOPENSSL_NO_CAMELLIA
+      -DOPENSSL_NO_CAST 
+      -DOPENSSL_NO_EC_NISTP_64_GCC_128
+      -DOPENSSL_NO_GMP
+      -DOPENSSL_NO_GOST
+      -DOPENSSL_NO_HW
+      -DOPENSSL_NO_JPAKE
+      -DOPENSSL_NO_IDEA
+      -DOPENSSL_NO_KRB5 
+      -DOPENSSL_NO_MD2 
+      -DOPENSSL_NO_MDC2 
+      -DOPENSSL_NO_MD4
+      -DOPENSSL_NO_RC2 
+      -DOPENSSL_NO_RC4 
+      -DOPENSSL_NO_RC5 
+      -DOPENSSL_NO_RFC3779
+      -DOPENSSL_NO_SCTP
+      -DOPENSSL_NO_STORE
+      -DOPENSSL_NO_SEED
+      -DOPENSSL_NO_WHIRLPOOL
+      -DOPENSSL_NO_RIPEMD
+      )
 
-  include_directories(
-    ${OPENSSL_SOURCES_DIR}
-    ${OPENSSL_SOURCES_DIR}/crypto
-    ${OPENSSL_SOURCES_DIR}/crypto/asn1
-    ${OPENSSL_SOURCES_DIR}/crypto/modes
-    ${OPENSSL_SOURCES_DIR}/crypto/evp
-    ${OPENSSL_SOURCES_DIR}/include
-    )
+    include_directories(
+      ${OPENSSL_SOURCES_DIR}
+      ${OPENSSL_SOURCES_DIR}/crypto
+      ${OPENSSL_SOURCES_DIR}/crypto/asn1
+      ${OPENSSL_SOURCES_DIR}/crypto/modes
+      ${OPENSSL_SOURCES_DIR}/crypto/evp
+      ${OPENSSL_SOURCES_DIR}/include
+      )
 
-  set(OPENSSL_SOURCES_SUBDIRS
-    ${OPENSSL_SOURCES_DIR}/crypto
-    ${OPENSSL_SOURCES_DIR}/crypto/aes
-    ${OPENSSL_SOURCES_DIR}/crypto/asn1
-    ${OPENSSL_SOURCES_DIR}/crypto/bio
-    ${OPENSSL_SOURCES_DIR}/crypto/bn
-    ${OPENSSL_SOURCES_DIR}/crypto/buffer
-    ${OPENSSL_SOURCES_DIR}/crypto/cmac
-    ${OPENSSL_SOURCES_DIR}/crypto/cms
-    ${OPENSSL_SOURCES_DIR}/crypto/comp
-    ${OPENSSL_SOURCES_DIR}/crypto/conf
-    ${OPENSSL_SOURCES_DIR}/crypto/des
-    ${OPENSSL_SOURCES_DIR}/crypto/dh
-    ${OPENSSL_SOURCES_DIR}/crypto/dsa
-    ${OPENSSL_SOURCES_DIR}/crypto/dso
-    ${OPENSSL_SOURCES_DIR}/crypto/engine
-    ${OPENSSL_SOURCES_DIR}/crypto/err
-    ${OPENSSL_SOURCES_DIR}/crypto/evp
-    ${OPENSSL_SOURCES_DIR}/crypto/hmac
-    ${OPENSSL_SOURCES_DIR}/crypto/lhash
-    ${OPENSSL_SOURCES_DIR}/crypto/md5
-    ${OPENSSL_SOURCES_DIR}/crypto/modes
-    ${OPENSSL_SOURCES_DIR}/crypto/objects
-    ${OPENSSL_SOURCES_DIR}/crypto/ocsp
-    ${OPENSSL_SOURCES_DIR}/crypto/pem
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs12
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs7
-    ${OPENSSL_SOURCES_DIR}/crypto/pqueue
-    ${OPENSSL_SOURCES_DIR}/crypto/rand
-    ${OPENSSL_SOURCES_DIR}/crypto/rsa
-    ${OPENSSL_SOURCES_DIR}/crypto/sha
-    ${OPENSSL_SOURCES_DIR}/crypto/srp
-    ${OPENSSL_SOURCES_DIR}/crypto/stack
-    ${OPENSSL_SOURCES_DIR}/crypto/ts
-    ${OPENSSL_SOURCES_DIR}/crypto/txt_db
-    ${OPENSSL_SOURCES_DIR}/crypto/ui
-    ${OPENSSL_SOURCES_DIR}/crypto/x509
-    ${OPENSSL_SOURCES_DIR}/crypto/x509v3
-    ${OPENSSL_SOURCES_DIR}/ssl
-    )
+    set(OPENSSL_SOURCES_SUBDIRS
+      ${OPENSSL_SOURCES_DIR}/crypto
+      ${OPENSSL_SOURCES_DIR}/crypto/aes
+      ${OPENSSL_SOURCES_DIR}/crypto/asn1
+      ${OPENSSL_SOURCES_DIR}/crypto/bio
+      ${OPENSSL_SOURCES_DIR}/crypto/bn
+      ${OPENSSL_SOURCES_DIR}/crypto/buffer
+      ${OPENSSL_SOURCES_DIR}/crypto/cmac
+      ${OPENSSL_SOURCES_DIR}/crypto/cms
+      ${OPENSSL_SOURCES_DIR}/crypto/comp
+      ${OPENSSL_SOURCES_DIR}/crypto/conf
+      ${OPENSSL_SOURCES_DIR}/crypto/des
+      ${OPENSSL_SOURCES_DIR}/crypto/dh
+      ${OPENSSL_SOURCES_DIR}/crypto/dsa
+      ${OPENSSL_SOURCES_DIR}/crypto/dso
+      ${OPENSSL_SOURCES_DIR}/crypto/engine
+      ${OPENSSL_SOURCES_DIR}/crypto/err
+      ${OPENSSL_SOURCES_DIR}/crypto/evp
+      ${OPENSSL_SOURCES_DIR}/crypto/hmac
+      ${OPENSSL_SOURCES_DIR}/crypto/lhash
+      ${OPENSSL_SOURCES_DIR}/crypto/md5
+      ${OPENSSL_SOURCES_DIR}/crypto/modes
+      ${OPENSSL_SOURCES_DIR}/crypto/objects
+      ${OPENSSL_SOURCES_DIR}/crypto/ocsp
+      ${OPENSSL_SOURCES_DIR}/crypto/pem
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs12
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs7
+      ${OPENSSL_SOURCES_DIR}/crypto/pqueue
+      ${OPENSSL_SOURCES_DIR}/crypto/rand
+      ${OPENSSL_SOURCES_DIR}/crypto/rsa
+      ${OPENSSL_SOURCES_DIR}/crypto/sha
+      ${OPENSSL_SOURCES_DIR}/crypto/srp
+      ${OPENSSL_SOURCES_DIR}/crypto/stack
+      ${OPENSSL_SOURCES_DIR}/crypto/ts
+      ${OPENSSL_SOURCES_DIR}/crypto/txt_db
+      ${OPENSSL_SOURCES_DIR}/crypto/ui
+      ${OPENSSL_SOURCES_DIR}/crypto/x509
+      ${OPENSSL_SOURCES_DIR}/crypto/x509v3
+      ${OPENSSL_SOURCES_DIR}/ssl
+      )
 
-  if (ENABLE_PKCS11)
-    list(APPEND OPENSSL_SOURCES_SUBDIRS
-      # EC, ECDH and ECDSA are necessary for PKCS11
-      ${OPENSSL_SOURCES_DIR}/crypto/ec
-      ${OPENSSL_SOURCES_DIR}/crypto/ecdh
-      ${OPENSSL_SOURCES_DIR}/crypto/ecdsa
-      )
-  else()
-    add_definitions(
-      -DOPENSSL_NO_EC
-      -DOPENSSL_NO_ECDH
-      -DOPENSSL_NO_ECDSA
-      )
-  endif()
+    if (ENABLE_PKCS11)
+      list(APPEND OPENSSL_SOURCES_SUBDIRS
+        # EC, ECDH and ECDSA are necessary for PKCS11
+        ${OPENSSL_SOURCES_DIR}/crypto/ec
+        ${OPENSSL_SOURCES_DIR}/crypto/ecdh
+        ${OPENSSL_SOURCES_DIR}/crypto/ecdsa
+        )
+    else()
+      add_definitions(
+        -DOPENSSL_NO_EC
+        -DOPENSSL_NO_ECDH
+        -DOPENSSL_NO_ECDSA
+        )
+    endif()
 
-  foreach(d ${OPENSSL_SOURCES_SUBDIRS})
-    AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
-  endforeach()
+    foreach(d ${OPENSSL_SOURCES_SUBDIRS})
+      AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
+    endforeach()
 
-  list(REMOVE_ITEM OPENSSL_SOURCES
-    ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c
-    ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c
-    ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
-    ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
-    ${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
-    ${OPENSSL_SOURCES_DIR}/crypto/armcap.c
-    ${OPENSSL_SOURCES_DIR}/crypto/bf/bfs.cpp
-    ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_rtcp.c
-    ${OPENSSL_SOURCES_DIR}/crypto/bn/exp.c
-    ${OPENSSL_SOURCES_DIR}/crypto/conf/cnf_save.c
-    ${OPENSSL_SOURCES_DIR}/crypto/conf/test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/des/des.c
-    ${OPENSSL_SOURCES_DIR}/crypto/des/des3s.cpp
-    ${OPENSSL_SOURCES_DIR}/crypto/des/des_opts.c
-    ${OPENSSL_SOURCES_DIR}/crypto/des/dess.cpp
-    ${OPENSSL_SOURCES_DIR}/crypto/des/read_pwd.c
-    ${OPENSSL_SOURCES_DIR}/crypto/des/speed.c
-    ${OPENSSL_SOURCES_DIR}/crypto/evp/e_dsa.c
-    ${OPENSSL_SOURCES_DIR}/crypto/evp/m_ripemd.c
-    ${OPENSSL_SOURCES_DIR}/crypto/lhash/lh_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/md5/md5s.cpp
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/bio_ber.c
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pk7_enc.c
-    ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
-    ${OPENSSL_SOURCES_DIR}/crypto/rand/randtest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
-    ${OPENSSL_SOURCES_DIR}/crypto/x509v3/tabtest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3conf.c
-    ${OPENSSL_SOURCES_DIR}/ssl/ssl_task.c
-    ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c
-    ${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c
-    ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c
-    ${OPENSSL_SOURCES_DIR}/crypto/bn/bntest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/bn/expspeed.c
-    ${OPENSSL_SOURCES_DIR}/crypto/bn/exptest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/engine/enginetest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmactest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.c
-    ${OPENSSL_SOURCES_DIR}/crypto/md5/md5test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/o_dir_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/dec.c
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/enc.c
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/sign.c
-    ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/verify.c
-    ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1t.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sha/sha256t.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sha/sha512t.c
-    ${OPENSSL_SOURCES_DIR}/crypto/sha/shatest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/srp/srptest.c
+    list(REMOVE_ITEM OPENSSL_SOURCES
+      ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c
+      ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c
+      ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
+      ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
+      ${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
+      ${OPENSSL_SOURCES_DIR}/crypto/armcap.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bf/bfs.cpp
+      ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_rtcp.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bn/exp.c
+      ${OPENSSL_SOURCES_DIR}/crypto/conf/cnf_save.c
+      ${OPENSSL_SOURCES_DIR}/crypto/conf/test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/des/des.c
+      ${OPENSSL_SOURCES_DIR}/crypto/des/des3s.cpp
+      ${OPENSSL_SOURCES_DIR}/crypto/des/des_opts.c
+      ${OPENSSL_SOURCES_DIR}/crypto/des/dess.cpp
+      ${OPENSSL_SOURCES_DIR}/crypto/des/read_pwd.c
+      ${OPENSSL_SOURCES_DIR}/crypto/des/speed.c
+      ${OPENSSL_SOURCES_DIR}/crypto/evp/e_dsa.c
+      ${OPENSSL_SOURCES_DIR}/crypto/evp/m_ripemd.c
+      ${OPENSSL_SOURCES_DIR}/crypto/lhash/lh_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/md5/md5s.cpp
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/bio_ber.c
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pk7_enc.c
+      ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
+      ${OPENSSL_SOURCES_DIR}/crypto/rand/randtest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
+      ${OPENSSL_SOURCES_DIR}/crypto/x509v3/tabtest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3conf.c
+      ${OPENSSL_SOURCES_DIR}/ssl/ssl_task.c
+      ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c
+      ${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bn/bntest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bn/expspeed.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bn/exptest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/engine/enginetest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmactest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.c
+      ${OPENSSL_SOURCES_DIR}/crypto/md5/md5test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/o_dir_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/dec.c
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/enc.c
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/sign.c
+      ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/verify.c
+      ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1t.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sha/sha256t.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sha/sha512t.c
+      ${OPENSSL_SOURCES_DIR}/crypto/sha/shatest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/srp/srptest.c
 
-    ${OPENSSL_SOURCES_DIR}/crypto/bn/divtest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/bn/bnspeed.c
-    ${OPENSSL_SOURCES_DIR}/crypto/des/destest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/dh/p192.c
-    ${OPENSSL_SOURCES_DIR}/crypto/dh/p512.c
-    ${OPENSSL_SOURCES_DIR}/crypto/dh/p1024.c
-    ${OPENSSL_SOURCES_DIR}/crypto/des/rpw.c
-    ${OPENSSL_SOURCES_DIR}/ssl/ssltest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsagen.c
-    ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsatest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/dh/dhtest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pq_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bn/divtest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/bn/bnspeed.c
+      ${OPENSSL_SOURCES_DIR}/crypto/des/destest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/dh/p192.c
+      ${OPENSSL_SOURCES_DIR}/crypto/dh/p512.c
+      ${OPENSSL_SOURCES_DIR}/crypto/dh/p1024.c
+      ${OPENSSL_SOURCES_DIR}/crypto/des/rpw.c
+      ${OPENSSL_SOURCES_DIR}/ssl/ssltest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsagen.c
+      ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsatest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/dh/dhtest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pq_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
 
-    ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_extra_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/evp/verify_extra_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/x509/verify_extra_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3prin.c
-    ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3nametest.c
-    ${OPENSSL_SOURCES_DIR}/crypto/constant_time_test.c
-    ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
+      ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_extra_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/evp/verify_extra_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/x509/verify_extra_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3prin.c
+      ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3nametest.c
+      ${OPENSSL_SOURCES_DIR}/crypto/constant_time_test.c
+      ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
 
-    ${OPENSSL_SOURCES_DIR}/ssl/heartbeat_test.c
-    )
+      ${OPENSSL_SOURCES_DIR}/ssl/heartbeat_test.c
+      )
 
 
-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
-    set_source_files_properties(
-      ${OPENSSL_SOURCES}
-      PROPERTIES COMPILE_DEFINITIONS
-      "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN")
+    if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+      set_source_files_properties(
+        ${OPENSSL_SOURCES}
+        PROPERTIES COMPILE_DEFINITIONS
+        "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN")
 
-  elseif ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
-    execute_process(
-      COMMAND ${PATCH_EXECUTABLE} -N ui_openssl.c -i ${ORTHANC_ROOT}/Resources/Patches/openssl-lsb.diff
-      WORKING_DIRECTORY ${OPENSSL_SOURCES_DIR}/crypto/ui
-      RESULT_VARIABLE Failure
-      )
+    elseif ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
+      execute_process(
+        COMMAND ${PATCH_EXECUTABLE} -N ui_openssl.c -i ${ORTHANC_ROOT}/Resources/Patches/openssl-lsb.diff
+        WORKING_DIRECTORY ${OPENSSL_SOURCES_DIR}/crypto/ui
+        RESULT_VARIABLE Failure
+        )
 
-    if (Failure AND FirstRun)
-      message(FATAL_ERROR "Error while patching a file")
+      if (Failure AND FirstRun)
+        message(FATAL_ERROR "Error while patching a file")
+      endif()
     endif()
-  endif()
 
-  source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*)
+    source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*)
 
-else()
-  include(FindOpenSSL)
+  else()
+    include(FindOpenSSL)
 
-  if (NOT ${OPENSSL_FOUND})
-    message(FATAL_ERROR "Unable to find OpenSSL")
-  endif()
+    if (NOT ${OPENSSL_FOUND})
+      message(FATAL_ERROR "Unable to find OpenSSL")
+    endif()
 
-  include_directories(${OPENSSL_INCLUDE_DIR})
-  link_libraries(${OPENSSL_LIBRARIES})
+    include_directories(${OPENSSL_INCLUDE_DIR})
+    link_libraries(${OPENSSL_LIBRARIES})
+  endif()
 endif()