blob: 265659814fe0f6b3d138293c264176210feabc89 [file] [log] [blame]
Pascal Bachd5f87e12014-12-12 15:59:17 +01001#
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
21set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE)
22
23
24macro(ADD_LIBRARY_THRIFT name)
25
26if(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}")
39endif()
40
41if(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}")
53endif()
54
Jim King9de9b1f2015-04-30 16:03:34 -040055endmacro(ADD_LIBRARY_THRIFT)
56
Pascal Bachd5f87e12014-12-12 15:59:17 +010057
58macro(TARGET_LINK_LIBRARIES_THRIFT name)
59
60if(WITH_SHARED_LIB)
61 target_link_libraries(${name} ${ARGN})
62endif()
63
64if(WITH_STATIC_LIB)
65 target_link_libraries(${name}_static ${ARGN})
66endif()
67
Jim King9de9b1f2015-04-30 16:03:34 -040068endmacro(TARGET_LINK_LIBRARIES_THRIFT)
69
70
71macro(LINK_AGAINST_THRIFT_LIBRARY target libname)
72
73if (WITH_SHARED_LIB)
74 target_link_libraries(${target} ${libname})
75elseif (WITH_STATIC_LIB)
76 target_link_libraries(${target} ${libname}_static)
77else()
78 message(FATAL "Not linking with shared or static libraries?")
79endif()
80
81endmacro(LINK_AGAINST_THRIFT_LIBRARY)
82
83
84macro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY target libname)
85
86if(WITH_SHARED_LIB)
87 target_link_libraries(${target} ${libname})
88endif()
89
90if(WITH_STATIC_LIB)
91 target_link_libraries(${target}_static ${libname}_static)
92endif()
93
94endmacro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY)