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 | set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE) |
| 22 | |
| 23 | |
| 24 | macro(ADD_LIBRARY_THRIFT name) |
| 25 | |
| 26 | if(WITH_SHARED_LIB) |
| 27 | add_library(${name} SHARED ${ARGN}) |
| 28 | #target_link_libraries(${name} ${SYSLIBS}) |
| 29 | set_target_properties(${name} PROPERTIES |
| 30 | OUTPUT_NAME ${name} |
| 31 | VERSION ${thrift_VERSION} |
| 32 | SOVERSION ${thrift_VERSION} ) |
| 33 | #set_target_properties(${name} PROPERTIES PUBLIC_HEADER "${thriftcpp_HEADERS}") |
| 34 | install(TARGETS ${name} |
| 35 | RUNTIME DESTINATION "${BIN_INSTALL_DIR}" |
| 36 | LIBRARY DESTINATION "${LIB_INSTALL_DIR}" |
| 37 | ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" |
| 38 | PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}") |
| 39 | endif() |
| 40 | |
| 41 | if(WITH_STATIC_LIB) |
| 42 | add_library(${name}_static STATIC ${ARGN}) |
| 43 | #target_link_libraries(${name}_static ${SYSLIBS}) |
| 44 | set_target_properties(${name}_static PROPERTIES |
| 45 | OUTPUT_NAME ${name}${STATIC_POSTFIX} |
| 46 | VERSION ${thrift_VERSION} |
| 47 | SOVERSION ${thrift_VERSION} ) |
| 48 | install(TARGETS ${name}_static |
| 49 | RUNTIME DESTINATION "${BIN_INSTALL_DIR}" |
| 50 | LIBRARY DESTINATION "${LIB_INSTALL_DIR}" |
| 51 | ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" |
| 52 | PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}") |
| 53 | endif() |
| 54 | |
| 55 | endmacro() |
| 56 | |
| 57 | macro(TARGET_LINK_LIBRARIES_THRIFT name) |
| 58 | |
| 59 | if(WITH_SHARED_LIB) |
| 60 | target_link_libraries(${name} ${ARGN}) |
| 61 | endif() |
| 62 | |
| 63 | if(WITH_STATIC_LIB) |
| 64 | target_link_libraries(${name}_static ${ARGN}) |
| 65 | endif() |
| 66 | |
| 67 | endmacro() |