changeset 2379:4900688827a8

reorganization in CMake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 28 Aug 2017 18:07:03 +0200
parents 116ade1eff82
children 96b3ec054b69
files CMakeLists.txt Core/Images/Font.cpp Core/Images/FontRegistry.cpp Core/Images/FontRegistry.h Core/Images/JpegErrorManager.h Core/Images/JpegReader.h Core/Images/JpegWriter.h Core/Images/PngReader.h Core/Images/PngWriter.h Core/Lua/LuaContext.cpp Core/Lua/LuaContext.h Resources/CMake/OpenSslConfiguration.cmake Resources/CMake/PugixmlConfiguration.cmake
diffstat 13 files changed, 320 insertions(+), 250 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Aug 28 15:02:27 2017 +0200
+++ b/CMakeLists.txt	Mon Aug 28 18:07:03 2017 +0200
@@ -305,13 +305,19 @@
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibJpegConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/Resources/CMake/PugixmlConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
 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)
 
+if (USE_PUGIXML)
+  include(${CMAKE_SOURCE_DIR}/Resources/CMake/PugixmlConfiguration.cmake)
+  add_definitions(-DORTHANC_ENABLE_PUGIXML=1)
+else()
+  add_definitions(-DORTHANC_ENABLE_PUGIXML=0)  
+endif()
+
 if (ENABLE_CIVETWEB)
   include(${CMAKE_SOURCE_DIR}/Resources/CMake/CivetwebConfiguration.cmake)
   add_definitions(
@@ -444,6 +450,8 @@
   -DORTHANC_ENABLE_LOGGING_PLUGIN=0
   -DORTHANC_ENABLE_LUA=1
   -DORTHANC_ENABLE_MD5=1
+  -DORTHANC_ENABLE_PNG=1
+  -DORTHANC_HAS_EMBEDDED_RESOURCES=1
   -DORTHANC_MAXIMUM_TAG_LENGTH=256
   -DORTHANC_SANDBOXED=0
 
--- a/Core/Images/Font.cpp	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/Font.cpp	Mon Aug 28 18:07:03 2017 +0200
@@ -34,6 +34,10 @@
 #include "../PrecompiledHeaders.h"
 #include "Font.h"
 
+#if !defined(ORTHANC_ENABLE_LOCALE)
+#  error ORTHANC_ENABLE_LOCALE must be defined to use this file
+#endif
+
 #include "../SystemToolbox.h"
 #include "../Toolbox.h"
 #include "../OrthancException.h"
@@ -254,7 +258,13 @@
 
     int a = x;
 
+#if ORTHANC_ENABLE_LOCALE == 1
     std::string s = Toolbox::ConvertFromUtf8(utf8, Encoding_Latin1);
+#else
+    // If the locale support is disabled, simply drop non-ASCII
+    // characters from the source UTF-8 string
+    std::string s = Toolbox::ConvertToAscii(utf8);
+#endif
 
     for (size_t i = 0; i < s.size(); i++)
     {
--- a/Core/Images/FontRegistry.cpp	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/FontRegistry.cpp	Mon Aug 28 18:07:03 2017 +0200
@@ -65,12 +65,14 @@
   }
 
 
+#if ORTHANC_HAS_EMBEDDED_RESOURCES == 1
   void FontRegistry::AddFromResource(EmbeddedResources::FileResourceId resource)
   {
     std::string content;
     EmbeddedResources::GetFileResource(content, resource);
     AddFromMemory(content);
   }
+#endif
 
 
   const Font& FontRegistry::GetFont(size_t i) const
--- a/Core/Images/FontRegistry.h	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/FontRegistry.h	Mon Aug 28 18:07:03 2017 +0200
@@ -35,7 +35,13 @@
 
 #include "Font.h"
 
-#include <EmbeddedResources.h>   // Autogenerated file
+#if !defined(ORTHANC_HAS_EMBEDDED_RESOURCES)
+#  error Macro ORTHANC_HAS_EMBEDDED_RESOURCES must be defined
+#endif
+
+#if ORTHANC_HAS_EMBEDDED_RESOURCES == 1
+#  include <EmbeddedResources.h>   // Autogenerated file
+#endif
 
 namespace Orthanc
 {
@@ -53,7 +59,9 @@
 
     void AddFromFile(const std::string& path);
 
+#if ORTHANC_HAS_EMBEDDED_RESOURCES == 1
     void AddFromResource(EmbeddedResources::FileResourceId resource);
+#endif
 
     size_t GetSize() const
     {
--- a/Core/Images/JpegErrorManager.h	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/JpegErrorManager.h	Mon Aug 28 18:07:03 2017 +0200
@@ -32,6 +32,14 @@
 
 #pragma once
 
+#if !defined(ORTHANC_ENABLE_JPEG)
+#  error The macro ORTHANC_ENABLE_JPEG must be defined
+#endif
+
+#if ORTHANC_ENABLE_JPEG != 1
+#  error JPEG support must be enabled to include this file
+#endif
+
 #include <string.h>
 #include <stdio.h>
 #include <jpeglib.h>
--- a/Core/Images/JpegReader.h	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/JpegReader.h	Mon Aug 28 18:07:03 2017 +0200
@@ -33,15 +33,23 @@
 
 #pragma once
 
+#if !defined(ORTHANC_SANDBOXED)
+#  error The macro ORTHANC_SANDBOXED must be defined
+#endif
+
+#if !defined(ORTHANC_ENABLE_JPEG)
+#  error The macro ORTHANC_ENABLE_JPEG must be defined
+#endif
+
+#if ORTHANC_ENABLE_JPEG != 1
+#  error JPEG support must be enabled to include this file
+#endif
+
 #include "ImageAccessor.h"
 
 #include <string>
 #include <boost/noncopyable.hpp>
 
-#if !defined(ORTHANC_SANDBOXED)
-#  error The macro ORTHANC_SANDBOXED must be defined
-#endif
-
 namespace Orthanc
 {
   class JpegReader : 
--- a/Core/Images/JpegWriter.h	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/JpegWriter.h	Mon Aug 28 18:07:03 2017 +0200
@@ -33,6 +33,14 @@
 
 #pragma once
 
+#if !defined(ORTHANC_ENABLE_JPEG)
+#  error The macro ORTHANC_ENABLE_JPEG must be defined
+#endif
+
+#if ORTHANC_ENABLE_JPEG != 1
+#  error JPEG support must be enabled to include this file
+#endif
+
 #include "IImageWriter.h"
 
 namespace Orthanc
--- a/Core/Images/PngReader.h	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/PngReader.h	Mon Aug 28 18:07:03 2017 +0200
@@ -33,6 +33,14 @@
 
 #pragma once
 
+#if !defined(ORTHANC_ENABLE_PNG)
+#  error The macro ORTHANC_ENABLE_PNG must be defined
+#endif
+
+#if ORTHANC_ENABLE_PNG != 1
+#  error PNG support must be enabled to include this file
+#endif
+
 #include "ImageAccessor.h"
 
 #include "../Enumerations.h"
--- a/Core/Images/PngWriter.h	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Images/PngWriter.h	Mon Aug 28 18:07:03 2017 +0200
@@ -33,6 +33,14 @@
 
 #pragma once
 
+#if !defined(ORTHANC_ENABLE_PNG)
+#  error The macro ORTHANC_ENABLE_PNG must be defined
+#endif
+
+#if ORTHANC_ENABLE_PNG != 1
+#  error PNG support must be enabled to include this file
+#endif
+
 #include "IImageWriter.h"
 
 #include <boost/shared_ptr.hpp>
--- a/Core/Lua/LuaContext.cpp	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Lua/LuaContext.cpp	Mon Aug 28 18:07:03 2017 +0200
@@ -588,12 +588,14 @@
   }
 
 
+#if ORTHANC_HAS_EMBEDDED_RESOURCES == 1
   void LuaContext::Execute(EmbeddedResources::FileResourceId resource)
   {
     std::string command;
     EmbeddedResources::GetFileResource(command, resource);
     ExecuteInternal(NULL, command);
   }
+#endif
 
 
   bool LuaContext::IsExistingFunction(const char* name)
--- a/Core/Lua/LuaContext.h	Mon Aug 28 15:02:27 2017 +0200
+++ b/Core/Lua/LuaContext.h	Mon Aug 28 18:07:03 2017 +0200
@@ -37,10 +37,18 @@
 #  error The macro ORTHANC_ENABLE_LUA must be defined
 #endif
 
+#if !defined(ORTHANC_HAS_EMBEDDED_RESOURCES)
+#  error Macro ORTHANC_HAS_EMBEDDED_RESOURCES must be defined
+#endif
+
 #if ORTHANC_ENABLE_LUA == 0
 #  error The Lua support is disabled, cannot include this file
 #endif
 
+#if ORTHANC_HAS_EMBEDDED_RESOURCES == 1
+#  include <EmbeddedResources.h>   // Autogenerated file
+#endif
+
 #include "../HttpClient.h"
 
 extern "C" 
@@ -48,7 +56,6 @@
 #include <lua.h>
 }
 
-#include <EmbeddedResources.h>
 #include <boost/noncopyable.hpp>
 
 namespace Orthanc
@@ -105,7 +112,9 @@
     void Execute(Json::Value& output,
                  const std::string& command);
 
+#if ORTHANC_HAS_EMBEDDED_RESOURCES == 1
     void Execute(EmbeddedResources::FileResourceId resource);
+#endif
 
     bool IsExistingFunction(const char* name);
 
--- a/Resources/CMake/OpenSslConfiguration.cmake	Mon Aug 28 15:02:27 2017 +0200
+++ b/Resources/CMake/OpenSslConfiguration.cmake	Mon Aug 28 18:07:03 2017 +0200
@@ -1,232 +1,230 @@
-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 (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 (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
+    set(FirstRun OFF)
+  else()
+    set(FirstRun ON)
+  endif()
+
+  DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
+
+  add_definitions(
+    -DOPENSSL_THREADS
+    -DOPENSSL_IA32_SSE2
+    -DOPENSSL_NO_ASM
+    -DOPENSSL_NO_DYNAMIC_ENGINE
+    -DNO_WINDOWS_BRAINDEATH
 
-    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 (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
-      set(FirstRun OFF)
-    else()
-      set(FirstRun ON)
-    endif()
-
-    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
+  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
+    )
 
-      -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
-      )
+  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
+    )
 
-    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
+  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()
 
-    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
+  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/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
+    )
+
+
+  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
       )
 
-    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
-        )
+    if (Failure AND FirstRun)
+      message(FATAL_ERROR "Error while patching a file")
     endif()
