|
| 1 | +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
| 2 | +# |
| 3 | +# The MySQL Connector/C++ is licensed under the terms of the GPLv2 |
| 4 | +# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most |
| 5 | +# MySQL Connectors. There are special exceptions to the terms and |
| 6 | +# conditions of the GPLv2 as it is applied to this software, see the |
| 7 | +# FLOSS License Exception |
| 8 | +# <http://www.mysql.com/about/legal/licensing/foss-exception.html>. |
| 9 | +# |
| 10 | +# This program is free software; you can redistribute it and/or modify |
| 11 | +# it under the terms of the GNU General Public License as published |
| 12 | +# by the Free Software Foundation; version 2 of the License. |
| 13 | +# |
| 14 | +# This program is distributed in the hope that it will be useful, but |
| 15 | +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 16 | +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 17 | +# for more details. |
| 18 | +# |
| 19 | +# You should have received a copy of the GNU General Public License along |
| 20 | +# with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | + |
| 23 | +########################################################################## |
| 24 | + |
| 25 | +# The parameter can be either T or D |
| 26 | +MACRO(CHANGE_CRT _switch2use) |
| 27 | + # Or should that be check for VS? |
| 28 | + IF(WIN32) |
| 29 | + SET(switch2change "D") |
| 30 | + |
| 31 | + IF(_switch2use STREQUAL "D" OR _switch2use STREQUAL "MD" OR _switch2use STREQUAL "/MD") |
| 32 | + SET(switch2use "D") |
| 33 | + SET(switch2change "T") |
| 34 | + ELSE(switch2use STREQUAL "D" OR _switch2use STREQUAL "MD" OR _switch2use STREQUAL "/MD") |
| 35 | + #Default is to change to /MT |
| 36 | + SET(switch2use "T") |
| 37 | + ENDIF(_switch2use STREQUAL "D" OR _switch2use STREQUAL "MD" OR _switch2use STREQUAL "/MD") |
| 38 | + |
| 39 | + FOREACH(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
| 40 | + IF(${flags} MATCHES "/M${switch2change}") |
| 41 | + STRING(REGEX REPLACE "/M${switch2change}" "/M${switch2use}" ${flags} "${${flags}}") |
| 42 | + ENDIF(${flags} MATCHES "/M${switch2change}") |
| 43 | + |
| 44 | + ENDFOREACH(flags) |
| 45 | + ENDIF(WIN32) |
| 46 | + |
| 47 | +ENDMACRO(CHANGE_CRT _switch2use) |
| 48 | + |
0 commit comments