1aec784f75
When building packages, especially when source packages are used, git is not necessarily available or the source isn't provided in git. In those cases it wasn't possible to set the GIT_REVISION and --version shows "n/a" for the git revision. If the file .source_version is available now the content of it is used as GIT_REVISION. Packagers might want to add a .source_version file when they don't build the packages from git. Possible breaking change: The variable PRODUCT_VERSION isn't available anymore. Use GIT_REVISION instead.
64 lines
1.7 KiB
CMake
64 lines
1.7 KiB
CMake
# RdTk: Remote Desktop Toolkit
|
|
# rdtk cmake build script
|
|
#
|
|
# Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
#
|
|
# 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.
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
project(RdTk C)
|
|
|
|
set(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
# 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/)
|
|
|
|
# Check for cmake compatibility (enable/disable features)
|
|
include(CheckCmakeCompat)
|
|
include(FindFeature)
|
|
include(ConfigOptions)
|
|
include(CheckCCompilerFlag)
|
|
include(GNUInstallDirsWrapper)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
# 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()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRDTK_EXPORTS")
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
|
|
add_subdirectory(librdtk)
|
|
|
|
if(WITH_SAMPLE)
|
|
if(WITH_X11)
|
|
add_subdirectory(sample)
|
|
endif()
|
|
endif()
|