comparison Plugins/Samples/Common/OrthancPlugins.cmake @ 1390:92da9e1c2daa

improvement of samples
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 May 2015 17:24:01 +0200
parents
children 785e01da36a1
comparison
equal deleted inserted replaced
1389:c236a8b35a3b 1390:92da9e1c2daa
1 include(CheckLibraryExists)
2
3
4 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
5 link_libraries(uuid)
6 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
7 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
8 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
9 link_libraries(rpcrt4 ws2_32 secur32)
10 if (CMAKE_COMPILER_IS_GNUCXX)
11 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
12 endif()
13
14 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)
15 if (HAVE_WIN_PTHREAD)
16 # This line is necessary to compile with recent versions of MinGW,
17 # otherwise "libwinpthread-1.dll" is not statically linked.
18 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
19 endif()
20 endif ()
21
22
23 if (CMAKE_COMPILER_IS_GNUCXX)
24 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${ORTHANC_ROOT}/Plugins/Samples/Common/VersionScript.map -Wl,--no-undefined")
25 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
26 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
27 endif()
28
29
30 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
31 # Linking with "pthread" is necessary, otherwise the software crashes
32 # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
33 link_libraries(dl rt)
34 endif()
35
36
37 include_directories(${ORTHANC_ROOT}/Plugins/Include/)