2012-05-06 06:09:08 +04:00
|
|
|
# WinPR: Windows Portable Runtime
|
2012-05-21 04:54:22 +04:00
|
|
|
# winpr cmake build script
|
2012-05-06 06:09:08 +04:00
|
|
|
#
|
2012-08-14 23:49:39 +04:00
|
|
|
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2012-05-06 06:09:08 +04:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2012-10-04 17:42:23 +04:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2012-09-21 06:11:56 +04:00
|
|
|
|
|
|
|
project(WinPR C)
|
|
|
|
|
|
|
|
set(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
|
|
|
|
if(FREERDP_VERSION)
|
2014-02-03 07:37:54 +04:00
|
|
|
set(FREERDP_BUILD 1)
|
2012-09-21 06:11:56 +04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Include cmake modules
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckStructHasMember)
|
|
|
|
include(FindPkgConfig)
|
|
|
|
include(TestBigEndian)
|
|
|
|
|
|
|
|
# Include our extra modules
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/)
|
|
|
|
|
2012-10-25 13:08:14 +04:00
|
|
|
# Check for cmake compatibility (enable/disable features)
|
|
|
|
include(CheckCmakeCompat)
|
2012-11-03 03:27:01 +04:00
|
|
|
include(FindFeature)
|
2014-02-03 07:37:54 +04:00
|
|
|
include(ComplexLibrary)
|
2012-09-21 06:11:56 +04:00
|
|
|
include(AutoVersioning)
|
|
|
|
include(ConfigOptions)
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
include(GNUInstallDirsWrapper)
|
2014-02-03 07:37:54 +04:00
|
|
|
include(CMakePackageConfigHelpers)
|
2012-09-21 06:11:56 +04:00
|
|
|
|
|
|
|
# Soname versioning
|
2013-10-29 22:47:40 +04:00
|
|
|
set(WINPR_VERSION_MAJOR "1")
|
2012-09-21 04:45:56 +04:00
|
|
|
set(WINPR_VERSION_MINOR "1")
|
|
|
|
set(WINPR_VERSION_REVISION "0")
|
|
|
|
set(WINPR_VERSION "${WINPR_VERSION_MAJOR}.${WINPR_VERSION_MINOR}")
|
|
|
|
set(WINPR_VERSION_FULL "${WINPR_VERSION}.${WINPR_VERSION_REVISION}")
|
|
|
|
|
2012-09-21 06:11:56 +04:00
|
|
|
# Default to release build type
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Default to build shared libs
|
|
|
|
if(NOT DEFINED BUILD_SHARED_LIBS)
|
|
|
|
set(BUILD_SHARED_LIBS ON)
|
|
|
|
endif()
|
|
|
|
|
2014-02-03 07:37:54 +04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
|
|
|
|
|
2014-04-21 22:42:24 +04:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
2012-08-01 00:22:10 +04:00
|
|
|
|
2013-09-10 22:03:15 +04:00
|
|
|
add_subdirectory(include)
|
2012-08-15 03:55:48 +04:00
|
|
|
|
2012-08-14 23:49:39 +04:00
|
|
|
add_subdirectory(libwinpr)
|
2012-08-14 22:37:31 +04:00
|
|
|
|
2013-03-14 20:38:50 +04:00
|
|
|
if(NOT ANDROID AND NOT IOS)
|
|
|
|
add_subdirectory(tools)
|
|
|
|
endif()
|
2013-10-29 06:09:31 +04:00
|
|
|
|
|
|
|
# Exporting
|
|
|
|
|
2013-10-29 22:47:40 +04:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER "2.8.10")
|
2013-10-29 06:09:31 +04:00
|
|
|
|
2013-10-29 22:47:40 +04:00
|
|
|
export(PACKAGE winpr)
|
2013-10-29 06:09:31 +04:00
|
|
|
|
2013-10-29 23:16:44 +04:00
|
|
|
set(WINPR_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/WinPR")
|
2013-10-29 06:09:31 +04:00
|
|
|
|
2013-10-29 22:47:40 +04:00
|
|
|
set(WINPR_INCLUDE_DIR "include")
|
2013-10-29 23:16:44 +04:00
|
|
|
set(WINPR_MONOLITHIC_BUILD ${MONOLITHIC_BUILD})
|
2013-10-29 06:09:31 +04:00
|
|
|
|
2013-10-29 22:47:40 +04:00
|
|
|
configure_package_config_file(WinPRConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake
|
|
|
|
INSTALL_DESTINATION ${WINPR_CMAKE_INSTALL_DIR}
|
2013-10-29 23:16:44 +04:00
|
|
|
PATH_VARS WINPR_INCLUDE_DIR WINPR_MONOLITHIC_BUILD)
|
2013-10-29 22:47:40 +04:00
|
|
|
|
|
|
|
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake
|
|
|
|
VERSION ${WINPR_VERSION} COMPATIBILITY SameMajorVersion)
|
|
|
|
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake
|
|
|
|
DESTINATION ${WINPR_CMAKE_INSTALL_DIR})
|
|
|
|
|
|
|
|
install(EXPORT WinPRTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR})
|
|
|
|
|
|
|
|
endif()
|
2013-10-29 06:09:31 +04:00
|
|
|
|