comparison Resources/Samples/RestApi/CMakeLists.txt @ 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 8af8754a7a8e
children b2b56b4e33b0
comparison
equal deleted inserted replaced
278:771f12042be9 279:eb5fb5501569
2 2
3 project(RestApiSample) 3 project(RestApiSample)
4 4
5 include(ExternalProject) 5 include(ExternalProject)
6 6
7 # Send the toolchain information to the Orthanc
8 if (CMAKE_TOOLCHAIN_FILE)
9 set(TOOLCHAIN "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
10 endif()
11
7 ExternalProject_Add( 12 ExternalProject_Add(
8 ORTHANC_CORE 13 ORTHANC_CORE
9 PREFIX ${CMAKE_BINARY_DIR}/Orthanc/ 14
15 # We use the Orthanc-0.3.1 branch for this sample
10 DOWNLOAD_COMMAND hg clone https://code.google.com/p/orthanc/ -r Orthanc-0.3.1 16 DOWNLOAD_COMMAND hg clone https://code.google.com/p/orthanc/ -r Orthanc-0.3.1
11 UPDATE_COMMAND ""
12 SOURCE_DIR ${CMAKE_BINARY_DIR}/Orthanc/src/orthanc/
13 17
14 # Optional step, to reuse the third-party downloads 18 # Optional step, to reuse the third-party downloads
15 PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads ThirdPartyDownloads 19 PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads ThirdPartyDownloads
16 20
21 PREFIX ${CMAKE_BINARY_DIR}/Orthanc/
22 UPDATE_COMMAND ""
23 SOURCE_DIR ${CMAKE_BINARY_DIR}/Orthanc/src/orthanc/
17 CMAKE_COMMAND ${CMAKE_COMMAND} 24 CMAKE_COMMAND ${CMAKE_COMMAND}
18 CMAKE_ARGS -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DUSE_DYNAMIC_GOOGLE_LOG=OFF -DUSE_DYNAMIC_SQLITE=OFF -DONLY_CORE_LIBRARY=ON -DENABLE_SSL=OFF 25 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}
19 BUILD_COMMAND $(MAKE) 26 BUILD_COMMAND $(MAKE)
20 INSTALL_COMMAND "" 27 INSTALL_COMMAND ""
21 BUILD_IN_SOURCE 0 28 BUILD_IN_SOURCE 0
22 ) 29 )
23 30
24 ExternalProject_Get_Property(ORTHANC_CORE source_dir) 31 ExternalProject_Get_Property(ORTHANC_CORE source_dir)
25 include_directories(${source_dir}) 32 include_directories(${source_dir})
26 33
27 ExternalProject_Get_Property(ORTHANC_CORE binary_dir) 34 ExternalProject_Get_Property(ORTHANC_CORE binary_dir)
28 link_directories(${binary_dir}) 35 link_directories(${binary_dir})
29 include_directories(${binary_dir}/jsoncpp-src-0.5.0/include) 36 include_directories(${binary_dir}/jsoncpp-src-0.5.0/include)
30 include_directories(${binary_dir}/glog-0.3.2/src) 37 include_directories(${binary_dir}/glog-0.3.2/src)
38 include_directories(${binary_dir}/boost_1_49_0)
39
31 40
32 add_executable(RestApiSample 41 add_executable(RestApiSample
33 Sample.cpp 42 Sample.cpp
34 ) 43 )
35 44
37 46
38 target_link_libraries(RestApiSample 47 target_link_libraries(RestApiSample
39 # From Orthanc 48 # From Orthanc
40 CoreLibrary 49 CoreLibrary
41 GoogleLog 50 GoogleLog
51
52 # These two libraries are not necessary
42 #OpenSSL 53 #OpenSSL
43 54 #Curl
44 # System-wide libraries
45 pthread
46 ) 55 )
47 56
57 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
58 target_link_libraries(RestApiSample pthread)
59 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
60 add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
61 target_link_libraries(RestApiSample wsock32)
62 endif()