view Resources/Samples/RestApi/CMakeLists.txt @ 380:e6b4748c7d62 lua-scripting

lua-scripting
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Apr 2013 12:51:30 +0200
parents eb5fb5501569
children b2b56b4e33b0
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)

project(RestApiSample)

include(ExternalProject)

# Send the toolchain information to the Orthanc 
if (CMAKE_TOOLCHAIN_FILE)
  set(TOOLCHAIN "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
endif()

ExternalProject_Add(
  ORTHANC_CORE

  # We use the Orthanc-0.3.1 branch for this sample
  DOWNLOAD_COMMAND hg clone https://code.google.com/p/orthanc/ -r Orthanc-0.3.1

  # Optional step, to reuse the third-party downloads
  PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads ThirdPartyDownloads

  PREFIX ${CMAKE_BINARY_DIR}/Orthanc/
  UPDATE_COMMAND ""
  SOURCE_DIR ${CMAKE_BINARY_DIR}/Orthanc/src/orthanc/
  CMAKE_COMMAND ${CMAKE_COMMAND}
  CMAKE_ARGS -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DUSE_DYNAMIC_GOOGLE_LOG=OFF -DUSE_DYNAMIC_SQLITE=OFF -DONLY_CORE_LIBRARY=ON -DENABLE_SSL=OFF ${TOOLCHAIN}
  BUILD_COMMAND $(MAKE)
  INSTALL_COMMAND ""
  BUILD_IN_SOURCE 0
  )

ExternalProject_Get_Property(ORTHANC_CORE source_dir)
include_directories(${source_dir})

ExternalProject_Get_Property(ORTHANC_CORE binary_dir)
link_directories(${binary_dir})
include_directories(${binary_dir}/jsoncpp-src-0.5.0/include)
include_directories(${binary_dir}/glog-0.3.2/src)
include_directories(${binary_dir}/boost_1_49_0)


add_executable(RestApiSample
  Sample.cpp
  )

add_dependencies(RestApiSample ORTHANC_CORE)

target_link_libraries(RestApiSample 
  # From Orthanc
  CoreLibrary
  GoogleLog

  # These two libraries are not necessary
  #OpenSSL
  #Curl
  )

if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
  target_link_libraries(RestApiSample pthread)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
  add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
  target_link_libraries(RestApiSample wsock32)
endif()