Mercurial > hg > orthanc
comparison Resources/CMake/Compiler.cmake @ 1414:0a67a502c90f
fixes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 Jun 2015 21:14:05 +0200 |
parents | dae2e28951c6 |
children | 037d5ffca74d |
comparison
equal
deleted
inserted
replaced
1413:98fa856b4f8f | 1414:0a67a502c90f |
---|---|
1 # This file sets all the compiler-related flags | 1 # This file sets all the compiler-related flags |
2 | 2 |
3 if (${CMAKE_COMPILER_IS_GNUCXX}) | 3 if (CMAKE_CROSSCOMPILING) |
4 # Cross-compilation necessarily implies standalone and static build | |
5 SET(STATIC_BUILD ON) | |
6 SET(STANDALONE_BUILD ON) | |
7 endif() | |
8 | |
9 if (CMAKE_COMPILER_IS_GNUCXX) | |
4 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long -Wno-implicit-function-declaration") | 10 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long -Wno-implicit-function-declaration") |
5 # --std=c99 makes libcurl not to compile | 11 # --std=c99 makes libcurl not to compile |
6 # -pedantic gives a lot of warnings on OpenSSL | 12 # -pedantic gives a lot of warnings on OpenSSL |
7 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-long-long -Wno-variadic-macros") | 13 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-long-long -Wno-variadic-macros") |
8 | 14 |
9 if (CMAKE_CROSSCOMPILING) | 15 if (CMAKE_CROSSCOMPILING) |
10 # http://stackoverflow.com/a/3543845/881731 | 16 # http://stackoverflow.com/a/3543845/881731 |
11 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -I<CMAKE_CURRENT_SOURCE_DIR> <SOURCE> <OBJECT>") | 17 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -I<CMAKE_CURRENT_SOURCE_DIR> <SOURCE> <OBJECT>") |
12 endif() | 18 endif() |
13 | 19 |
14 elseif (${MSVC}) | 20 elseif (MSVC) |
15 # Use static runtime under Visual Studio | 21 # Use static runtime under Visual Studio |
16 # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace | 22 # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace |
17 # http://stackoverflow.com/a/6510446 | 23 # http://stackoverflow.com/a/6510446 |
18 foreach(flag_var | 24 foreach(flag_var |
19 CMAKE_C_FLAGS_DEBUG | 25 CMAKE_C_FLAGS_DEBUG |
65 -DWINVER=0x0501 | 71 -DWINVER=0x0501 |
66 -D_CRT_SECURE_NO_WARNINGS=1 | 72 -D_CRT_SECURE_NO_WARNINGS=1 |
67 ) | 73 ) |
68 link_libraries(rpcrt4 ws2_32) | 74 link_libraries(rpcrt4 ws2_32) |
69 | 75 |
70 if (${CMAKE_COMPILER_IS_GNUCXX}) | 76 if (CMAKE_COMPILER_IS_GNUCXX) |
71 # This is a patch for MinGW64 | 77 # This is a patch for MinGW64 |
72 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") | 78 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") |
73 | 79 |
74 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD) | 80 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD) |
75 if (HAVE_WIN_PTHREAD) | 81 if (HAVE_WIN_PTHREAD) |
116 if (NOT HAVE_UUID_H) | 122 if (NOT HAVE_UUID_H) |
117 message(FATAL_ERROR "Please install the uuid-dev package") | 123 message(FATAL_ERROR "Please install the uuid-dev package") |
118 endif() | 124 endif() |
119 | 125 |
120 | 126 |
121 if (${STATIC_BUILD}) | 127 if (STATIC_BUILD) |
122 add_definitions(-DORTHANC_STATIC=1) | 128 add_definitions(-DORTHANC_STATIC=1) |
123 else() | 129 else() |
124 add_definitions(-DORTHANC_STATIC=0) | 130 add_definitions(-DORTHANC_STATIC=0) |
125 endif() | 131 endif() |