barrier/CMakeLists.txt

99 lines
3.4 KiB
CMake
Raw Normal View History

# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file COPYING that should have accompanied this file.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Version number for Synergy
2011-04-25 16:52:35 +00:00
set(VERSION_MAJOR 1)
set(VERSION_MINOR 5)
set(VERSION_REV 0)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
# The check for 2.6 may be too strict (consider lowering).
2011-04-25 16:52:35 +00:00
cmake_minimum_required(VERSION 2.4.7)
# CMake complains if we don't have this.
2011-04-25 16:52:35 +00:00
if (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 NEW)
2011-04-25 16:52:35 +00:00
endif()
# We're escaping quotes in the Windows version number, because
# for some reason CMake won't do it at config version 2.4.7
# It seems that this restores the newer behaviour where define
# args are not auto-escaped.
2011-04-25 16:52:35 +00:00
if (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0005 NEW)
2011-04-25 16:52:35 +00:00
endif()
# First, declare project (important for prerequisite checks).
2011-04-25 16:52:35 +00:00
project(synergy C CXX)
# Set some easy to type variables.
2011-04-25 16:52:35 +00:00
set(root_dir ${CMAKE_SOURCE_DIR})
set(cmake_dir ${root_dir}/cmake)
set(bin_dir ${root_dir}/bin)
set(doc_dir ${root_dir}/doc)
set(doc_dir ${root_dir}/doc)
# Now for the stuff to generate config.h (and setup defines).
2011-04-25 16:52:35 +00:00
include(${cmake_dir}/CMakeLists_config.txt)
# Now for all the executables and libraries.
2011-04-25 16:52:35 +00:00
include(${cmake_dir}/CMakeLists_lib.txt)
include(${cmake_dir}/CMakeLists_synergyc.txt)
include(${cmake_dir}/CMakeLists_synergys.txt)
include(${cmake_dir}/CMakeLists_launcher.txt)
include(${cmake_dir}/CMakeLists_gtest.txt)
include(${cmake_dir}/CMakeLists_test.txt)
2011-01-18 12:08:38 +00:00
if (CONF_CPACK)
# Setup the CPack config.
2011-04-25 16:52:35 +00:00
include(${cmake_dir}/CMakeLists_cpack.txt)
2011-01-18 12:08:38 +00:00
endif()
2011-01-18 12:08:38 +00:00
if (CONF_DOXYGEN)
# Setup doxygen
2011-04-25 16:52:35 +00:00
include(${cmake_dir}/CMakeLists_doxygen.txt)
2011-01-18 12:08:38 +00:00
endif()
2011-04-25 16:52:35 +00:00
if (WIN32)
# add /analyze in order to unconver potential bugs in the source code
# Details: http://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx
# add /FR to generate browse information (ncb files) usefull for using IDE
#define _BIND_TO_CURRENT_CRT_VERSION 1
#define _BIND_TO_CURRENT_ATL_VERSION 1
#define _BIND_TO_CURRENT_MFC_VERSION 1
#define _BIND_TO_CURRENT_OPENMP_VERSION 1
# next line replaced the previous 4 ones:
#define _BIND_TO_CURRENT_VCLIBS_VERSION 1;
# compiler: /MP - use multi cores to compile
# added _SECURE_SCL=1 for finding bugs with iterators - http://msdn.microsoft.com/en-us/library/aa985965.aspx
# common args between all vs builds
2011-04-25 16:52:35 +00:00
set(VS_ARGS "/FR /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1 /D _SECURE_SCL=1 ${VS_ARGS_EXTRA}")
# we may use `cmake -D VS_ARGS_EXTRA="/analyze"` for example to specify
# analyze mode (since we don't always want to use it; e.g. on non-team
# or non-x86 compiler editions where there's no support)
2011-04-25 16:52:35 +00:00
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${VS_ARGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${VS_ARGS}")
# this line removes "/D NDEBUG" from release, we want them in order to
# find bugs even on release builds.
2011-04-25 16:52:35 +00:00
set(CMAKE_CXX_FLAGS_RELEASE "/MD /O2 /Ob2")
2011-04-25 16:52:35 +00:00
endif()