2009-09-28 19:43:28 +04:00
|
|
|
#=============================================================================
|
|
|
|
# CMake - Cross Platform Makefile Generator
|
2012-04-27 00:35:55 +04:00
|
|
|
# Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
|
2009-09-28 19:43:28 +04:00
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2013-10-11 02:02:24 +04:00
|
|
|
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
|
2013-10-02 22:45:54 +04:00
|
|
|
if(POLICY CMP0025)
|
|
|
|
cmake_policy(SET CMP0025 NEW)
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
project(CMake)
|
2008-03-17 23:22:28 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_BOOTSTRAP)
|
2011-01-10 17:32:09 +03:00
|
|
|
# Running from bootstrap script. Set local variable and remove from cache.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_BOOTSTRAP 1)
|
|
|
|
unset(CMAKE_BOOTSTRAP CACHE)
|
|
|
|
endif()
|
2011-01-10 17:32:09 +03:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin)
|
|
|
|
endif()
|
2009-12-08 19:44:28 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
2009-12-15 01:47:14 +03:00
|
|
|
# Disallow architecture-specific try_run. It may not run on the host.
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(TRY_RUN)
|
|
|
|
if(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
|
|
|
|
message(FATAL_ERROR "TRY_RUN not allowed with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES=[${CMAKE_TRY_COMPILE_OSX_ARCHITECTURES}]")
|
|
|
|
else()
|
2009-12-15 01:47:14 +03:00
|
|
|
_TRY_RUN(${ARGV})
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
endif()
|
2009-12-15 01:47:14 +03:00
|
|
|
|
2014-11-19 02:30:40 +03:00
|
|
|
# Use most-recent available language dialects with GNU and Clang
|
2014-12-05 22:06:43 +03:00
|
|
|
if(NOT DEFINED CMAKE_C_STANDARD)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
endif()
|
2014-11-19 02:30:40 +03:00
|
|
|
|
2014-03-14 18:47:37 +04:00
|
|
|
# option to set the internal encoding of CMake to UTF-8
|
2014-12-27 07:25:20 +03:00
|
|
|
option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally." ON)
|
2014-03-14 18:47:37 +04:00
|
|
|
mark_as_advanced(CMAKE_ENCODING_UTF8)
|
|
|
|
if(CMAKE_ENCODING_UTF8)
|
|
|
|
set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
|
|
|
|
endif()
|
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
# a macro to deal with system libraries, implemented as a macro
|
|
|
|
# simply to improve readability of the main script
|
|
|
|
#-----------------------------------------------------------------------
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
|
2009-06-11 17:04:04 +04:00
|
|
|
# Options have dependencies.
|
2012-08-13 21:47:32 +04:00
|
|
|
include(CMakeDependentOption)
|
2007-05-11 17:02:17 +04:00
|
|
|
|
2009-06-11 19:24:56 +04:00
|
|
|
# Optionally use system xmlrpc. We no longer build or use it by default.
|
2012-08-13 21:47:32 +04:00
|
|
|
option(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF)
|
|
|
|
mark_as_advanced(CTEST_USE_XMLRPC)
|
2009-06-11 19:24:56 +04:00
|
|
|
|
2011-01-10 17:32:09 +03:00
|
|
|
# Allow the user to enable/disable all system utility library options by
|
|
|
|
# defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
|
2015-01-20 18:31:13 +03:00
|
|
|
set(UTILITIES BZIP2 CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA ZLIB)
|
2012-08-13 21:47:32 +04:00
|
|
|
foreach(util ${UTILITIES})
|
|
|
|
if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
|
2011-01-10 17:32:09 +03:00
|
|
|
AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_USE_SYSTEM_LIBRARY_${util} "${CMAKE_USE_SYSTEM_LIBRARIES}")
|
|
|
|
endif()
|
|
|
|
if(DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util})
|
|
|
|
if(CMAKE_USE_SYSTEM_LIBRARY_${util})
|
|
|
|
set(CMAKE_USE_SYSTEM_LIBRARY_${util} ON)
|
|
|
|
else()
|
|
|
|
set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF)
|
|
|
|
endif()
|
|
|
|
if(CMAKE_BOOTSTRAP)
|
|
|
|
unset(CMAKE_USE_SYSTEM_LIBRARY_${util} CACHE)
|
|
|
|
endif()
|
|
|
|
string(TOLOWER "${util}" lutil)
|
|
|
|
set(CMAKE_USE_SYSTEM_${util} "${CMAKE_USE_SYSTEM_LIBRARY_${util}}"
|
2011-01-10 17:32:09 +03:00
|
|
|
CACHE BOOL "Use system-installed ${lutil}" FORCE)
|
2012-08-13 21:47:32 +04:00
|
|
|
else()
|
|
|
|
set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF)
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_BOOTSTRAP)
|
|
|
|
unset(CMAKE_USE_SYSTEM_LIBRARIES CACHE)
|
|
|
|
endif()
|
2009-06-11 17:04:04 +04:00
|
|
|
|
|
|
|
# Optionally use system utility libraries.
|
2012-08-13 21:47:32 +04:00
|
|
|
option(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}")
|
2009-06-11 19:24:56 +04:00
|
|
|
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl"
|
2011-01-10 17:32:09 +03:00
|
|
|
"${CMAKE_USE_SYSTEM_LIBRARY_CURL}" "NOT CTEST_USE_XMLRPC" ON)
|
2009-06-11 17:04:04 +04:00
|
|
|
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat"
|
2011-01-10 17:32:09 +03:00
|
|
|
"${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}" "NOT CTEST_USE_XMLRPC" ON)
|
2009-06-11 17:04:04 +04:00
|
|
|
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
|
2011-01-10 17:32:09 +03:00
|
|
|
"${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON)
|
2010-07-29 18:12:09 +04:00
|
|
|
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2"
|
2011-01-10 17:32:09 +03:00
|
|
|
"${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
|
2014-07-14 00:23:22 +04:00
|
|
|
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
|
|
|
|
"${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
|
2014-11-18 23:47:02 +03:00
|
|
|
option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}")
|
2015-01-20 18:31:13 +03:00
|
|
|
option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}")
|
2009-06-11 17:04:04 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
# Mention to the user what system libraries are being used.
|
2012-08-13 21:47:32 +04:00
|
|
|
foreach(util ${UTILITIES})
|
|
|
|
if(CMAKE_USE_SYSTEM_${util})
|
|
|
|
message(STATUS "Using system-installed ${util}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
# Inform utility library header wrappers whether to use system versions.
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in
|
2007-05-11 17:02:17 +04:00
|
|
|
${CMake_BINARY_DIR}/Utilities/cmThirdParty.h
|
|
|
|
@ONLY)
|
|
|
|
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
set(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
|
2014-08-06 17:20:24 +04:00
|
|
|
if(WIN32 AND NOT UNIX AND NOT MINGW)
|
2014-03-04 00:24:03 +04:00
|
|
|
set(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
# a macro to determine the generator and ctest executable to use
|
|
|
|
# for testing. Simply to improve readability of the main script.
|
|
|
|
#-----------------------------------------------------------------------
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(CMAKE_SETUP_TESTING)
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
set(CMAKE_TEST_SYSTEM_LIBRARIES 0)
|
|
|
|
foreach(util CURL EXPAT XMLRPC ZLIB)
|
|
|
|
if(CMAKE_USE_SYSTEM_${util})
|
|
|
|
set(CMAKE_TEST_SYSTEM_LIBRARIES 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
# This variable is set by cmake, however to
|
|
|
|
# test cmake we want to make sure that
|
|
|
|
# the ctest from this cmake is used for testing
|
|
|
|
# and not the ctest from the cmake building and testing
|
|
|
|
# cmake.
|
2014-03-04 00:24:03 +04:00
|
|
|
if(CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
set(CMAKE_CTEST_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/ctest")
|
|
|
|
set(CMAKE_CMAKE_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cmake")
|
|
|
|
set(CMAKE_CPACK_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cpack")
|
|
|
|
foreach(exe cmake ctest cpack)
|
|
|
|
add_executable(${exe} IMPORTED)
|
|
|
|
set_property(TARGET ${exe} PROPERTY IMPORTED_LOCATION ${CMake_TEST_EXTERNAL_CMAKE}/${exe})
|
|
|
|
endforeach()
|
|
|
|
else()
|
|
|
|
set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest")
|
|
|
|
set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake")
|
|
|
|
set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack")
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
# configure some files for testing
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
|
2007-05-11 17:02:17 +04:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
|
2009-10-20 22:31:10 +04:00
|
|
|
@ONLY)
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
|
2007-05-11 17:02:17 +04:00
|
|
|
${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
|
2007-05-11 17:02:17 +04:00
|
|
|
${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
|
2007-08-31 22:51:09 +04:00
|
|
|
${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
|
2012-08-13 21:47:32 +04:00
|
|
|
if(BUILD_TESTING AND DART_ROOT)
|
|
|
|
configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif
|
2008-03-04 17:10:05 +03:00
|
|
|
${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(DART_ROOT)
|
|
|
|
mark_as_advanced(CURL_TESTING)
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
|
2010-10-02 01:23:53 +04:00
|
|
|
# Provide a way for Visual Studio Express users to turn OFF the new FOLDER
|
|
|
|
# organization feature. Default to ON for non-Express users. Express users must
|
|
|
|
# explicitly turn off this option to build CMake in the Express IDE...
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
|
|
|
|
mark_as_advanced(CMAKE_USE_FOLDERS)
|
2010-10-02 01:23:53 +04:00
|
|
|
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
# a macro that only sets the FOLDER target property if it's
|
|
|
|
# "appropriate"
|
|
|
|
#-----------------------------------------------------------------------
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(CMAKE_SET_TARGET_FOLDER tgt folder)
|
|
|
|
if(CMAKE_USE_FOLDERS)
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
2013-10-11 02:02:24 +04:00
|
|
|
if(MSVC AND TARGET ${tgt})
|
|
|
|
set_property(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2010-09-03 21:53:22 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
# a macro to build the utilities used by CMake
|
|
|
|
# Simply to improve readability of the main script.
|
|
|
|
#-----------------------------------------------------------------------
|
2012-08-13 21:47:32 +04:00
|
|
|
macro (CMAKE_BUILD_UTILITIES)
|
2007-05-11 17:02:17 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Create the kwsys library for CMake.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(KWSYS_NAMESPACE cmsys)
|
|
|
|
set(KWSYS_USE_SystemTools 1)
|
|
|
|
set(KWSYS_USE_Directory 1)
|
|
|
|
set(KWSYS_USE_RegularExpression 1)
|
|
|
|
set(KWSYS_USE_Base64 1)
|
|
|
|
set(KWSYS_USE_MD5 1)
|
|
|
|
set(KWSYS_USE_Process 1)
|
|
|
|
set(KWSYS_USE_CommandLineArguments 1)
|
|
|
|
set(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
|
2013-08-26 19:50:08 +04:00
|
|
|
set(KWSYS_INSTALL_DOC_DIR "${CMAKE_DOC_DIR}")
|
2012-08-13 21:47:32 +04:00
|
|
|
add_subdirectory(Source/kwsys)
|
|
|
|
set(kwsys_folder "Utilities/KWSys")
|
2010-09-03 21:53:22 +04:00
|
|
|
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
|
|
|
|
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}")
|
2011-09-14 18:38:04 +04:00
|
|
|
if(BUILD_TESTING)
|
|
|
|
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}")
|
|
|
|
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}")
|
|
|
|
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsC "${kwsys_folder}")
|
|
|
|
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsCxx "${kwsys_folder}")
|
|
|
|
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestSharedForward "${kwsys_folder}")
|
|
|
|
endif()
|
2010-09-03 21:53:22 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Setup third-party libraries.
|
|
|
|
# Everything in the tree should be able to include files from the
|
|
|
|
# Utilities directory.
|
2012-08-13 21:47:32 +04:00
|
|
|
include_directories(
|
2007-05-11 17:02:17 +04:00
|
|
|
${CMake_BINARY_DIR}/Utilities
|
2008-09-29 23:47:46 +04:00
|
|
|
${CMake_SOURCE_DIR}/Utilities
|
2007-05-11 17:02:17 +04:00
|
|
|
)
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
# check for the use of system libraries versus builtin ones
|
2007-05-11 20:17:27 +04:00
|
|
|
# (a macro defined in this file)
|
2007-05-11 17:02:17 +04:00
|
|
|
CMAKE_HANDLE_SYSTEM_LIBRARIES()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build zlib library for Curl, CMake, and CTest.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_ZLIB_HEADER "cm_zlib.h")
|
|
|
|
if(CMAKE_USE_SYSTEM_ZLIB)
|
|
|
|
find_package(ZLIB)
|
|
|
|
if(NOT ZLIB_FOUND)
|
|
|
|
message(FATAL_ERROR
|
2007-05-11 17:02:17 +04:00
|
|
|
"CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR})
|
|
|
|
set(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_ZLIB_INCLUDES ${CMake_SOURCE_DIR}/Utilities)
|
|
|
|
set(CMAKE_ZLIB_LIBRARIES cmzlib)
|
|
|
|
add_subdirectory(Utilities/cmzlib)
|
2010-09-03 21:53:22 +04:00
|
|
|
CMAKE_SET_TARGET_FOLDER(cmzlib "Utilities/3rdParty")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build Curl library for CTest.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_USE_SYSTEM_CURL)
|
|
|
|
find_package(CURL)
|
|
|
|
if(NOT CURL_FOUND)
|
|
|
|
message(FATAL_ERROR
|
2007-05-11 17:02:17 +04:00
|
|
|
"CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS})
|
|
|
|
set(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES})
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER})
|
|
|
|
set(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
|
|
|
|
set(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
|
2014-10-30 16:11:10 +03:00
|
|
|
add_definitions(-DCURL_STATICLIB)
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_CURL_INCLUDES)
|
|
|
|
set(CMAKE_CURL_LIBRARIES cmcurl)
|
|
|
|
if(CMAKE_TESTS_CDASH_SERVER)
|
|
|
|
set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2015-01-22 00:42:18 +03:00
|
|
|
option(CMAKE_USE_OPENSSL "Use OpenSSL." OFF)
|
|
|
|
mark_as_advanced(CMAKE_USE_OPENSSL)
|
|
|
|
if(CMAKE_USE_OPENSSL)
|
|
|
|
set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
|
|
|
|
set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory")
|
|
|
|
mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH)
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
add_subdirectory(Utilities/cmcurl)
|
2010-09-03 21:53:22 +04:00
|
|
|
CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
|
|
|
|
CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build Compress library for CTest.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_COMPRESS_INCLUDES
|
2007-05-11 17:02:17 +04:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_COMPRESS_LIBRARIES "cmcompress")
|
|
|
|
add_subdirectory(Utilities/cmcompress)
|
2010-09-03 21:53:22 +04:00
|
|
|
CMAKE_SET_TARGET_FOLDER(cmcompress "Utilities/3rdParty")
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_USE_SYSTEM_BZIP2)
|
|
|
|
find_package(BZip2)
|
|
|
|
else()
|
|
|
|
set(BZIP2_INCLUDE_DIR
|
2009-10-30 20:10:56 +03:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
|
2012-08-13 21:47:32 +04:00
|
|
|
set(BZIP2_LIBRARIES cmbzip2)
|
|
|
|
add_subdirectory(Utilities/cmbzip2)
|
2010-09-03 21:53:22 +04:00
|
|
|
CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
2010-07-29 18:12:09 +04:00
|
|
|
|
2014-07-14 00:23:22 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build or use system liblzma for libarchive.
|
|
|
|
if(CMAKE_USE_SYSTEM_LIBLZMA)
|
|
|
|
find_package(LibLZMA)
|
|
|
|
if(NOT LIBLZMA_FOUND)
|
|
|
|
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
|
|
|
|
endif()
|
|
|
|
set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
|
|
|
|
set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
|
|
|
|
else()
|
|
|
|
add_subdirectory(Utilities/cmliblzma)
|
|
|
|
CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
|
|
|
|
set(LZMA_INCLUDE_DIR
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
|
|
|
|
set(LZMA_LIBRARY cmliblzma)
|
|
|
|
endif()
|
|
|
|
|
2010-07-29 18:12:09 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build or use system libarchive for CMake and CTest.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_USE_SYSTEM_LIBARCHIVE)
|
2013-10-11 02:02:24 +04:00
|
|
|
find_package(LibArchive)
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT LibArchive_FOUND)
|
|
|
|
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
|
|
|
|
endif()
|
|
|
|
set(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS})
|
|
|
|
set(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES})
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
|
|
|
|
set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
|
|
|
|
add_definitions(-DLIBARCHIVE_STATIC)
|
|
|
|
set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle")
|
|
|
|
set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL")
|
2014-07-14 00:23:22 +04:00
|
|
|
set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system found LZMA library if found")
|
2014-04-03 23:20:58 +04:00
|
|
|
set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found")
|
|
|
|
set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found")
|
|
|
|
set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
|
|
|
|
set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system found PCREPOSIX library if found")
|
|
|
|
set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system found LibGCC library if found")
|
2012-08-13 21:47:32 +04:00
|
|
|
set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support")
|
|
|
|
set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support")
|
|
|
|
set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support")
|
|
|
|
add_subdirectory(Utilities/cmlibarchive)
|
2010-09-03 21:53:22 +04:00
|
|
|
CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2009-10-30 20:10:56 +03:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build expat library for CMake and CTest.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_USE_SYSTEM_EXPAT)
|
|
|
|
find_package(EXPAT)
|
|
|
|
if(NOT EXPAT_FOUND)
|
|
|
|
message(FATAL_ERROR
|
2007-05-11 17:02:17 +04:00
|
|
|
"CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
|
|
|
|
set(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_EXPAT_INCLUDES)
|
|
|
|
set(CMAKE_EXPAT_LIBRARIES cmexpat)
|
|
|
|
add_subdirectory(Utilities/cmexpat)
|
2010-09-03 21:53:22 +04:00
|
|
|
CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2015-01-13 18:45:04 +03:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build jsoncpp library.
|
2015-01-20 18:31:13 +03:00
|
|
|
if(CMAKE_USE_SYSTEM_JSONCPP)
|
|
|
|
if(EXISTS ${CMAKE_ROOT}/Modules/FindJsonCpp.cmake)
|
|
|
|
find_package(JsonCpp)
|
|
|
|
elseif(NOT CMAKE_VERSION VERSION_LESS 3.0)
|
|
|
|
include(${CMake_SOURCE_DIR}/Modules/FindJsonCpp.cmake)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP requires CMake >= 3.0")
|
|
|
|
endif()
|
|
|
|
if(NOT JsonCpp_FOUND)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!")
|
|
|
|
endif()
|
|
|
|
set(CMAKE_JSONCPP_LIBRARIES JsonCpp::JsonCpp)
|
|
|
|
else()
|
|
|
|
set(CMAKE_JSONCPP_LIBRARIES cmjsoncpp)
|
|
|
|
add_subdirectory(Utilities/cmjsoncpp)
|
|
|
|
CMAKE_SET_TARGET_FOLDER(cmjsoncpp "Utilities/3rdParty")
|
|
|
|
endif()
|
2015-01-13 18:45:04 +03:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Build XMLRPC library for CMake and CTest.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CTEST_USE_XMLRPC)
|
|
|
|
find_package(XMLRPC QUIET REQUIRED libwww-client)
|
|
|
|
if(NOT XMLRPC_FOUND)
|
|
|
|
message(FATAL_ERROR
|
2009-06-11 19:24:56 +04:00
|
|
|
"CTEST_USE_XMLRPC is ON but xmlrpc is not found!")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS})
|
|
|
|
set(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Use curses?
|
2012-08-13 21:47:32 +04:00
|
|
|
if (UNIX)
|
2007-11-24 04:45:49 +03:00
|
|
|
# there is a bug in the Syllable libraries which makes linking ccmake fail, Alex
|
2014-09-09 17:09:57 +04:00
|
|
|
if(NOT CMAKE_SYSTEM_NAME MATCHES syllable)
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CURSES_NEED_NCURSES TRUE)
|
|
|
|
find_package(Curses QUIET)
|
|
|
|
if (CURSES_LIBRARY)
|
|
|
|
option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
|
2012-08-13 21:50:14 +04:00
|
|
|
else ()
|
2012-08-13 21:47:32 +04:00
|
|
|
message("Curses libraries were not found. Curses GUI for CMake will not be built.")
|
|
|
|
set(BUILD_CursesDialog 0)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(BUILD_CursesDialog 0)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
else ()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(BUILD_CursesDialog 0)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(BUILD_CursesDialog)
|
2014-11-18 23:47:02 +03:00
|
|
|
if(NOT CMAKE_USE_SYSTEM_FORM)
|
|
|
|
add_subdirectory(Source/CursesDialog/form)
|
|
|
|
elseif(NOT CURSES_FORM_LIBRARY)
|
|
|
|
message( FATAL_ERROR "CMAKE_USE_SYSTEM_FORM in ON but CURSES_FORM_LIBRARY is not set!" )
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endmacro ()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
2010-07-06 17:54:36 +04:00
|
|
|
#-----------------------------------------------------------------------
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
|
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
|
|
|
|
${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
|
|
|
OUTPUT_VARIABLE _GXX_VERSION
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
|
|
|
|
_GXX_VERSION_SHORT ${_GXX_VERSION})
|
|
|
|
if(_GXX_VERSION_SHORT EQUAL 33)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n"
|
|
|
|
"Please use GXX 4.2 or greater to build CMake on OpenBSD\n"
|
|
|
|
"${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}")
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
2007-05-11 17:02:17 +04:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
# The main section of the CMakeLists file
|
|
|
|
#
|
|
|
|
#-----------------------------------------------------------------------
|
2013-09-19 23:45:41 +04:00
|
|
|
# Compute CMake_VERSION, etc.
|
|
|
|
include(Source/CMakeVersionCompute.cmake)
|
2003-02-14 05:57:05 +03:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
# Include the standard Dart testing module
|
2012-08-13 21:47:32 +04:00
|
|
|
enable_testing()
|
|
|
|
include (${CMAKE_ROOT}/Modules/Dart.cmake)
|
2007-05-11 17:02:17 +04:00
|
|
|
|
2009-12-10 18:33:42 +03:00
|
|
|
# Set up test-time configuration.
|
2012-08-13 21:47:32 +04:00
|
|
|
set_directory_properties(PROPERTIES
|
2009-12-10 18:33:42 +03:00
|
|
|
TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake")
|
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
# where to write the resulting executables and libraries
|
|
|
|
set(BUILD_SHARED_LIBS OFF)
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.")
|
|
|
|
set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
|
|
|
|
"Where to put the libraries for CMake")
|
2005-03-01 22:21:45 +03:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
# The CMake executables usually do not need any rpath to run in the build or
|
|
|
|
# install tree.
|
|
|
|
set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
|
2006-03-02 03:00:08 +03:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
# Load install destinations.
|
|
|
|
include(Source/CMakeInstallDestinations.cmake)
|
2012-08-13 21:47:32 +04:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(BUILD_TESTING)
|
|
|
|
include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
|
|
|
|
endif()
|
2009-12-10 18:34:36 +03:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
# include special compile flags for some compilers
|
|
|
|
include(CompileFlags.cmake)
|
2003-06-23 16:58:58 +04:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
# no clue why we are testing for this here
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
|
|
|
|
CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
|
|
|
|
endif()
|
2006-03-18 00:14:04 +03:00
|
|
|
|
2010-03-08 20:14:47 +03:00
|
|
|
# CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests.
|
|
|
|
#
|
|
|
|
# If not defined or "", this variable defaults to the server at
|
2014-06-24 21:35:33 +04:00
|
|
|
# "http://open.cdash.org".
|
2010-03-08 20:14:47 +03:00
|
|
|
#
|
|
|
|
# If set explicitly to "NOTFOUND", curl tests and ctest tests that use
|
|
|
|
# the network are skipped.
|
|
|
|
#
|
|
|
|
# If set to something starting with "http://localhost/", the CDash is
|
|
|
|
# expected to be an instance of CDash used for CDash testing, pointing
|
|
|
|
# to a cdash4simpletest database. In these cases, the CDash dashboards
|
|
|
|
# should be run first.
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
|
2014-06-24 21:35:33 +04:00
|
|
|
set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2010-03-08 20:14:47 +03:00
|
|
|
|
2014-07-07 19:23:13 +04:00
|
|
|
# Create the KWIML library for CMake.
|
|
|
|
set(KWIML cmIML)
|
|
|
|
set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
|
|
|
|
add_subdirectory(Utilities/KWIML)
|
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
# build the utilities (a macro defined in this file)
|
|
|
|
CMAKE_BUILD_UTILITIES()
|
2012-08-13 21:47:32 +04:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
# On NetBSD ncurses is required, since curses doesn't have the wsyncup()
|
|
|
|
# function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
|
|
|
|
# which isn't in the default linker search path. So without RPATH ccmake
|
|
|
|
# doesn't run and the build doesn't succeed since ccmake is executed for
|
|
|
|
# generating the documentation.
|
|
|
|
if(BUILD_CursesDialog)
|
|
|
|
get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
|
|
|
|
set(CURSES_NEED_RPATH FALSE)
|
|
|
|
if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
|
|
|
|
set(CURSES_NEED_RPATH TRUE)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(BUILD_QtDialog)
|
|
|
|
if(APPLE)
|
|
|
|
set(CMAKE_BUNDLE_VERSION
|
|
|
|
"${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
|
|
|
|
set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
|
|
|
|
# make sure CMAKE_INSTALL_PREFIX ends in /
|
|
|
|
string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
|
|
|
|
math(EXPR LEN "${LEN} -1" )
|
|
|
|
string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
|
|
|
|
if(NOT "${ENDCH}" STREQUAL "/")
|
|
|
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
|
|
|
|
endif()
|
|
|
|
set(CMAKE_INSTALL_PREFIX
|
|
|
|
"${CMAKE_INSTALL_PREFIX}CMake.app/Contents")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(QT_NEED_RPATH FALSE)
|
|
|
|
if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
|
|
|
|
set(QT_NEED_RPATH TRUE)
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-11-06 02:06:02 +03:00
|
|
|
|
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
# The same might be true on other systems for other libraries.
|
|
|
|
# Then only enable RPATH if we have are building at least with cmake 2.4,
|
|
|
|
# since this one has much better RPATH features than cmake 2.2.
|
|
|
|
# The executables are then built with the RPATH for the libraries outside
|
|
|
|
# the build tree, which is both the build and the install RPATH.
|
|
|
|
if (UNIX)
|
|
|
|
if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB
|
|
|
|
OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH)
|
|
|
|
set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
|
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
|
|
endif()
|
|
|
|
endif ()
|
2007-08-28 19:02:24 +04:00
|
|
|
|
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
# add the uninstall support
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
@ONLY)
|
|
|
|
add_custom_target(uninstall
|
|
|
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
2005-06-28 18:56:29 +04:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
include (CMakeCPack.cmake)
|
|
|
|
|
|
|
|
endif()
|
2006-01-05 17:18:13 +03:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
# setup some Testing support (a macro defined in this file)
|
|
|
|
CMAKE_SETUP_TESTING()
|
2007-02-28 20:25:19 +03:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
if(NOT CMake_VERSION_IS_RELEASE)
|
2014-10-14 18:25:32 +04:00
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
|
2014-03-04 00:24:03 +04:00
|
|
|
NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
|
|
|
|
set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
|
|
|
|
-Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
|
|
|
|
-Wmissing-format-attribute -fno-common -Wundef
|
|
|
|
)
|
|
|
|
set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
|
|
|
|
-Wshadow -Wpointer-arith -Wformat-security -Wundef
|
|
|
|
)
|
|
|
|
|
|
|
|
foreach(FLAG_LANG C CXX)
|
|
|
|
foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
|
|
|
|
if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
|
|
|
|
set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2012-09-23 17:02:23 +04:00
|
|
|
endforeach()
|
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
unset(C_FLAGS_LIST)
|
|
|
|
unset(CXX_FLAGS_LIST)
|
|
|
|
endif()
|
2012-09-23 17:02:23 +04:00
|
|
|
endif()
|
2014-03-04 00:24:03 +04:00
|
|
|
|
|
|
|
# build the remaining subdirectories
|
|
|
|
add_subdirectory(Source)
|
|
|
|
add_subdirectory(Utilities)
|
2012-09-23 17:02:23 +04:00
|
|
|
endif()
|
2007-11-06 22:14:18 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_subdirectory(Tests)
|
2007-02-28 20:25:19 +03:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
|
|
|
|
endif()
|
|
|
|
if(TARGET documentation)
|
|
|
|
CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
|
|
|
|
endif()
|
2013-10-07 22:06:04 +04:00
|
|
|
endif()
|
2010-09-03 21:53:22 +04:00
|
|
|
|
2007-05-11 17:02:17 +04:00
|
|
|
# add a test
|
2012-08-13 21:47:32 +04:00
|
|
|
add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
|
2014-03-03 23:06:34 +04:00
|
|
|
--system-information -G "${CMAKE_GENERATOR}" )
|
2007-02-27 21:04:29 +03:00
|
|
|
|
2014-03-04 00:24:03 +04:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
# Install license file as it requires.
|
|
|
|
install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
|
|
|
|
|
|
|
|
# Install script directories.
|
|
|
|
install(
|
|
|
|
DIRECTORY Help Modules Templates
|
|
|
|
DESTINATION ${CMAKE_DATA_DIR}
|
|
|
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
|
|
DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
|
|
|
|
GROUP_READ GROUP_EXECUTE
|
|
|
|
WORLD_READ WORLD_EXECUTE
|
|
|
|
PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
|
|
|
|
GROUP_READ GROUP_EXECUTE
|
|
|
|
WORLD_READ WORLD_EXECUTE
|
|
|
|
)
|
|
|
|
|
|
|
|
# Install auxiliary files integrating with other tools.
|
|
|
|
add_subdirectory(Auxiliary)
|
|
|
|
endif()
|