diff Plugins/Samples/ServeFolders/CMakeLists.txt @ 1390:92da9e1c2daa

improvement of samples
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 May 2015 17:24:01 +0200
parents a761deb85729
children b3119c32c920
line wrap: on
line diff
--- a/Plugins/Samples/ServeFolders/CMakeLists.txt	Fri May 29 15:31:46 2015 +0200
+++ b/Plugins/Samples/ServeFolders/CMakeLists.txt	Fri May 29 17:24:01 2015 +0200
@@ -2,34 +2,18 @@
 
 project(ServeFolders)
 
-set(ALLOW_DOWNLOADS ON)
-set(USE_SYSTEM_JSONCPP OFF)
-include(../../../Resources/CMake/DownloadPackage.cmake)
-include(../../../Resources/CMake/JsonCppConfiguration.cmake)
+SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
+SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
+
+set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/../../../)
 
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-  link_libraries(uuid)
-  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
-  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
-elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-  link_libraries(rpcrt4 ws2_32 secur32)
-  if (CMAKE_COMPILER_IS_GNUCXX)
-    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
-  endif()
-endif ()
+include(CheckIncludeFiles)
+include(CheckIncludeFileCXX)
+include(${CMAKE_SOURCE_DIR}/../Common/OrthancPlugins.cmake)
+include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
+include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake)
 
-if (CMAKE_COMPILER_IS_GNUCXX)
-  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/VersionScript.map -Wl,--no-undefined")
-endif()
-
-include_directories(${CMAKE_SOURCE_DIR}/../../Include/)
 add_library(ServeFolders SHARED 
   Plugin.cpp
   ${THIRD_PARTY_SOURCES}
   )
-
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-  # Linking with "pthread" is necessary, otherwise the software crashes
-  # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
-  target_link_libraries(ServeFolders dl rt)
-endif()