1395
|
1 include(CheckLibraryExists)
|
1405
|
2 include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake)
|
1395
|
3
|
|
4
|
|
5 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
6 link_libraries(uuid)
|
|
7 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
|
|
8 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
|
|
9 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
10 link_libraries(rpcrt4 ws2_32 secur32)
|
|
11 if (CMAKE_COMPILER_IS_GNUCXX)
|
|
12 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
|
13 endif()
|
|
14
|
|
15 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)
|
|
16 if (HAVE_WIN_PTHREAD)
|
|
17 # This line is necessary to compile with recent versions of MinGW,
|
|
18 # otherwise "libwinpthread-1.dll" is not statically linked.
|
|
19 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
|
|
20 endif()
|
|
21 endif ()
|
|
22
|
|
23
|
|
24 if (CMAKE_COMPILER_IS_GNUCXX)
|
|
25 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${ORTHANC_ROOT}/Plugins/Samples/Common/VersionScript.map -Wl,--no-undefined")
|
|
26 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
|
|
27 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
|
|
28 endif()
|
|
29
|
|
30
|
|
31 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
32 # Linking with "pthread" is necessary, otherwise the software crashes
|
|
33 # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
|
|
34 link_libraries(dl rt)
|
|
35 endif()
|
|
36
|
|
37
|
|
38 include_directories(${ORTHANC_ROOT}/Plugins/Include/)
|
|
39
|
|
40 if (MSVC)
|
|
41 include_directories(${ORTHANC_ROOT}/Resources/ThirdParty/VisualStudio/)
|
|
42 endif()
|