# HG changeset patch # User Sebastien Jodogne # Date 1523968752 -7200 # Node ID 4ecd23ad416903fd95ad76d9c5a1e72c35ec701b # Parent db6cc80efed0e62e7699859c880e81790393b757# Parent c5ef9c029a4c5015562995e5a1524b4d2880c1e0 sync diff -r db6cc80efed0 -r 4ecd23ad4169 CMakeLists.txt --- a/CMakeLists.txt Tue Apr 17 14:26:18 2018 +0200 +++ b/CMakeLists.txt Tue Apr 17 14:39:12 2018 +0200 @@ -23,29 +23,31 @@ set(ORTHANC_POSTGRESQL_VERSION "mainline") +if (ORTHANC_POSTGRESQL_VERSION STREQUAL "mainline") + set(ORTHANC_FRAMEWORK_VERSION "mainline") + set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") +else() + set(ORTHANC_FRAMEWORK_VERSION "1.3.1") + set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") +endif() + # Parameters of the build set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") set(BUILD_UNIT_TESTS ON CACHE BOOL "Build UnitTests") +set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")") +set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") +set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") # Advanced parameters to fine-tune linking against system libraries set(USE_SYSTEM_LIBPQ ON CACHE BOOL "Use the system version of the PostgreSQL client library") set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") -# Download the Orthanc framework -if (ORTHANC_POSTGRESQL_VERSION STREQUAL "mainline") - set(ORTHANC_FRAMEWORK_SOURCE "hg") - set(ORTHANC_FRAMEWORK_VERSION "mainline") -else() - set(ORTHANC_FRAMEWORK_SOURCE "web") - set(ORTHANC_FRAMEWORK_VERSION "1.3.1") -endif() +# Download and setup the Orthanc framework include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake) - -# Initialize the Orthanc framework set(ORTHANC_FRAMEWORK_PLUGIN ON) include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) diff -r db6cc80efed0 -r 4ecd23ad4169 Resources/Orthanc/DownloadOrthancFramework.cmake --- a/Resources/Orthanc/DownloadOrthancFramework.cmake Tue Apr 17 14:26:18 2018 +0200 +++ b/Resources/Orthanc/DownloadOrthancFramework.cmake Tue Apr 17 14:39:12 2018 +0200 @@ -157,18 +157,24 @@ set(ORTHANC_ROOT ${CMAKE_BINARY_DIR}/orthanc) - if (NOT EXISTS ${ORTHANC_ROOT}) + if (EXISTS ${ORTHANC_ROOT}) + message("Updating the Orthanc source repository using Mercurial") + execute_process( + COMMAND ${ORTHANC_FRAMEWORK_HG} pull + WORKING_DIRECTORY ${ORTHANC_ROOT} + RESULT_VARIABLE Failure + ) + else() message("Forking the Orthanc source repository using Mercurial") - execute_process( COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://bitbucket.org/sjodogne/orthanc" WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE Failure - ) - - if (Failure OR NOT EXISTS ${ORTHANC_ROOT}) - message(FATAL_ERROR "Cannot fork the Orthanc repository") - endif() + ) + endif() + + if (Failure OR NOT EXISTS ${ORTHANC_ROOT}) + message(FATAL_ERROR "Cannot fork the Orthanc repository") endif() message("Setting branch of the Orthanc repository to: ${ORTHANC_FRAMEWORK_BRANCH}")