Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 1 | # |
| 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
| 19 | |
| 20 | |
| 21 | # Visual Studio specific options |
| 22 | if(MSVC) |
| 23 | #For visual studio the library naming is as following: |
| 24 | # Dynamic libraries: |
| 25 | # - thfirt.dll for release library |
| 26 | # - thriftd.dll for debug library |
| 27 | # |
| 28 | # Static libraries: |
| 29 | # - thriftmd.lib for /MD release build |
| 30 | # - thriftmt.lib for /MT release build |
| 31 | # |
| 32 | # - thriftmdd.lib for /MD debug build |
| 33 | # - thriftmtd.lib for /MT debug build |
| 34 | # |
| 35 | # the same holds for other libraries like libthriftz etc. |
| 36 | |
| 37 | # For Debug build types, append a "d" to the library names. |
| 38 | set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE) |
| 39 | set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set release library postfix" FORCE) |
| 40 | |
| 41 | |
| 42 | # Build using /MT option instead of /MD if the WITH_MT options is set |
| 43 | if(WITH_MT) |
| 44 | set(CompilerFlags |
| 45 | CMAKE_CXX_FLAGS |
| 46 | CMAKE_CXX_FLAGS_DEBUG |
| 47 | CMAKE_CXX_FLAGS_RELEASE |
| 48 | CMAKE_C_FLAGS |
| 49 | CMAKE_C_FLAGS_DEBUG |
| 50 | CMAKE_C_FLAGS_RELEASE |
| 51 | ) |
| 52 | foreach(CompilerFlag ${CompilerFlags}) |
| 53 | string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") |
| 54 | endforeach() |
| 55 | set(STATIC_POSTFIX "mt" CACHE STRING "Set static library postfix" FORCE) |
| 56 | else(WITH_MT) |
| 57 | set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE) |
| 58 | endif(WITH_MT) |
| 59 | endif(MSVC) |
| 60 | |
| 61 | # GCC Specific |
| 62 | if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) |
| 63 | # TODO: -pedantic can not be used at the moment because of: https://issues.apache.org/jira/browse/THRIFT-2784 |
| 64 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall -Wextra -pedantic") |
| 65 | endif() |