annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 cmake_minimum_required(VERSION 2.8)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 project(RestApiSample)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 include(ExternalProject)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
7 # Send the toolchain information to the Orthanc
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
8 if (CMAKE_TOOLCHAIN_FILE)
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
9 set(TOOLCHAIN "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
10 endif()
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
11
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 ExternalProject_Add(
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 ORTHANC_CORE
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
14
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
15 # We use the Orthanc-0.3.1 branch for this sample
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 DOWNLOAD_COMMAND hg clone https://code.google.com/p/orthanc/ -r Orthanc-0.3.1
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 # Optional step, to reuse the third-party downloads
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads ThirdPartyDownloads
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
21 PREFIX ${CMAKE_BINARY_DIR}/Orthanc/
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
22 UPDATE_COMMAND ""
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
23 SOURCE_DIR ${CMAKE_BINARY_DIR}/Orthanc/src/orthanc/
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 CMAKE_COMMAND ${CMAKE_COMMAND}
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
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}
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 BUILD_COMMAND $(MAKE)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 INSTALL_COMMAND ""
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 BUILD_IN_SOURCE 0
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
29 )
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 ExternalProject_Get_Property(ORTHANC_CORE source_dir)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 include_directories(${source_dir})
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 ExternalProject_Get_Property(ORTHANC_CORE binary_dir)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 link_directories(${binary_dir})
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 include_directories(${binary_dir}/jsoncpp-src-0.5.0/include)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 include_directories(${binary_dir}/glog-0.3.2/src)
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
38 include_directories(${binary_dir}/boost_1_49_0)
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
39
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 add_executable(RestApiSample
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 Sample.cpp
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 )
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 add_dependencies(RestApiSample ORTHANC_CORE)
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 target_link_libraries(RestApiSample
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 # From Orthanc
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 CoreLibrary
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 GoogleLog
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
51
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
52 # These two libraries are not necessary
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 #OpenSSL
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
54 #Curl
276
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 )
8af8754a7a8e rest api demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
279
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
57 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
58 target_link_libraries(RestApiSample pthread)
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
59 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
60 add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
61 target_link_libraries(RestApiSample wsock32)
eb5fb5501569 the REST API sample can now be built with the MinGWToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 276
diff changeset
62 endif()