annotate Plugins/Samples/Common/OrthancPlugins.cmake @ 1418:efc448de0899

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 23 Jun 2015 09:50:08 +0200
parents dae2e28951c6
children 97268448bdfc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1395
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
1 include(CheckLibraryExists)
1405
dae2e28951c6 fix freebsd build
jodogne
parents: 1395
diff changeset
2 include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake)
1395
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
3
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
4
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
5 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
6 link_libraries(uuid)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
7 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
8 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
9 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
10 link_libraries(rpcrt4 ws2_32 secur32)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
11 if (CMAKE_COMPILER_IS_GNUCXX)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
12 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
13 endif()
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
14
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
15 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
16 if (HAVE_WIN_PTHREAD)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
17 # This line is necessary to compile with recent versions of MinGW,
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
18 # otherwise "libwinpthread-1.dll" is not statically linked.
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
19 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
20 endif()
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
21 endif ()
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
22
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
23
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
24 if (CMAKE_COMPILER_IS_GNUCXX)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
25 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${ORTHANC_ROOT}/Plugins/Samples/Common/VersionScript.map -Wl,--no-undefined")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
26 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
27 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
28 endif()
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
29
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
30
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
31 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
32 # Linking with "pthread" is necessary, otherwise the software crashes
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
33 # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
34 link_libraries(dl rt)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
35 endif()
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
36
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
37
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
38 include_directories(${ORTHANC_ROOT}/Plugins/Include/)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
39
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
40 if (MSVC)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
41 include_directories(${ORTHANC_ROOT}/Resources/ThirdParty/VisualStudio/)
785e01da36a1 fix visual studio
jodogne
parents: 1390
diff changeset
42 endif()