Mercurial > hg > orthanc
comparison Resources/CMake/Compiler.cmake @ 3568:589238dcd782
DYNAMIC_MINGW_STDLIB
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 12 Nov 2019 18:28:23 +0100 |
parents | cfaa9eded17e |
children | e01900f913e7 |
comparison
equal
deleted
inserted
replaced
3567:8b8edb26d4c1 | 3568:589238dcd782 |
---|---|
161 # Some additional C/C++ compiler flags for MinGW | 161 # Some additional C/C++ compiler flags for MinGW |
162 SET(MINGW_NO_WARNINGS "-Wno-unused-function -Wno-unused-variable") | 162 SET(MINGW_NO_WARNINGS "-Wno-unused-function -Wno-unused-variable") |
163 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MINGW_NO_WARNINGS} -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast") | 163 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MINGW_NO_WARNINGS} -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast") |
164 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MINGW_NO_WARNINGS}") | 164 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MINGW_NO_WARNINGS}") |
165 | 165 |
166 # This is a patch for MinGW64 | 166 if (DYNAMIC_MINGW_STDLIB) |
167 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") | 167 else() |
168 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") | 168 # This is a patch for MinGW64 |
169 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") | |
170 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") | |
171 endif() | |
169 | 172 |
170 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD) | 173 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD) |
171 if (HAVE_WIN_PTHREAD) | 174 if (HAVE_WIN_PTHREAD) |
172 # This line is necessary to compile with recent versions of MinGW, | 175 if (DYNAMIC_MINGW_STDLIB) |
173 # otherwise "libwinpthread-1.dll" is not statically linked. | 176 else() |
174 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic") | 177 # This line is necessary to compile with recent versions of MinGW, |
178 # otherwise "libwinpthread-1.dll" is not statically linked. | |
179 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic") | |
180 endif() | |
175 add_definitions(-DHAVE_WIN_PTHREAD=1) | 181 add_definitions(-DHAVE_WIN_PTHREAD=1) |
176 else() | 182 else() |
177 add_definitions(-DHAVE_WIN_PTHREAD=0) | 183 add_definitions(-DHAVE_WIN_PTHREAD=0) |
178 endif() | 184 endif() |
179 endif() | 185 endif() |