changeset 279:eb5fb5501569

the REST API sample can now be built with the MinGWToolchain.cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Dec 2012 11:07:10 +0100
parents 771f12042be9
children 77e526e6fdf8
files Resources/Samples/RestApi/CMakeLists.txt
diffstat 1 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/Samples/RestApi/CMakeLists.txt	Sun Dec 09 21:51:57 2012 +0100
+++ b/Resources/Samples/RestApi/CMakeLists.txt	Mon Dec 10 11:07:10 2012 +0100
@@ -4,22 +4,29 @@
 
 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
-  PREFIX ${CMAKE_BINARY_DIR}/Orthanc/
+
+  # 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
-  UPDATE_COMMAND ""
-  SOURCE_DIR ${CMAKE_BINARY_DIR}/Orthanc/src/orthanc/
 
   # 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
+  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})
@@ -28,6 +35,8 @@
 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
@@ -39,9 +48,15 @@
   # From Orthanc
   CoreLibrary
   GoogleLog
+
+  # These two libraries are not necessary
   #OpenSSL
-
-  # System-wide libraries
-  pthread 
+  #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()