Mercurial > hg > orthanc-webviewer
comparison Resources/CMake/Compiler.cmake @ 16:f926f0525b08
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Apr 2015 16:08:05 +0200 |
parents | |
children | 54d5dd1df2e5 |
comparison
equal
deleted
inserted
replaced
15:51b727a268f4 | 16:f926f0525b08 |
---|---|
1 # Orthanc - A Lightweight, RESTful DICOM Store | |
2 # Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
4 # | |
5 # This program is free software: you can redistribute it and/or | |
6 # modify it under the terms of the GNU Affero General Public License | |
7 # as published by the Free Software Foundation, either version 3 of | |
8 # the License, or (at your option) any later version. | |
9 # | |
10 # This program is distributed in the hope that it will be useful, but | |
11 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 # Affero General Public License for more details. | |
14 # | |
15 # You should have received a copy of the GNU Affero General Public License | |
16 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 # Force static build when cross-compiling | |
20 if (CMAKE_CROSSCOMPILING) | |
21 SET(STATIC_BUILD ON) | |
22 SET(STANDALONE_BUILD ON) | |
23 endif() | |
24 | |
25 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | |
26 SET(OS_LIBRARIES uuid rt dl) | |
27 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") | |
28 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread") | |
29 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
30 SET(OS_LIBRARIES rpcrt4 ws2_32 secur32) | |
31 if (CMAKE_COMPILER_IS_GNUCXX) | |
32 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") | |
33 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++") | |
34 endif() | |
35 endif () | |
36 | |
37 if (CMAKE_COMPILER_IS_GNUCXX) | |
38 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/Resources/VersionScript.map -Wl,--no-undefined") | |
39 endif() | |
40 | |
41 if (MSVC) | |
42 # Use static runtime under Visual Studio | |
43 # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace | |
44 # http://stackoverflow.com/a/6510446 | |
45 foreach(flag_var | |
46 CMAKE_C_FLAGS_DEBUG | |
47 CMAKE_CXX_FLAGS_DEBUG | |
48 CMAKE_C_FLAGS_RELEASE | |
49 CMAKE_CXX_FLAGS_RELEASE | |
50 CMAKE_C_FLAGS_MINSIZEREL | |
51 CMAKE_CXX_FLAGS_MINSIZEREL | |
52 CMAKE_C_FLAGS_RELWITHDEBINFO | |
53 CMAKE_CXX_FLAGS_RELWITHDEBINFO) | |
54 string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | |
55 string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") | |
56 endforeach(flag_var) | |
57 | |
58 add_definitions( | |
59 -D_CRT_SECURE_NO_WARNINGS=1 | |
60 -D_CRT_NONSTDC_NO_DEPRECATE=1 | |
61 ) | |
62 endif() |