+  endif()
 
-    foreach(d ${OPENSSL_SOURCES_SUBDIRS})
-      AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
-    endforeach()
+  source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*)
 
-    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
+else()
+  include(FindOpenSSL)
 
-      ${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}/ssl/heartbeat_test.c
-      )
-
+  if (NOT ${OPENSSL_FOUND})
+    message(FATAL_ERROR "Unable to find OpenSSL")
+  endif()
 
-    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
-        )
-
-      if (Failure AND FirstRun)
-        message(FATAL_ERROR "Error while patching a file")
-      endif()
-    endif()
-
-    source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*)
-
-  else()
-    include(FindOpenSSL)
-
-    if (NOT ${OPENSSL_FOUND})
-      message(FATAL_ERROR "Unable to find OpenSSL")
-    endif()
-
-    include_directories(${OPENSSL_INCLUDE_DIR})
-    link_libraries(${OPENSSL_LIBRARIES})
-  endif()
+  include_directories(${OPENSSL_INCLUDE_DIR})
+  link_libraries(${OPENSSL_LIBRARIES})
 endif()
--- a/Resources/CMake/PugixmlConfiguration.cmake	Mon Aug 28 15:02:27 2017 +0200
+++ b/Resources/CMake/PugixmlConfiguration.cmake	Mon Aug 28 18:07:03 2017 +0200
@@ -1,33 +1,26 @@
-if (USE_PUGIXML)
-  add_definitions(-DORTHANC_ENABLE_PUGIXML=1)
+if (STATIC_BUILD OR NOT USE_SYSTEM_PUGIXML)
+  set(PUGIXML_SOURCES_DIR ${CMAKE_BINARY_DIR}/pugixml-1.4)
+  set(PUGIXML_MD5 "7c56c91cfe3ecdee248a8e4892ef5781")
+  set(PUGIXML_URL "http://www.orthanc-server.com/downloads/third-party/pugixml-1.4.tar.gz")
 
