|
1 |
| -# Copyright (c) 2010, 2012, 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
|
@@ -63,28 +63,37 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
63 | 63 | ENDIF()
|
64 | 64 |
|
65 | 65 | IF(MSVC)
|
66 |
| - # Enable debug info also in Release build, and create PDB to be able to analyze |
67 |
| - # crashes |
68 |
| - FOREACH(lang C CXX) |
69 |
| - SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi") |
70 |
| - ENDFOREACH() |
| 66 | + # Enable debug info also in Release build, |
| 67 | + # and create PDB to be able to analyze crashes. |
71 | 68 | FOREACH(type EXE SHARED MODULE)
|
72 |
| - SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") |
| 69 | + SET(CMAKE_{type}_LINKER_FLAGS_RELEASE |
| 70 | + "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") |
73 | 71 | ENDFOREACH()
|
74 | 72 |
|
75 |
| - # Force static runtime libraries |
76 |
| - # Choose C++ exception handling: |
77 |
| - # If /EH is not specified, the compiler will catch structured and |
78 |
| - # C++ exceptions, but will not destroy C++ objects that will go out of |
79 |
| - # scope as a result of the exception. |
80 |
| - # /EHsc catches C++ exceptions only and tells the compiler to assume that |
81 |
| - # extern C functions never throw a C++ exception. |
| 73 | + # For release types Debug Release RelWithDebInfo (but not MinSizeRel): |
| 74 | + # - Force static runtime libraries |
| 75 | + # - Choose C++ exception handling: |
| 76 | + # If /EH is not specified, the compiler will catch structured and |
| 77 | + # C++ exceptions, but will not destroy C++ objects that will go out of |
| 78 | + # scope as a result of the exception. |
| 79 | + # /EHsc catches C++ exceptions only and tells the compiler to assume that |
| 80 | + # extern C functions never throw a C++ exception. |
| 81 | + # - Choose debugging information: |
| 82 | + # /Z7 |
| 83 | + # Produces an .obj file containing full symbolic debugging |
| 84 | + # information for use with the debugger. The symbolic debugging |
| 85 | + # information includes the names and types of variables, as well as |
| 86 | + # functions and line numbers. No .pdb file is produced by the compiler. |
| 87 | + FOREACH(lang C CXX) |
| 88 | + SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7") |
| 89 | + ENDFOREACH() |
82 | 90 | FOREACH(flag
|
83 |
| - CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO |
84 |
| - CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT |
| 91 | + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO |
| 92 | + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT |
85 | 93 | CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
86 |
| - CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) |
| 94 | + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) |
87 | 95 | STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
|
| 96 | + STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") |
88 | 97 | SET("${flag}" "${${flag}} /EHsc")
|
89 | 98 | ENDFOREACH()
|
90 | 99 |
|
|
0 commit comments