|
1 | | -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. |
| 1 | +# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. |
2 | 2 | # |
3 | 3 | # This program is free software; you can redistribute it and/or modify |
4 | 4 | # it under the terms of the GNU General Public License as published by |
@@ -62,22 +62,30 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) |
62 | 62 | ENDIF() |
63 | 63 |
|
64 | 64 | IF(MSVC) |
65 | | - # Enable debug info also in Release build, and create PDB to be able to analyze |
66 | | - # crashes |
67 | | - FOREACH(lang C CXX) |
68 | | - SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi") |
69 | | - ENDFOREACH() |
| 65 | + # Enable debug info also in Release build, |
| 66 | + # and create PDB to be able to analyze crashes. |
70 | 67 | FOREACH(type EXE SHARED MODULE) |
71 | | - SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") |
| 68 | + SET(CMAKE_{type}_LINKER_FLAGS_RELEASE |
| 69 | + "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") |
72 | 70 | ENDFOREACH() |
73 | 71 |
|
74 | 72 | # Force static runtime libraries |
| 73 | + # - Choose debugging information: |
| 74 | + # /Z7 |
| 75 | + # Produces an .obj file containing full symbolic debugging |
| 76 | + # information for use with the debugger. The symbolic debugging |
| 77 | + # information includes the names and types of variables, as well as |
| 78 | + # functions and line numbers. No .pdb file is produced by the compiler. |
| 79 | + FOREACH(lang C CXX) |
| 80 | + SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7") |
| 81 | + ENDFOREACH() |
75 | 82 | FOREACH(flag |
76 | | - CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO |
77 | | - CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT |
| 83 | + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO |
| 84 | + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT |
78 | 85 | CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO |
79 | | - CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) |
| 86 | + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) |
80 | 87 | STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") |
| 88 | + STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") |
81 | 89 | ENDFOREACH() |
82 | 90 |
|
83 | 91 | # Remove support for exceptions |
@@ -107,7 +115,6 @@ IF(MSVC) |
107 | 115 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") |
108 | 116 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099") |
109 | 117 |
|
110 | | - |
111 | 118 | IF(CMAKE_SIZEOF_VOID_P MATCHES 8) |
112 | 119 | # _WIN64 is defined by the compiler itself. |
113 | 120 | # Yet, we define it here again to work around a bug with Intellisense |
|
0 commit comments