comparison Plugins/Samples/Common/OrthancPlugins.cmake @ 1669:a412ad57f0f9 db-changes

refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 01 Oct 2015 11:55:25 +0200
parents fe458dde986e
children 41b70d5b44c9
comparison
equal deleted inserted replaced
1668:de1413733c97 1669:a412ad57f0f9
1 set(ORTHANC_ROOT ${SAMPLES_ROOT}/../..)
1 include(CheckIncludeFiles) 2 include(CheckIncludeFiles)
3 include(CheckIncludeFileCXX)
2 include(CheckLibraryExists) 4 include(CheckLibraryExists)
3 5 include(FindPythonInterp)
4 6 include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake)
5 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 7 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
6 link_libraries(uuid) 8 include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake)
7 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
8 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
9
10 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
11 link_libraries(rpcrt4 ws2_32 secur32)
12 if (CMAKE_COMPILER_IS_GNUCXX)
13 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
14 endif()
15
16 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)
17 if (HAVE_WIN_PTHREAD)
18 # This line is necessary to compile with recent versions of MinGW,
19 # otherwise "libwinpthread-1.dll" is not statically linked.
20 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
21 endif()
22 endif ()
23
24
25 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
26 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
27 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
28 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${SAMPLES_ROOT}/Common/VersionScript.map -Wl,--no-undefined")
29 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
30 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${CMAKE_SOURCE_DIR}/Plugins/Samples/Common/ExportedSymbols.list")
31 endif()
32 9
33 10
34 if (CMAKE_COMPILER_IS_GNUCXX) 11 if (CMAKE_COMPILER_IS_GNUCXX)
35 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic") 12 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
36 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic") 13 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
41 # Linking with "pthread" is necessary, otherwise the software crashes 18 # Linking with "pthread" is necessary, otherwise the software crashes
42 # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17 19 # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
43 link_libraries(dl rt) 20 link_libraries(dl rt)
44 endif() 21 endif()
45 22
23
46 include_directories(${SAMPLES_ROOT}/../Include/) 24 include_directories(${SAMPLES_ROOT}/../Include/)
25
47 26
48 if (MSVC) 27 if (MSVC)
49 include_directories(${SAMPLES_ROOT}/../../Resources/ThirdParty/VisualStudio/) 28 include_directories(${SAMPLES_ROOT}/../../Resources/ThirdParty/VisualStudio/)
50 endif() 29 endif()