-  if (STATIC_BUILD OR NOT USE_SYSTEM_PUGIXML)
-    set(PUGIXML_SOURCES_DIR ${CMAKE_BINARY_DIR}/pugixml-1.4)
-    set(PUGIXML_MD5 "7c56c91cfe3ecdee248a8e4892ef5781")
-    set(PUGIXML_URL "http://www.orthanc-server.com/downloads/third-party/pugixml-1.4.tar.gz")
-
-    DownloadPackage(${PUGIXML_MD5} ${PUGIXML_URL} "${PUGIXML_SOURCES_DIR}")
-
-    include_directories(
-      ${PUGIXML_SOURCES_DIR}/src
-      )
+  DownloadPackage(${PUGIXML_MD5} ${PUGIXML_URL} "${PUGIXML_SOURCES_DIR}")
 
-    set(PUGIXML_SOURCES
-      #${PUGIXML_SOURCES_DIR}/src/vlog_is_on.cc
-      ${PUGIXML_SOURCES_DIR}/src/pugixml.cpp
-      )
+  include_directories(
+    ${PUGIXML_SOURCES_DIR}/src
+    )
 
-  else()
-    CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H)
-    if (NOT HAVE_PUGIXML_H)
-      message(FATAL_ERROR "Please install the libpugixml-dev package")
-    endif()
-
-    link_libraries(pugixml)
-  endif()
+  set(PUGIXML_SOURCES
+    #${PUGIXML_SOURCES_DIR}/src/vlog_is_on.cc
+    ${PUGIXML_SOURCES_DIR}/src/pugixml.cpp
+    )
 
   source_group(ThirdParty\\pugixml REGULAR_EXPRESSION ${PUGIXML_SOURCES_DIR}/.*)
 
 else()
-  add_definitions(-DORTHANC_ENABLE_PUGIXML=0)
+  CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H)
+  if (NOT HAVE_PUGIXML_H)
+    message(FATAL_ERROR "Please install the libpugixml-dev package")
+  endif()
+
+  link_libraries(pugixml)
 endif()