├── README.txt ├── ExtProjectUtils.cmake ├── FindStlsoft.cmake ├── FindLint.cmake ├── FindLog4cplus.cmake ├── FindThrift.cmake ├── FindZMQ.cmake ├── FindLibUV.cmake ├── FindPTLib.cmake ├── FindOPAL.cmake ├── FindCppCheck.cmake ├── FindFFmpeg.cmake └── FindBoost.cmake /README.txt: -------------------------------------------------------------------------------- 1 | README 2 | ============================ 3 | 4 | My collection of modules. 5 | Some I've borrowed from OSS community (and modified). 6 | Some I've made by myself. 7 | -------------------------------------------------------------------------------- /ExtProjectUtils.cmake: -------------------------------------------------------------------------------- 1 | include(ExternalProject) 2 | include(CMakeParseArguments) 3 | 4 | # 5 | # Function to inject dependency (download from git repo) 6 | # 7 | # Use as ExternalProjectGit( "" "" "" ) 8 | # where 9 | # - url to repository for ex. https://github.com/log4cplus/log4cplus.git 10 | # project name will be regexed from url as latest part in our case log4cplus.git 11 | # - tag - tag you want to use 12 | # - destination - where to install your binaries, for example ${CMAKE_BINARY_DIR}/3rdparty 13 | # 14 | 15 | function(ExtProjectGit repourl tag destination) 16 | 17 | message(STATUS "Get external project from: ${repourl} : ${tag}") 18 | 19 | string(REGEX MATCH "([^\\/]+)[.]git$" _name ${repourl}) 20 | message(STATUS "_name = ${_name}") 21 | 22 | set(options) 23 | set(oneValueArgs) 24 | set(multiValueArgs CMAKE_ARGS) 25 | cmake_parse_arguments(ExtProjectGit "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) 26 | 27 | set(cmake_cli_args -DCMAKE_INSTALL_PREFIX=${destination} 28 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) 29 | if(CMAKE_TOOLCHAIN_FILE) 30 | get_filename_component(_ft_path ${CMAKE_TOOLCHAIN_FILE} ABSOLUTE) 31 | get_filename_component(_cm_rt_opath ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ABSOLUTE) 32 | set(cmake_cli_args ${cmake_cli_args} 33 | -DCMAKE_TOOLCHAIN_FILE=${_ft_path} 34 | -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${_cm_rt_opath}) 35 | endif() 36 | 37 | foreach(cmake_key ${ExtProjectGit_CMAKE_ARGS}) 38 | set(cmake_cli_args ${cmake_key} ${cmake_cli_args}) 39 | endforeach() 40 | 41 | message(STATUS "ARGS for ExternalProject_Add(${name}): ${cmake_cli_args}") 42 | message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}") 43 | 44 | ExternalProject_Add(${_name} 45 | GIT_REPOSITORY ${repourl} 46 | GIT_TAG ${tag} 47 | CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} ${cmake_cli_args} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} 48 | PREFIX "${destination}" 49 | INSTALL_DIR "${destination}") 50 | endfunction() 51 | -------------------------------------------------------------------------------- /FindStlsoft.cmake: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------------- 2 | # (C) 2009 Sergey Nikulov 3 | # 4 | # Usage as follows: 5 | # - just add FIND_PACKAGE(Stlsoft) in your CMakeLists.txt, then check variables 6 | #---------------------------------------------------------------------------------- 7 | # STLSOFT_FOUND - TRUE/FALSE - Found/not found 8 | # STLSOFT_INCLUDE_DIR - path to include 9 | # STLSOFT_VER_MAJOR 10 | # STLSOFT_VER_MINOR 11 | # STLSOFT_VER_REVISION 12 | #---------------------------------------------------------------------------------- 13 | # TODO: need to implement FIND_PACKAGE(Stlsoft [here required version string]) 14 | #---------------------------------------------------------------------------------- 15 | 16 | set(STLSOFT_FOUND FALSE) 17 | 18 | # try get environment var first... 19 | set(_STLSOFT_ROOT $ENV{STLSOFT}) 20 | 21 | if(_STLSOFT_ROOT) 22 | # add include folder to ENVIRONMENT path... 23 | 24 | file(TO_CMAKE_PATH ${_STLSOFT_ROOT} _STLSOFT_ROOT) 25 | set(STLSOFT_INCLUDE_DIR ${_STLSOFT_ROOT}/include) 26 | 27 | else(_STLSOFT_ROOT) 28 | # try to find in well known for CMake includes 29 | 30 | find_path(STLSOFT_INCLUDE_DIR stlsoft/stlsoft.h) 31 | 32 | endif(_STLSOFT_ROOT) 33 | 34 | if(STLSOFT_INCLUDE_DIR) 35 | file(READ "${STLSOFT_INCLUDE_DIR}/stlsoft/stlsoft.h" _stlsoft_h_CONTENT) 36 | string(REGEX REPLACE ".*#define[ ]+_STLSOFT_VER_MAJOR[ ]+([0-9]+).*" "\\1" STLSOFT_VER_MAJOR "${_stlsoft_h_CONTENT}") 37 | string(REGEX REPLACE ".*#define[ ]+_STLSOFT_VER_MINOR[ ]+([0-9]+).*" "\\1" STLSOFT_VER_MINOR "${_stlsoft_h_CONTENT}") 38 | string(REGEX REPLACE ".*#define[ ]+_STLSOFT_VER_REVISION[ ]+([0-9]+).*" "\\1" STLSOFT_VER_REVISION "${_stlsoft_h_CONTENT}") 39 | 40 | message("Found STLSOFT Ver. ${STLSOFT_VER_MAJOR}.${STLSOFT_VER_MINOR}.${STLSOFT_VER_REVISION} here - ${STLSOFT_INCLUDE_DIR}") 41 | 42 | if(STLSOFT_VER_MAJOR AND STLSOFT_VER_MINOR AND STLSOFT_VER_REVISION) 43 | 44 | set(STLSOFT_FOUND TRUE) 45 | 46 | endif(STLSOFT_VER_MAJOR AND STLSOFT_VER_MINOR AND STLSOFT_VER_REVISION) 47 | 48 | else(STLSOFT_INCLUDE_DIR) 49 | message("No Stlsoft found... Please point us with STLSOFT env var") 50 | endif(STLSOFT_INCLUDE_DIR) 51 | 52 | mark_as_advanced(STLSOFT_INCLUDE_DIR 53 | STLSOFT_VER_MAJOR 54 | STLSOFT_VER_MINOR 55 | STLSOFT_VER_REVISION) 56 | -------------------------------------------------------------------------------- /FindLint.cmake: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------- 2 | # General Description: PC-Lint/Flexelint tool auto configuration 3 | #--------------------------------------------------------------- 4 | 5 | #------------------------------------------ 6 | # Gimpel Flexelint/PC-Lint detection 7 | #------------------------------------------ 8 | 9 | set(LINT_FOUND FALSE) 10 | find_program(LINT_EXECUTABLE_PATH NAMES flint lint-nt flexelint PATHS ${LINT_INSTALL_PATH} ENV PATH) 11 | get_filename_component(LINT_EXECUTABLE ${LINT_EXECUTABLE_PATH} NAME) 12 | 13 | if(LINT_EXECUTABLE) 14 | set(LINT_FOUND TRUE) 15 | set(LINT_DATA_DIR ${GLOBAL_PROJECT_DIR}/lint) 16 | 17 | 18 | macro(lint_check_sources _target_name _sources) 19 | 20 | create_folder_if_not_exist("${LINT_DATA_DIR}/${_target_name}") 21 | 22 | set(LINT_CFG_FILES "lint_cmac.h lint_cppmac.h size-options.lnt gcc-include-path.lnt") 23 | 24 | # message("GCC_BIN=${CMAKE_C_COMPILER}") 25 | # message("GXX_BIN=${CMAKE_CXX_COMPILER}") 26 | # message("CFLAGS=${CMAKE_C_FLAGS_RELEASE}") 27 | # message("CXXFLAGS=${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | add_custom_command( OUTPUT ${LINT_CFG_FILES} 30 | COMMAND "make" GCC_BIN=${CMAKE_C_COMPILER} GXX_BIN=${CMAKE_CXX_COMPILER} CFLAGS=${CMAKE_C_FLAGS_RELEASE} CXXFLAGS=${CMAKE_CXX_FLAGS_RELEASE} 31 | WORKING_DIRECTORY ${LINT_DATA_DIR}) 32 | 33 | 34 | set(LINT_RULES_DIR "-i\"${LINT_DATA_DIR}\"") 35 | 36 | GET_DIRECTORY_PROPERTY(_inc_dirs INCLUDE_DIRECTORIES) 37 | 38 | foreach(_one_inc_dir ${_inc_dirs}) 39 | list(APPEND PROJECT_INCLUDE_DIRS "-i\"${_one_inc_dir}\"") 40 | endforeach(_one_inc_dir) 41 | 42 | set(_all_files_reports) 43 | 44 | foreach(_current_file ${_sources} ${ARGN}) 45 | 46 | get_filename_component(_processed_file_name ${_current_file} NAME) 47 | 48 | set(_report_file_name "${_processed_file_name}.rpt") 49 | set(_report_file_dst ${LINT_DATA_DIR}/${_target_name}/${_report_file_name}) 50 | 51 | ADD_CUSTOM_COMMAND( 52 | OUTPUT ${_report_file_dst} 53 | COMMAND ${LINT_EXECUTABLE} ${LINT_RULES_DIR} co-gcc.lnt project.lnt ${PROJECT_INCLUDE_DIRS} -zero ${_current_file} > ${_report_file_dst} 54 | DEPENDS ${LINT_CFG_FILES} 55 | VERBATIM) 56 | 57 | set(_all_files_reports ${_all_files_reports} ${_report_file_dst}) 58 | 59 | endforeach(_current_file) 60 | 61 | ADD_CUSTOM_TARGET(${_target_name}_lint DEPENDS ${LINT_C_INCLUDE} ${LINT_CXX_INCLUDE} ${LINT_C_INCLUDE_PATH_FILE} ${LINT_CXX_INCLUDE_PATH_FILE} ${LINT_RULES_FILE} ${_all_files_reports}) 62 | 63 | endmacro(lint_check_sources) 64 | 65 | else(LINT_EXECUTABLE) 66 | #empty macro - lint not found 67 | macro(lint_check_sources _target_name _sources) 68 | endmacro(lint_check_sources) 69 | endif(LINT_EXECUTABLE) 70 | 71 | 72 | -------------------------------------------------------------------------------- /FindLog4cplus.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------------- 2 | # Locate Log4cplus library 3 | # This module defines 4 | # LOG4CPLUS_FOUND, if false, do not try to link to Log4cplus 5 | # LOG4CPLUS_LIBRARIES 6 | # LOG4CPLUS_INCLUDE_DIR, where to find log4cplus.hppa 7 | # 8 | # Original script was picked up here 9 | # https://github.com/manvelavetisian/cmake-modules/blob/master/FindLog4cplus.cmake 10 | # 11 | # 2013 - snikulov 12 | # And modified 13 | # Additional params which can be set to search for libs 14 | # Log4Cplus_USE_STATIC_LIBS 15 | # Log4Cplus_USE_UNICODE 16 | # Location hint can be provided through 17 | # environment var LOG4CPLUS_ROOT in addition to LOG4CPLUS_DIR 18 | # cmake vars LOG4CPLUS_DIR & LOG4CPLUS_ROOT 19 | #------------------------------------------------------------------------------------- 20 | find_path(LOG4CPLUS_INCLUDE_DIR 21 | NAMES 22 | logger.h 23 | PATH_PREFIXES 24 | log4cplus 25 | PATHS 26 | /usr/local/include 27 | /usr/include 28 | /opt/local/include 29 | /opt/csw/include 30 | /opt/include 31 | $ENV{LOG4CPLUS_DIR}/include 32 | $ENV{LOG4CPLUS_ROOT}/include 33 | ${LOG4CPLUS_DIR}/include 34 | ${LOG4CPLUS_ROOT}/include 35 | ) 36 | 37 | if(Log4Cplus_USE_STATIC_LIBS) 38 | set(log4cplus_postfix "${log4cplus_postfix}S") 39 | endif() 40 | if(Log4Cplus_USE_UNICODE) 41 | set(log4cplus_postfix "${log4cplus_postfix}U") 42 | endif() 43 | 44 | set(LOG4CPLUS_LIB_NAMES_RELEASE "log4cplus${log4cplus_postfix}") 45 | set(LOG4CPLUS_LIB_NAMES_DEBUG "log4cplus${log4cplus_postfix}D") 46 | 47 | find_library(LOG4CPLUS_LIBRARY_RELEASE 48 | NAMES 49 | ${LOG4CPLUS_LIB_NAMES_RELEASE} 50 | PATHS 51 | /usr/local 52 | /usr 53 | /sw 54 | /opt/local 55 | /opt/csw 56 | /opt 57 | $ENV{LOG4CPLUS_DIR}/lib 58 | $ENV{LOG4CPLUS_ROOT}/lib 59 | ${LOG4CPLUS_DIR}/lib 60 | ${LOG4CPLUS_ROOT}/lib 61 | NO_DEFAULT_PATH 62 | ) 63 | 64 | find_library(LOG4CPLUS_LIBRARY_DEBUG 65 | NAMES 66 | ${LOG4CPLUS_LIB_NAMES_DEBUG} 67 | PATHS 68 | /usr/local 69 | /usr 70 | /sw 71 | /opt/local 72 | /opt/csw 73 | /opt 74 | $ENV{LOG4CPLUS_DIR}/lib 75 | $ENV{LOG4CPLUS_ROOT}/lib 76 | ${LOG4CPLUS_DIR}/lib 77 | ${LOG4CPLUS_ROOT}/lib 78 | NO_DEFAULT_PATH 79 | ) 80 | 81 | if(LOG4CPLUS_LIBRARY_DEBUG AND LOG4CPLUS_LIBRARY_RELEASE) 82 | set(LOG4CPLUS_LIBRARIES debug ${LOG4CPLUS_LIBRARY_DEBUG} optimized ${LOG4CPLUS_LIBRARY_RELEASE} CACHE STRING "Log4cplus Libraries") 83 | endif() 84 | 85 | 86 | include(FindPackageHandleStandardArgs) 87 | 88 | # handle the QUIETLY and REQUIRED arguments and set LOG4CPLUS_FOUND to TRUE if 89 | # all listed variables are TRUE 90 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Log4cplus DEFAULT_MSG LOG4CPLUS_LIBRARIES LOG4CPLUS_INCLUDE_DIR) 91 | 92 | MARK_AS_ADVANCED(LOG4CPLUS_INCLUDE_DIR LOG4CPLUS_LIBRARIES LOG4CPLUS_LIBRARY_DEBUG LOG4CPLUS_LIBRARY_RELEASE) 93 | 94 | -------------------------------------------------------------------------------- /FindThrift.cmake: -------------------------------------------------------------------------------- 1 | # - Find Thrift (a cross platform RPC lib/tool) 2 | # This module defines 3 | # THRIFT_VERSION_STRING, version string of ant if found 4 | # THRIFT_LIBRARIES, libraries to link 5 | # THRIFT_INCLUDE_DIR, where to find THRIFT headers 6 | # THRIFT_COMPILER, thrift compiler executable 7 | # THRIFT_FOUND, If false, do not try to use ant 8 | # Function 9 | # thrift_gen_cpp( ) 10 | # 11 | # Initial work was done by Cloudera https://github.com/cloudera/Impala 12 | # 2014 - modified by snikulov 13 | 14 | # prefer the thrift version supplied in THRIFT_HOME (cmake -DTHRIFT_HOME then environment) 15 | find_path(THRIFT_INCLUDE_DIR 16 | NAMES 17 | thrift/Thrift.h 18 | HINTS 19 | ${THRIFT_HOME} 20 | ENV THRIFT_HOME 21 | /usr/local 22 | /opt/local 23 | PATH_SUFFIXES 24 | include 25 | ) 26 | 27 | # prefer the thrift version supplied in THRIFT_HOME 28 | find_library(THRIFT_LIBRARIES 29 | NAMES 30 | thrift libthrift 31 | HINTS 32 | ${THRIFT_HOME} 33 | ENV THRIFT_HOME 34 | /usr/local 35 | /opt/local 36 | PATH_SUFFIXES 37 | lib lib64 38 | ) 39 | 40 | find_program(THRIFT_COMPILER 41 | NAMES 42 | thrift 43 | HINTS 44 | ${THRIFT_HOME} 45 | ENV THRIFT_HOME 46 | /usr/local 47 | /opt/local 48 | PATH_SUFFIXES 49 | bin bin64 50 | ) 51 | 52 | if (THRIFT_COMPILER) 53 | exec_program(${THRIFT_COMPILER} 54 | ARGS -version OUTPUT_VARIABLE __thrift_OUT RETURN_VALUE THRIFT_RETURN) 55 | string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+-[a-z]+$" THRIFT_VERSION_STRING ${__thrift_OUT}) 56 | 57 | # define utility function to generate cpp files 58 | function(thrift_gen_cpp thrift_file THRIFT_CPP_FILES_LIST THRIFT_GEN_INCLUDE_DIR) 59 | set(_res) 60 | set(_res_inc_path) 61 | if(EXISTS ${thrift_file}) 62 | get_filename_component(_target_dir ${thrift_file} NAME_WE) 63 | message("thrif_gen_cpp: ${thrift_file}") 64 | 65 | if(NOT EXISTS ${CMAKE_BINARY_DIR}/${_target_dir}) 66 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${_target_dir}) 67 | endif() 68 | exec_program(${THRIFT_COMPILER} 69 | ARGS -o "${CMAKE_BINARY_DIR}/${_target_dir}" --gen cpp ${thrift_file} 70 | OUTPUT_VARIABLE __thrift_OUT 71 | RETURN_VALUE THRIFT_RETURN) 72 | file(GLOB_RECURSE __result_src "${CMAKE_BINARY_DIR}/${_target_dir}/*.cpp") 73 | file(GLOB_RECURSE __result_hdr "${CMAKE_BINARY_DIR}/${_target_dir}/*.h") 74 | list(APPEND _res ${__result_src}) 75 | list(APPEND _res ${__result_hdr}) 76 | if(__result_hdr) 77 | list(GET __result_hdr 0 _res_inc_path) 78 | get_filename_component(_res_inc_path ${_res_inc_path} DIRECTORY) 79 | endif() 80 | else() 81 | message("thrift_gen_cpp: file ${thrift_file} does not exists") 82 | endif() 83 | set(${THRIFT_CPP_FILES_LIST} "${_res}" PARENT_SCOPE) 84 | set(${THRIFT_GEN_INCLUDE_DIR} "${_res_inc_path}" PARENT_SCOPE) 85 | endfunction() 86 | endif () 87 | 88 | 89 | include(FindPackageHandleStandardArgs) 90 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(THRIFT DEFAULT_MSG THRIFT_LIBRARIES THRIFT_INCLUDE_DIR THRIFT_COMPILER) 91 | mark_as_advanced(THRIFT_LIBRARIES THRIFT_INCLUDE_DIR THRIFT_COMPILER THRIFT_VERSION_STRING) 92 | -------------------------------------------------------------------------------- /FindZMQ.cmake: -------------------------------------------------------------------------------- 1 | #----------------------------------- 2 | # 3 | #----------------------------------- 4 | find_package(PkgConfig QUIET) 5 | PKG_CHECK_MODULES(PC_LIBZMQ QUIET libzmq) 6 | set(LIBZMQ_DEFINITIONS ${PC_LIBZMQ_CFLAGS_OTHER}) 7 | 8 | find_path(LIBZMQ_INCLUDE_DIR NAMES zmq.h zmq_utils.h 9 | HINTS 10 | ${PC_LIBZMQ_INCLUDEDIR} 11 | ${PC_LIBZMQ_INCLUDE_DIRS} 12 | ${ZMQ_HOME}/include 13 | ${LIBZMQ_HOME}/include 14 | ) 15 | 16 | if(PC_LIBZMQ_VERSION) 17 | set(LIBZMQ_VERSION_STRING ${PC_LIBZMQ_VERSION}) 18 | elseif(LIBZMQ_INCLUDE_DIR AND EXISTS "${LIBZMQ_INCLUDE_DIR}/zmq.h") 19 | file(STRINGS "${LIBZMQ_INCLUDE_DIR}/zmq.h" libzmq_ver REGEX "^#define[\t ]+ZMQ_VERSION_") 20 | string(REGEX REPLACE ".*#define[\t ]+ZMQ_VERSION_MAJOR[\t ]+([0-9]+).*" "\\1" LIBZMQ_VERSION_MAJOR "${libzmq_ver}") 21 | string(REGEX REPLACE ".*#define[\t ]+ZMQ_VERSION_MINOR[\t ]+([0-9]+).*" "\\1" LIBZMQ_VERSION_MINOR "${libzmq_ver}") 22 | string(REGEX REPLACE ".*#define[\t ]+ZMQ_VERSION_PATCH[\t ]+([0-9]+).*" "\\1" LIBZMQ_VERSION_PATCH "${libzmq_ver}") 23 | set(LIBZMQ_VERSION_STRING "${LIBZMQ_VERSION_MAJOR}.${LIBZMQ_VERSION_MINOR}.${LIBZMQ_VERSION_PATCH}") 24 | 25 | endif() 26 | 27 | if(WIN32) 28 | if (MSVC12) 29 | set(_tgt_COMPILER "-v120") 30 | elseif (MSVC11) 31 | set(_tgt_COMPILER "-v110") 32 | elseif (MSVC10) 33 | set(_tgt_COMPILER "-v100") 34 | elseif (MSVC90) 35 | set(_tgt_COMPILER "-v90") 36 | elseif (MSVC80) 37 | set(_tgt_COMPILER "-v80") 38 | elseif (MSVC71) 39 | set(_tgt_COMPILER "-v71") 40 | elseif (MSVC70) 41 | set(_tgt_COMPILER "-v7") 42 | elseif (MSVC60) 43 | set(_tgt_COMPILER "-v6") 44 | endif() 45 | 46 | set(_lzmq_rel zmq${_tgt_COMPILER}-mt-${LIBZMQ_VERSION_MAJOR}_${LIBZMQ_VERSION_MINOR}_${LIBZMQ_VERSION_PATCH} 47 | ) 48 | set(_lzmq_deb zmq${_tgt_COMPILER}-mt-gd-${LIBZMQ_VERSION_MAJOR}_${LIBZMQ_VERSION_MINOR}_${LIBZMQ_VERSION_PATCH} 49 | ) 50 | find_library(LIBZMQ_LIBRARY_RELEASE NAMES ${_lzmq_rel} lib${_lzmq_rel} 51 | HINTS 52 | ${ZMQ_HOME}/lib 53 | ${LIBZMQ_HOME}/lib 54 | ) 55 | 56 | find_library(LIBZMQ_LIBRARY_DEBUG NAMES ${_lzmq_deb} lib${_lzmq_deb} 57 | HINTS 58 | ${ZMQ_HOME}/lib 59 | ${LIBZMQ_HOME}/lib 60 | ) 61 | if(LIBZMQ_CMAKE_DEBUG) 62 | message("LIBZMQ_LIBRARY_RELEASE = ${LIBZMQ_LIBRARY_RELEASE}") 63 | message("LIBZMQ_LIBRARY_DEBUG = ${LIBZMQ_LIBRARY_DEBUG}") 64 | endif() 65 | 66 | if(LIBZMQ_LIBRARY_DEBUG AND LIBZMQ_LIBRARY_RELEASE) 67 | set(LIBZMQ_LIBRARIES debug ${LIBZMQ_LIBRARY_DEBUG} optimized ${LIBZMQ_LIBRARY_RELEASE}) 68 | endif() 69 | 70 | 71 | else() 72 | 73 | find_library(LIBZMQ_LIBRARIES NAMES libzmq 74 | HINTS 75 | ${PC_LIBZMQ_LIBDIR} 76 | ${PC_LIBZMQ_LIBRARY_DIRS} 77 | ${ZMQ_HOME}/lib 78 | ${LIBZMQ_HOME}/lib 79 | ) 80 | endif() 81 | 82 | if(LIBZMQ_CMAKE_DEBUG) 83 | message("LIBZMQ_INCLUDE_DIR = ${LIBZMQ_INCLUDE_DIR}") 84 | message("LIBZMQ_LIBRARIES = ${LIBZMQ_LIBRARIES}") 85 | endif() 86 | 87 | 88 | # handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if 89 | # all listed variables are TRUE 90 | include(FindPackageHandleStandardArgs) 91 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBZMQ DEFAULT_MSG LIBZMQ_LIBRARIES LIBZMQ_INCLUDE_DIR) 92 | mark_as_advanced(LIBZMQ_LIBRARIES LIBZMQ_INCLUDE_DIR LIBZMQ_VERSION_STRING) 93 | 94 | 95 | -------------------------------------------------------------------------------- /FindLibUV.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #[=======================================================================[.rst: 5 | FindLibUV 6 | --------- 7 | 8 | Find libuv includes and library. 9 | 10 | Imported Targets 11 | ^^^^^^^^^^^^^^^^ 12 | 13 | An :ref:`imported target ` named 14 | ``LibUV::LibUV`` is provided if libuv has been found. 15 | 16 | Result Variables 17 | ^^^^^^^^^^^^^^^^ 18 | 19 | This module defines the following variables: 20 | 21 | ``LibUV_FOUND`` 22 | True if libuv was found, false otherwise. 23 | ``LibUV_INCLUDE_DIRS`` 24 | Include directories needed to include libuv headers. 25 | ``LibUV_LIBRARIES`` 26 | Libraries needed to link to libuv. 27 | ``LibUV_VERSION`` 28 | The version of libuv found. 29 | ``LibUV_VERSION_MAJOR`` 30 | The major version of libuv. 31 | ``LibUV_VERSION_MINOR`` 32 | The minor version of libuv. 33 | ``LibUV_VERSION_PATCH`` 34 | The patch version of libuv. 35 | 36 | Cache Variables 37 | ^^^^^^^^^^^^^^^ 38 | 39 | This module uses the following cache variables: 40 | 41 | ``LibUV_LIBRARY`` 42 | The location of the libuv library file. 43 | ``LibUV_INCLUDE_DIR`` 44 | The location of the libuv include directory containing ``uv.h``. 45 | 46 | The cache variables should not be used by project code. 47 | They may be set by end users to point at libuv components. 48 | #]=======================================================================] 49 | 50 | #----------------------------------------------------------------------------- 51 | find_library(LibUV_LIBRARY 52 | NAMES uv libuv 53 | ) 54 | mark_as_advanced(LibUV_LIBRARY) 55 | 56 | find_path(LibUV_INCLUDE_DIR 57 | NAMES uv.h 58 | ) 59 | mark_as_advanced(LibUV_INCLUDE_DIR) 60 | 61 | #----------------------------------------------------------------------------- 62 | # Extract version number if possible. 63 | set(_LibUV_H_REGEX "#[ \t]*define[ \t]+UV_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+") 64 | if(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv-version.h") 65 | file(STRINGS "${LibUV_INCLUDE_DIR}/uv-version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") 66 | elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv.h") 67 | file(STRINGS "${LibUV_INCLUDE_DIR}/uv.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") 68 | else() 69 | set(_LibUV_H "") 70 | endif() 71 | foreach(c MAJOR MINOR PATCH) 72 | if(_LibUV_H MATCHES "#[ \t]*define[ \t]+UV_VERSION_${c}[ \t]+([0-9]+)") 73 | set(_LibUV_VERSION_${c} "${CMAKE_MATCH_1}") 74 | else() 75 | unset(_LibUV_VERSION_${c}) 76 | endif() 77 | endforeach() 78 | if(DEFINED _LibUV_VERSION_MAJOR AND DEFINED _LibUV_VERSION_MINOR) 79 | set(LibUV_VERSION_MAJOR "${_LibUV_VERSION_MAJOR}") 80 | set(LibUV_VERSION_MINOR "${_LibUV_VERSION_MINOR}") 81 | set(LibUV_VERSION "${LibUV_VERSION_MAJOR}.${LibUV_VERSION_MINOR}") 82 | if(DEFINED _LibUV_VERSION_PATCH) 83 | set(LibUV_VERSION_PATCH "${_LibUV_VERSION_PATCH}") 84 | set(LibUV_VERSION "${LibUV_VERSION}.${LibUV_VERSION_PATCH}") 85 | else() 86 | unset(LibUV_VERSION_PATCH) 87 | endif() 88 | else() 89 | set(LibUV_VERSION_MAJOR "") 90 | set(LibUV_VERSION_MINOR "") 91 | set(LibUV_VERSION_PATCH "") 92 | set(LibUV_VERSION "") 93 | endif() 94 | unset(_LibUV_VERSION_MAJOR) 95 | unset(_LibUV_VERSION_MINOR) 96 | unset(_LibUV_VERSION_PATCH) 97 | unset(_LibUV_H_REGEX) 98 | unset(_LibUV_H) 99 | 100 | #----------------------------------------------------------------------------- 101 | include(FindPackageHandleStandardArgs) 102 | 103 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUV 104 | FOUND_VAR LibUV_FOUND 105 | REQUIRED_VARS LibUV_LIBRARY LibUV_INCLUDE_DIR 106 | VERSION_VAR LibUV_VERSION 107 | ) 108 | set(LIBUV_FOUND ${LibUV_FOUND}) 109 | 110 | #----------------------------------------------------------------------------- 111 | # Provide documented result variables and targets. 112 | if(LibUV_FOUND) 113 | set(LibUV_INCLUDE_DIRS ${LibUV_INCLUDE_DIR}) 114 | set(LibUV_LIBRARIES ${LibUV_LIBRARY}) 115 | if(NOT TARGET LibUV::LibUV) 116 | add_library(LibUV::LibUV UNKNOWN IMPORTED) 117 | set_target_properties(LibUV::LibUV PROPERTIES 118 | IMPORTED_LOCATION "${LibUV_LIBRARY}" 119 | INTERFACE_INCLUDE_DIRECTORIES "${LibUV_INCLUDE_DIRS}" 120 | ) 121 | endif() 122 | endif() 123 | -------------------------------------------------------------------------------- /FindPTLib.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------------- 2 | # Locate PTLib library (http://www.opalvoip.org/) 3 | # This module defines 4 | # PTLIB_FOUND, if false, do not try to link to PTLib 5 | # PTLIB_LIBRARIES 6 | # PTLIB_INCLUDE_DIRS, where to find ptlib headers 7 | # 8 | # 2013/03/19 - aagenosov 9 | # Module created 10 | # 2013/03/21 - aagenosov 11 | # Added macro to define version of PTLib 12 | ## 2015/08/13 - snikulov 13 | # Added linux support 14 | #------------------------------------------------------------------------------------- 15 | 16 | # get version macro 17 | # first param - path to include 18 | macro(ptlib_get_version _include_PATH version) 19 | if(EXISTS "${_include_PATH}/ptbuildopts.h") 20 | file(STRINGS "${_include_PATH}/ptbuildopts.h" _VER_STRING_AUX REGEX ".*#define[ ]+PTLIB_VERSION[ ]+") 21 | else() 22 | file(STRINGS "${_include_PATH}/ptlib_config.h" _VER_STRING_AUX REGEX ".*#define[ ]+PTLIB_VERSION[ ]+") 23 | endif() 24 | string(REGEX MATCHALL "[0-9]+[.][0-9]+[.][0-9]+" ${version} "${_VER_STRING_AUX}") 25 | endmacro() 26 | 27 | include(FindPkgConfig) 28 | PKG_CHECK_MODULES(PC_PTLIB "ptlib") 29 | 30 | find_path(PTLIB_INCLUDE_DIRS ptlib.h 31 | PATHS 32 | ${PC_PTLIB_INCLUDE_DIRS} 33 | /usr/local/include 34 | /usr/include 35 | /opt/local/include 36 | /opt/csw/include 37 | /opt/include 38 | $ENV{PTLIB_DIR}/include 39 | ${PTLIB_DIR}/include 40 | ) 41 | 42 | if(PC_PTLIB_FOUND) 43 | 44 | set(PTLIB_VERSION ${PC_PTLIB_VERSION}) 45 | set(PTLIB_INCULDE_DIRS ${PC_PTLIB_INCLUDE_DIRS}) 46 | 47 | find_library(PTLIB_LIBRARIES 48 | NAMES ${PC_PTLIB_LIBRARIES} 49 | PATH ${PC_PTLIB_LIBRARY_DIRS}) 50 | 51 | else() 52 | 53 | if(PTLib_USE_STATIC_LIBS) 54 | set(ptlib_postfix "${ptlib_postfix}S") 55 | endif() 56 | 57 | set(PTLIB_NAME_RELEASE "ptlib${ptlib_postfix}") 58 | set(PTLIB_NAME_DEBUG "ptlib${ptlib_postfix}D") 59 | set(PTLIB64_NAME_RELEASE "ptlib64${ptlib_postfix}") 60 | set(PTLIB64_NAME_DEBUG "ptlib64${ptlib_postfix}D") 61 | 62 | 63 | find_library(PTLIB_LIBRARY_RELEASE 64 | NAMES 65 | ${PTLIB_NAME_RELEASE} 66 | ${PTLIB64_NAME_RELEASE} 67 | PATHS 68 | /usr/local 69 | /usr 70 | /sw 71 | /opt/local 72 | /opt/csw 73 | /opt 74 | $ENV{PTLIB_DIR}/lib 75 | ${PTLIB_DIR}/lib 76 | NO_DEFAULT_PATH 77 | ) 78 | 79 | find_library(PTLIB_LIBRARY_DEBUG 80 | NAMES 81 | ${PTLIB_NAME_DEBUG} 82 | ${PTLIB64_NAME_DEBUG} 83 | PATHS 84 | /usr/local 85 | /usr 86 | /sw 87 | /opt/local 88 | /opt/csw 89 | /opt 90 | $ENV{PTLIB_DIR}/lib 91 | ${PTLIB_DIR}/lib 92 | NO_DEFAULT_PATH 93 | ) 94 | 95 | if(PTLIB_INCLUDE_DIRS) 96 | ptlib_get_version(${PTLIB_INCLUDE_DIRS} PTLIB_VERSION) 97 | endif() 98 | 99 | if(PTLIB_LIBRARY_DEBUG AND PTLIB_LIBRARY_RELEASE) 100 | set(PTLIB_LIBRARIES 101 | debug ${PTLIB_LIBRARY_DEBUG} 102 | optimized ${PTLIB_LIBRARY_RELEASE} 103 | CACHE STRING "PTLib Libraries") 104 | endif() 105 | endif() 106 | 107 | include(FindPackageHandleStandardArgs) 108 | 109 | # handle the QUIETLY and REQUIRED arguments and set PTLIB_FOUND to TRUE if 110 | # all listed variables are TRUE 111 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(PTLib DEFAULT_MSG PTLIB_LIBRARIES PTLIB_INCLUDE_DIRS) 112 | 113 | MARK_AS_ADVANCED(PTLIB_INCLUDE_DIRS PTLIB_LIBRARIES 114 | PTLIB_LIBRARY_DEBUG PTLIB_LIBRARY_RELEASE PTLIB_VERSION) 115 | 116 | if(PTLIB_FOUND) 117 | message("-- PTLib version is: ${PTLIB_VERSION}") 118 | 119 | # if we found the ptlib - and using dll's 120 | # short hack for install and copy 121 | if(NOT PTLib_USE_STATIC_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Windows") 122 | find_file(PTLIB_DLL_RELEASE 123 | NAMES 124 | ${PTLIB_NAME_RELEASE}.dll ${PTLIB64_NAME_RELEASE}.dll 125 | PATHS 126 | $ENV{PTLIB_DIR}/bin 127 | ${PTLIB_DIR}/bin 128 | NO_DEFAULT_PATH 129 | ) 130 | 131 | find_file(PTLIB_DLL_DEBUG 132 | NAMES 133 | ${PTLIB_NAME_DEBUG}.dll ${PTLIB64_NAME_DEBUG}.dll 134 | PATHS 135 | $ENV{PTLIB_DIR}/bin 136 | ${PTLIB_DIR}/bin 137 | NO_DEFAULT_PATH 138 | ) 139 | get_filename_component(PTLIB_RUNTIME_DIR ${PTLIB_DLL_DEBUG} PATH) 140 | MARK_AS_ADVANCED(PTLIB_DLL_DEBUG PTLIB_DLL_RELEASE) 141 | endif() 142 | 143 | endif() 144 | 145 | -------------------------------------------------------------------------------- /FindOPAL.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------------ 2 | # Locate OPAL library (http://www.opalvoip.org/) 3 | # This module defines 4 | # OPAL_FOUND, if false, do not try to link to OPAL 5 | # OPAL_LIBRARIES 6 | # OPAL_INCLUDE_DIRS, where to find opal headers 7 | # 8 | # 2013/03/19 - aagenosov 9 | # Module created 10 | # 2013/03/21 - aagenosov 11 | # Added macro to define version of OPAL 12 | # 2015/08/13 - snikulov 13 | # Added linux support 14 | #------------------------------------------------------------------------------------- 15 | 16 | # get version macro 17 | # first param - path to include 18 | macro(opal_get_version _include_PATH version) 19 | if (EXISTS "${_include_PATH}/opal/buildopts.h") 20 | file(STRINGS "${_include_PATH}/opal/buildopts.h" _VER_STRING_AUX REGEX ".*#define[ ]+OPAL_VERSION[ ]+") 21 | else() 22 | file(STRINGS "${_include_PATH}/opal_config.h" _VER_STRING_AUX REGEX ".*#define[ ]+OPAL_VERSION[ ]+") 23 | endif() 24 | string(REGEX MATCHALL "[0-9]+[.][0-9]+[.][0-9]+" ${version} "${_VER_STRING_AUX}") 25 | endmacro() 26 | 27 | find_package(PTLib REQUIRED) 28 | 29 | include(FindPkgConfig) 30 | PKG_CHECK_MODULES(PC_OPAL "opal") 31 | 32 | find_path(OPAL_INCLUDE_DIRS opal.h 33 | PATHS 34 | ${PC_OPAL_INCLUDE_DIRS} 35 | /usr/local/include 36 | /usr/include 37 | /opt/local/include 38 | /opt/csw/include 39 | /opt/include 40 | $ENV{OPAL_DIR}/include 41 | ${OPAL_DIR}/include 42 | ) 43 | 44 | if(PC_OPAL_FOUND) 45 | 46 | set(OPAL_VERSION ${PC_OPAL_VERSION}) 47 | set(OPAL_INCLUDE_DIRS ${PC_OPAL_INCLUDE_DIRS}) 48 | 49 | find_library(OPAL_LIBRARIES 50 | NAMES ${PC_OPAL_LIBRARIES} 51 | PATH ${PC_OPAL_LIBRARY_DIRS}) 52 | 53 | else() 54 | 55 | if(OPAL_USE_STATIC_LIBS) 56 | set(opal_postfix "${opal_postfix}S") 57 | endif() 58 | 59 | set(OPAL_NAME_RELEASE "opal${opal_postfix}") 60 | set(OPAL_NAME_DEBUG "opal${opal_postfix}D") 61 | set(OPAL64_NAME_RELEASE "opal64${opal_postfix}") 62 | set(OPAL64_NAME_DEBUG "opal64${opal_postfix}D") 63 | 64 | 65 | find_library(OPAL_LIBRARY_RELEASE 66 | NAMES 67 | ${OPAL_NAME_RELEASE} 68 | ${OPAL64_NAME_RELEASE} 69 | PATHS 70 | /usr/local 71 | /usr 72 | /sw 73 | /opt/local 74 | /opt/csw 75 | /opt 76 | $ENV{OPAL_DIR}/lib 77 | ${OPAL_DIR}/lib 78 | NO_DEFAULT_PATH 79 | ) 80 | 81 | find_library(OPAL_LIBRARY_DEBUG 82 | NAMES 83 | ${OPAL_NAME_DEBUG} 84 | ${OPAL64_NAME_DEBUG} 85 | PATHS 86 | /usr/local 87 | /usr 88 | /sw 89 | /opt/local 90 | /opt/csw 91 | /opt 92 | $ENV{OPAL_DIR}/lib 93 | ${OPAL_DIR}/lib 94 | NO_DEFAULT_PATH 95 | ) 96 | 97 | if(OPAL_INCLUDE_DIRS) 98 | opal_get_version(${OPAL_INCLUDE_DIRS} OPAL_VERSION) 99 | endif() 100 | 101 | if(OPAL_LIBRARY_DEBUG AND OPAL_LIBRARY_RELEASE) 102 | set(OPAL_LIBRARIES 103 | debug ${OPAL_LIBRARY_DEBUG} 104 | optimized ${OPAL_LIBRARY_RELEASE} 105 | CACHE STRING "OPAL Libraries") 106 | endif() 107 | endif() 108 | 109 | include(FindPackageHandleStandardArgs) 110 | 111 | # handle the QUIETLY and REQUIRED arguments and set OPAL_FOUND to TRUE if 112 | # all listed variables are TRUE 113 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPAL DEFAULT_MSG OPAL_LIBRARIES OPAL_INCLUDE_DIRS) 114 | 115 | MARK_AS_ADVANCED(OPAL_INCLUDE_DIRS OPAL_LIBRARIES 116 | OPAL_LIBRARY_DEBUG OPAL_LIBRARY_RELEASE) 117 | 118 | if(OPAL_FOUND) 119 | message("-- OPAL version is: ${OPAL_VERSION}") 120 | # short hack for install and copy 121 | if(NOT OPAL_USE_STATIC_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Windows") 122 | find_file(OPAL_DLL_RELEASE 123 | NAMES 124 | ${OPAL_NAME_RELEASE}.dll ${OPAL64_NAME_RELEASE}.dll 125 | PATHS 126 | $ENV{OPAL_DIR}/bin 127 | ${OPAL_DIR}/bin 128 | NO_DEFAULT_PATH 129 | ) 130 | 131 | find_file(OPAL_DLL_DEBUG 132 | NAMES 133 | ${OPAL_NAME_DEBUG}.dll ${OPAL64_NAME_DEBUG}.dll 134 | PATHS 135 | $ENV{OPAL_DIR}/bin 136 | ${OPAL_DIR}/bin 137 | NO_DEFAULT_PATH 138 | ) 139 | get_filename_component(OPAL_RUNTIME_DIR ${OPAL_DLL_DEBUG} PATH) 140 | MARK_AS_ADVANCED(OPAL_DLL_DEBUG OPAL_DLL_RELEASE OPAL_RUNTIME_DIR) 141 | endif() 142 | 143 | if(CMAKE_SYSTEM_NAME STREQUAL "Windows") 144 | set(PATH_TO_OPAL_PLUGINS ${OPAL_RUNTIME_DIR}/plugins) 145 | 146 | if (EXISTS ${PATH_TO_OPAL_PLUGINS} AND IS_DIRECTORY ${PATH_TO_OPAL_PLUGINS}) 147 | file(GLOB _opal_plugins_ "${PATH_TO_OPAL_PLUGINS}/*.dll") 148 | endif() 149 | 150 | set(OPAL_PLUGINS) 151 | foreach(_plugin ${_opal_plugins_}) 152 | list(APPEND OPAL_PLUGINS ${_plugin}) 153 | endforeach() 154 | message("-- OPAL plugins: ${OPAL_PLUGINS}") 155 | MARK_AS_ADVANCED(PATH_TO_OPAL_PLUGINS OPAL_PLUGINS) 156 | endif() 157 | endif() 158 | 159 | -------------------------------------------------------------------------------- /FindCppCheck.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # FindCppCheck.cmake 3 | # 4 | # This file is based on following work https://cmake.org/Wiki/PC-Lint 5 | # 6 | # (C) 2015 by Sergei Nikulov 7 | 8 | # 9 | # Variables defined: 10 | # CPPCHECK_FOUND - ON/OFF - found/not found 11 | # CPPCHECK_EXECUTABLE - path to cppcheck if found 12 | # 13 | # Function defined: 14 | # add_cppcheck() target to check with cppcheck 15 | # this function will define build target named _CPPCHECK, 16 | # to run static analysis agains source files from target. 17 | # 18 | 19 | set(WHINTS 20 | "$ENV{ProgramFiles}/Cppcheck" 21 | "$ENV{ProgramW6432}/Cppcheck" 22 | ) 23 | 24 | find_program(CPPCHECK_EXECUTABLE NAMES cppcheck 25 | HINTS ${WHINTS} ENV PATH 26 | PATHS ${WHINTS} ENV PATH 27 | DOC "Path to cppcheck executable") 28 | 29 | mark_as_advanced(CPPCHECK_EXECUTABLE) 30 | 31 | if(CPPCHECK_EXECUTABLE) 32 | # get version string 33 | execute_process(COMMAND ${CPPCHECK_EXECUTABLE} --version 34 | OUTPUT_VARIABLE _cc_version_output 35 | ERROR_VARIABLE _cc_version_error 36 | RESULT_VARIABLE _cc_version_result 37 | OUTPUT_STRIP_TRAILING_WHITESPACE) 38 | 39 | if(NOT ${_cc_version_result} EQUAL 0) 40 | message(SEND_ERROR "command \"${CPPCHECK_EXECUTABLE} --version\" failed - ${_cc_version_error}") 41 | else() 42 | string(REGEX MATCH "[.0-9]+" 43 | CPPCHECK_VERSION "${_cc_version_output}") 44 | endif() 45 | endif() 46 | 47 | include(FindPackageHandleStandardArgs) 48 | find_package_handle_standard_args(CPPCHECK 49 | REQUIRED_VARS CPPCHECK_EXECUTABLE 50 | VERSION_VAR CPPCHECK_VERSION) 51 | mark_as_advanced(CPPCHECK_VERSION) 52 | 53 | if(CPPCHECK_FOUND) 54 | 55 | message(STATUS "Enabled static analysis with Cppcheck...") 56 | 57 | add_custom_target(ALL_CPPCHECK) 58 | 59 | #detect platform flag 60 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 61 | set(_platform_bits "64") 62 | else() 63 | if(WIN32) 64 | set(_platform_bits "32A") 65 | else() 66 | set(_platform_bits "32") 67 | endif() 68 | endif() 69 | 70 | set(_cc_platform "native") 71 | if(WIN32) 72 | 73 | list(APPEND PROJECT_COMMON_DEFS "_WIN32") 74 | list(APPEND PROJECT_COMMON_DEFS "WIN32") 75 | list(APPEND PROJECT_COMMON_DEFS "_WINDOWS") 76 | 77 | set(_cc_platform "win${_platform_bits}") 78 | elseif(UNIX) 79 | set(_cc_platform "unix${_platform_bits}") 80 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 81 | list(APPEND PROJECT_COMMON_DEFS "__x86_64__") 82 | else() 83 | list(APPEND PROJECT_COMMON_DEFS "__i386__") 84 | endif() 85 | endif() 86 | 87 | 88 | function(add_cppcheck _target_name) 89 | get_target_property(_cc_includes ${_target_name} INCLUDE_DIRECTORIES) 90 | # get_target_property(_cc_includes ${_target_name} CXX_INCLUDE_WHAT_YOU_USE) 91 | # get_target_property(_cc_defines ${_target_name} COMPILE_DEFINITIONS) 92 | get_target_property(_cc_sources ${_target_name} SOURCES) 93 | get_directory_property(_cc_defines COMPILE_DEFINITIONS) 94 | 95 | if(PROJECT_COMMON_DEFS) 96 | list(APPEND _cc_defines ${PROJECT_COMMON_DEFS}) 97 | endif() 98 | 99 | list(SORT _cc_includes) 100 | list(REMOVE_DUPLICATES _cc_includes) 101 | if(CPPCHECK_DEBUG) 102 | message(STATUS "_cc_includes = ${_cc_includes}") 103 | message(STATUS "_cc_defines = ${_cc_defines}") 104 | message(STATUS "_cc_sources = ${_cc_sources}") 105 | endif() 106 | set(_cc_inc_transformed) 107 | foreach(_inc_dir ${_cc_includes}) 108 | list(APPEND _cc_inc_transformed "-I\"${_inc_dir}\"") 109 | endforeach() 110 | 111 | set(_cc_def_transformed) 112 | foreach(_one_def ${_cc_defines}) 113 | list(APPEND _cc_def_transformed -D${_one_def}) 114 | endforeach() 115 | if(CPPCHECK_DEBUG) 116 | message(STATUS "_cc_inc_transformed = ${_cc_inc_transformed}") 117 | message(STATUS "_cc_def_transformed = ${_cc_def_transformed}") 118 | message(STATUS "CMAKE_SYSTEM_INCLUDE_PATH = ${CMAKE_SYSTEM_INCLUDE_PATH}") 119 | message(STATUS "CMAKE_INCLUDE_PATH = ${CMAKE_INCLUDE_PATH}") 120 | endif() 121 | set(_all_rpts) 122 | foreach(sourcefile ${_cc_sources}) 123 | if(sourcefile MATCHES \\.c$|\\.cxx$|\\.cpp$|\\.cc$) 124 | get_filename_component(_src_abs ${sourcefile} ABSOLUTE) 125 | get_filename_component(_src_name ${sourcefile} NAME) 126 | 127 | # message(STATUS "_src_abs = ${_src_abs}") 128 | # message(STATUS "_src_name = ${_src_name}") 129 | 130 | set(_rpt_file_name "${_src_name}.rpt") 131 | set(_rpt_path "${CMAKE_CURRENT_SOURCE_DIR}/cppcheck/reports/${_target_name}") 132 | set(_rpt_dst "${_rpt_path}/${_rpt_file_name}") 133 | 134 | file(MAKE_DIRECTORY ${_rpt_path}) 135 | 136 | add_custom_command(OUTPUT ${_rpt_dst} 137 | COMMAND 138 | ${CPPCHECK_EXECUTABLE} --enable=all --inconclusive --platform=${_cc_platform} ${_cc_inc_transformed} ${_cc_def_transformed} ${_src_abs} > ${_rpt_dst} 2>&1 139 | VERBATIM 140 | ) 141 | list(APPEND _all_rpts ${_rpt_dst}) 142 | else() 143 | endif() 144 | endforeach() 145 | add_custom_target(${_target_name}_CPPCHECK DEPENDS ${_all_rpts}) 146 | add_dependencies(ALL_CPPCHECK ${_target_name}_CPPCHECK) 147 | 148 | endfunction() 149 | 150 | else() 151 | 152 | message(STATUS "Cppcheck not found... Static analysis is disabled") 153 | function(add_cppcheck _target_name) 154 | #empty macro 155 | endfunction() 156 | endif() 157 | -------------------------------------------------------------------------------- /FindFFmpeg.cmake: -------------------------------------------------------------------------------- 1 | # vim: ts=2 sw=2 2 | # - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC) 3 | # 4 | # Once done this will define 5 | # FFMPEG_FOUND - System has the all required components. 6 | # FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers. 7 | # FFMPEG_LIBRARIES - Link these to use the required ffmpeg components. 8 | # FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components. 9 | # 10 | # For each of the components it will additionally set. 11 | # - AVCODEC 12 | # - AVDEVICE 13 | # - AVFORMAT 14 | # - AVFILTER 15 | # - AVUTIL 16 | # - POSTPROC 17 | # - SWSCALE 18 | # the following variables will be defined 19 | # _FOUND - System has 20 | # _INCLUDE_DIRS - Include directory necessary for using the headers 21 | # _LIBRARIES - Link these to use 22 | # _DEFINITIONS - Compiler switches required for using 23 | # _VERSION - The components version 24 | # 25 | # Copyright (c) 2006, Matthias Kretz, 26 | # Copyright (c) 2008, Alexander Neundorf, 27 | # Copyright (c) 2011, Michael Jansen, 28 | # 29 | # Redistribution and use is allowed according to the terms of the BSD license. 30 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 31 | 32 | include(FindPackageHandleStandardArgs) 33 | 34 | # The default components were taken from a survey over other FindFFMPEG.cmake files 35 | if (NOT FFmpeg_FIND_COMPONENTS) 36 | set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL) 37 | endif () 38 | 39 | # 40 | ### Macro: set_component_found 41 | # 42 | # Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present. 43 | # 44 | macro(set_component_found _component ) 45 | if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) 46 | # message(STATUS " - ${_component} found.") 47 | set(${_component}_FOUND TRUE) 48 | else () 49 | # message(STATUS " - ${_component} not found.") 50 | endif () 51 | endmacro() 52 | 53 | # 54 | ### Macro: find_component 55 | # 56 | # Checks for the given component by invoking pkgconfig and then looking up the libraries and 57 | # include directories. 58 | # 59 | macro(find_component _component _pkgconfig _library _header) 60 | 61 | if (NOT WIN32) 62 | # use pkg-config to get the directories and then use these values 63 | # in the FIND_PATH() and FIND_LIBRARY() calls 64 | find_package(PkgConfig) 65 | if (PKG_CONFIG_FOUND) 66 | pkg_check_modules(PC_${_component} ${_pkgconfig}) 67 | endif () 68 | endif (NOT WIN32) 69 | 70 | find_path(${_component}_INCLUDE_DIRS ${_header} 71 | HINTS 72 | ${PC_${_component}_INCLUDEDIR} 73 | ${PC_${_component}_INCLUDE_DIRS} 74 | PATH_SUFFIXES 75 | ffmpeg 76 | ) 77 | 78 | find_library(${_component}_LIBRARIES NAMES ${_library} 79 | HINTS 80 | ${PC_${_component}_LIBDIR} 81 | ${PC_${_component}_LIBRARY_DIRS} 82 | ) 83 | 84 | set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.") 85 | set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.") 86 | 87 | set_component_found(${_component}) 88 | 89 | mark_as_advanced( 90 | ${_component}_INCLUDE_DIRS 91 | ${_component}_LIBRARIES 92 | ${_component}_DEFINITIONS 93 | ${_component}_VERSION) 94 | 95 | endmacro() 96 | 97 | 98 | # Check for cached results. If there are skip the costly part. 99 | if (NOT FFMPEG_LIBRARIES) 100 | 101 | # Check for all possible component. 102 | find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) 103 | find_component(AVFORMAT libavformat avformat libavformat/avformat.h) 104 | find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) 105 | find_component(AVUTIL libavutil avutil libavutil/avutil.h) 106 | find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) 107 | find_component(SWSCALE libswscale swscale libswscale/swscale.h) 108 | find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) 109 | find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) 110 | 111 | # Check if the required components were found and add their stuff to the FFMPEG_* vars. 112 | foreach (_component ${FFmpeg_FIND_COMPONENTS}) 113 | if (${_component}_FOUND) 114 | # message(STATUS "Required component ${_component} present.") 115 | set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES}) 116 | set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS}) 117 | list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS}) 118 | else () 119 | # message(STATUS "Required component ${_component} missing.") 120 | endif () 121 | endforeach () 122 | 123 | # Build the include path with duplicates removed. 124 | if (FFMPEG_INCLUDE_DIRS) 125 | list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) 126 | endif () 127 | 128 | # cache the vars. 129 | set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE) 130 | set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE) 131 | set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE) 132 | 133 | mark_as_advanced(FFMPEG_INCLUDE_DIRS 134 | FFMPEG_LIBRARIES 135 | FFMPEG_DEFINITIONS) 136 | 137 | endif () 138 | 139 | # Now set the noncached _FOUND vars for the components. 140 | foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE) 141 | set_component_found(${_component}) 142 | endforeach () 143 | 144 | # Compile the list of required vars 145 | set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) 146 | foreach (_component ${FFmpeg_FIND_COMPONENTS}) 147 | list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS) 148 | endforeach () 149 | 150 | # Give a nice error message if some of the required vars are missing. 151 | find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS}) 152 | -------------------------------------------------------------------------------- /FindBoost.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #.rst: 5 | # FindBoost 6 | # --------- 7 | # 8 | # Find Boost include dirs and libraries 9 | # 10 | # Use this module by invoking find_package with the form:: 11 | # 12 | # find_package(Boost 13 | # [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 14 | # [REQUIRED] # Fail with error if Boost is not found 15 | # [COMPONENTS ...] # Boost libraries by their canonical name 16 | # ) # e.g. "date_time" for "libboost_date_time" 17 | # 18 | # This module finds headers and requested component libraries OR a CMake 19 | # package configuration file provided by a "Boost CMake" build. For the 20 | # latter case skip to the "Boost CMake" section below. For the former 21 | # case results are reported in variables:: 22 | # 23 | # Boost_FOUND - True if headers and requested libraries were found 24 | # Boost_INCLUDE_DIRS - Boost include directories 25 | # Boost_LIBRARY_DIRS - Link directories for Boost libraries 26 | # Boost_LIBRARIES - Boost component libraries to be linked 27 | # Boost__FOUND - True if component was found ( is upper-case) 28 | # Boost__LIBRARY - Libraries to link for component (may include 29 | # target_link_libraries debug/optimized keywords) 30 | # Boost_VERSION - BOOST_VERSION value from boost/version.hpp 31 | # Boost_LIB_VERSION - Version string appended to library filenames 32 | # Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) 33 | # Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) 34 | # Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) 35 | # Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) 36 | # - Pass to add_definitions() to have diagnostic 37 | # information about Boost's automatic linking 38 | # displayed during compilation 39 | # 40 | # This module reads hints about search locations from variables:: 41 | # 42 | # BOOST_ROOT - Preferred installation prefix 43 | # (or BOOSTROOT) 44 | # BOOST_INCLUDEDIR - Preferred include directory e.g. /include 45 | # BOOST_LIBRARYDIR - Preferred library directory e.g. /lib 46 | # Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not 47 | # specified by these hint variables. Default is OFF. 48 | # Boost_ADDITIONAL_VERSIONS 49 | # - List of Boost versions not known to this module 50 | # (Boost install locations may contain the version) 51 | # 52 | # and saves search results persistently in CMake cache entries:: 53 | # 54 | # Boost_INCLUDE_DIR - Directory containing Boost headers 55 | # Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries 56 | # Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries 57 | # Boost__LIBRARY_DEBUG - Component library debug variant 58 | # Boost__LIBRARY_RELEASE - Component library release variant 59 | # 60 | # The following :prop_tgt:`IMPORTED` targets are also defined:: 61 | # 62 | # Boost::boost - Target for header-only dependencies 63 | # (Boost include directory) 64 | # Boost:: - Target for specific component dependency 65 | # (shared or static library); is lower- 66 | # case 67 | # Boost::diagnostic_definitions - interface target to enable diagnostic 68 | # information about Boost's automatic linking 69 | # during compilation (adds BOOST_LIB_DIAGNOSTIC) 70 | # Boost::disable_autolinking - interface target to disable automatic 71 | # linking with MSVC (adds BOOST_ALL_NO_LIB) 72 | # Boost::dynamic_linking - interface target to enable dynamic linking 73 | # linking with MSVC (adds BOOST_ALL_DYN_LINK) 74 | # 75 | # Implicit dependencies such as Boost::filesystem requiring 76 | # Boost::system will be automatically detected and satisfied, even 77 | # if system is not specified when using find_package and if 78 | # Boost::system is not added to target_link_libraries. If using 79 | # Boost::thread, then Threads::Threads will also be added automatically. 80 | # 81 | # It is important to note that the imported targets behave differently 82 | # than variables created by this module: multiple calls to 83 | # find_package(Boost) in the same directory or sub-directories with 84 | # different options (e.g. static or shared) will not override the 85 | # values of the targets created by the first call. 86 | # 87 | # Users may set these hints or results as cache entries. Projects 88 | # should not read these entries directly but instead use the above 89 | # result variables. Note that some hint names start in upper-case 90 | # "BOOST". One may specify these as environment variables if they are 91 | # not specified as CMake variables or cache entries. 92 | # 93 | # This module first searches for the Boost header files using the above 94 | # hint variables (excluding BOOST_LIBRARYDIR) and saves the result in 95 | # Boost_INCLUDE_DIR. Then it searches for requested component libraries 96 | # using the above hints (excluding BOOST_INCLUDEDIR and 97 | # Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR, 98 | # and the library name configuration settings below. It saves the 99 | # library directories in Boost_LIBRARY_DIR_DEBUG and 100 | # Boost_LIBRARY_DIR_RELEASE and individual library 101 | # locations in Boost__LIBRARY_DEBUG and Boost__LIBRARY_RELEASE. 102 | # When one changes settings used by previous searches in the same build 103 | # tree (excluding environment variables) this module discards previous 104 | # search results affected by the changes and searches again. 105 | # 106 | # Boost libraries come in many variants encoded in their file name. 107 | # Users or projects may tell this module which variant to find by 108 | # setting variables:: 109 | # 110 | # Boost_USE_DEBUG_LIBS - Set to ON or OFF to specify whether to search 111 | # and use the debug libraries. Default is ON. 112 | # Boost_USE_RELEASE_LIBS - Set to ON or OFF to specify whether to search 113 | # and use the release libraries. Default is ON. 114 | # Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded 115 | # libraries ('mt' tag). Default is ON. 116 | # Boost_USE_STATIC_LIBS - Set to ON to force the use of the static 117 | # libraries. Default is OFF. 118 | # Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use 119 | # libraries linked statically to the C++ runtime 120 | # ('s' tag). Default is platform dependent. 121 | # Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use 122 | # libraries linked to the MS debug C++ runtime 123 | # ('g' tag). Default is ON. 124 | # Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a 125 | # debug Python build ('y' tag). Default is OFF. 126 | # Boost_USE_STLPORT - Set to ON to use libraries compiled with 127 | # STLPort ('p' tag). Default is OFF. 128 | # Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS 129 | # - Set to ON to use libraries compiled with 130 | # STLPort deprecated "native iostreams" 131 | # ('n' tag). Default is OFF. 132 | # Boost_COMPILER - Set to the compiler-specific library suffix 133 | # (e.g. "-gcc43"). Default is auto-computed 134 | # for the C++ compiler in use. A list may be 135 | # used if multiple compatible suffixes should 136 | # be tested for, in decreasing order of 137 | # preference. 138 | # Boost_THREADAPI - Suffix for "thread" component library name, 139 | # such as "pthread" or "win32". Names with 140 | # and without this suffix will both be tried. 141 | # Boost_NAMESPACE - Alternate namespace used to build boost with 142 | # e.g. if set to "myboost", will search for 143 | # myboost_thread instead of boost_thread. 144 | # 145 | # Other variables one may set to control this module are:: 146 | # 147 | # Boost_DEBUG - Set to ON to enable debug output from FindBoost. 148 | # Please enable this before filing any bug report. 149 | # Boost_DETAILED_FAILURE_MSG 150 | # - Set to ON to add detailed information to the 151 | # failure message even when the REQUIRED option 152 | # is not given to the find_package call. 153 | # Boost_REALPATH - Set to ON to resolve symlinks for discovered 154 | # libraries to assist with packaging. For example, 155 | # the "system" component library may be resolved to 156 | # "/usr/lib/libboost_system.so.1.42.0" instead of 157 | # "/usr/lib/libboost_system.so". This does not 158 | # affect linking and should not be enabled unless 159 | # the user needs this information. 160 | # Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and 161 | # Boost_LIBRARY_DIR_DEBUG. 162 | # 163 | # On Visual Studio and Borland compilers Boost headers request automatic 164 | # linking to corresponding libraries. This requires matching libraries 165 | # to be linked explicitly or available in the link library search path. 166 | # In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve 167 | # dynamic linking. Boost automatic linking typically requests static 168 | # libraries with a few exceptions (such as Boost.Python). Use:: 169 | # 170 | # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) 171 | # 172 | # to ask Boost to report information about automatic linking requests. 173 | # 174 | # Example to find Boost headers only:: 175 | # 176 | # find_package(Boost 1.36.0) 177 | # if(Boost_FOUND) 178 | # include_directories(${Boost_INCLUDE_DIRS}) 179 | # add_executable(foo foo.cc) 180 | # endif() 181 | # 182 | # Example to find Boost libraries and use imported targets:: 183 | # 184 | # find_package(Boost 1.56 REQUIRED COMPONENTS 185 | # date_time filesystem iostreams) 186 | # add_executable(foo foo.cc) 187 | # target_link_libraries(foo Boost::date_time Boost::filesystem 188 | # Boost::iostreams) 189 | # 190 | # Example to find Boost headers and some *static* (release only) libraries:: 191 | # 192 | # set(Boost_USE_STATIC_LIBS ON) # only find static libs 193 | # set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and 194 | # set(Boost_USE_RELEASE_LIBS ON) # only find release libs 195 | # set(Boost_USE_MULTITHREADED ON) 196 | # set(Boost_USE_STATIC_RUNTIME OFF) 197 | # find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) 198 | # if(Boost_FOUND) 199 | # include_directories(${Boost_INCLUDE_DIRS}) 200 | # add_executable(foo foo.cc) 201 | # target_link_libraries(foo ${Boost_LIBRARIES}) 202 | # endif() 203 | # 204 | # Boost CMake 205 | # ^^^^^^^^^^^ 206 | # 207 | # If Boost was built using the boost-cmake project it provides a package 208 | # configuration file for use with find_package's Config mode. This 209 | # module looks for the package configuration file called 210 | # BoostConfig.cmake or boost-config.cmake and stores the result in cache 211 | # entry "Boost_DIR". If found, the package configuration file is loaded 212 | # and this module returns with no further action. See documentation of 213 | # the Boost CMake package configuration for details on what it provides. 214 | # 215 | # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. 216 | 217 | # Save project's policies 218 | cmake_policy(PUSH) 219 | cmake_policy(SET CMP0057 NEW) # if IN_LIST 220 | 221 | #------------------------------------------------------------------------------- 222 | # Before we go searching, check whether boost-cmake is available, unless the 223 | # user specifically asked NOT to search for boost-cmake. 224 | # 225 | # If Boost_DIR is set, this behaves as any find_package call would. If not, 226 | # it looks at BOOST_ROOT and BOOSTROOT to find Boost. 227 | # 228 | if (NOT Boost_NO_BOOST_CMAKE) 229 | # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives, 230 | # since these are more conventional for Boost. 231 | if ("$ENV{Boost_DIR}" STREQUAL "") 232 | if (NOT "$ENV{BOOST_ROOT}" STREQUAL "") 233 | set(ENV{Boost_DIR} $ENV{BOOST_ROOT}) 234 | elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "") 235 | set(ENV{Boost_DIR} $ENV{BOOSTROOT}) 236 | endif() 237 | endif() 238 | 239 | # Do the same find_package call but look specifically for the CMake version. 240 | # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no 241 | # need to delegate them to this find_package call. 242 | find_package(Boost QUIET NO_MODULE) 243 | mark_as_advanced(Boost_DIR) 244 | 245 | # If we found boost-cmake, then we're done. Print out what we found. 246 | # Otherwise let the rest of the module try to find it. 247 | if (Boost_FOUND) 248 | message(STATUS "Boost ${Boost_FIND_VERSION} found.") 249 | if (Boost_FIND_COMPONENTS) 250 | message(STATUS "Found Boost components:\n ${Boost_FIND_COMPONENTS}") 251 | endif() 252 | # Restore project's policies 253 | cmake_policy(POP) 254 | return() 255 | endif() 256 | endif() 257 | 258 | 259 | #------------------------------------------------------------------------------- 260 | # FindBoost functions & macros 261 | # 262 | 263 | ############################################ 264 | # 265 | # Check the existence of the libraries. 266 | # 267 | ############################################ 268 | # This macro was taken directly from the FindQt4.cmake file that is included 269 | # with the CMake distribution. This is NOT my work. All work was done by the 270 | # original authors of the FindQt4.cmake file. Only minor modifications were 271 | # made to remove references to Qt and make this file more generally applicable 272 | # And ELSE/ENDIF pairs were removed for readability. 273 | ######################################################################### 274 | 275 | macro(_Boost_ADJUST_LIB_VARS basename) 276 | if(Boost_INCLUDE_DIR ) 277 | if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) 278 | # if the generator supports configuration types then set 279 | # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value 280 | if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) 281 | set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) 282 | else() 283 | # if there are no configuration types and CMAKE_BUILD_TYPE has no value 284 | # then just use the release libraries 285 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) 286 | endif() 287 | # FIXME: This probably should be set for both cases 288 | set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) 289 | endif() 290 | 291 | # if only the release version was found, set the debug variable also to the release version 292 | if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) 293 | set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) 294 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) 295 | set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) 296 | endif() 297 | 298 | # if only the debug version was found, set the release variable also to the debug version 299 | if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) 300 | set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) 301 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) 302 | set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) 303 | endif() 304 | 305 | # If the debug & release library ends up being the same, omit the keywords 306 | if("${Boost_${basename}_LIBRARY_RELEASE}" STREQUAL "${Boost_${basename}_LIBRARY_DEBUG}") 307 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) 308 | set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} ) 309 | endif() 310 | 311 | if(Boost_${basename}_LIBRARY AND Boost_${basename}_HEADER) 312 | set(Boost_${basename}_FOUND ON) 313 | if("x${basename}" STREQUAL "xTHREAD" AND NOT TARGET Threads::Threads) 314 | string(APPEND Boost_ERROR_REASON_THREAD " (missing dependency: Threads)") 315 | set(Boost_THREAD_FOUND OFF) 316 | endif() 317 | endif() 318 | 319 | endif() 320 | # Make variables changeable to the advanced user 321 | mark_as_advanced( 322 | Boost_${basename}_LIBRARY_RELEASE 323 | Boost_${basename}_LIBRARY_DEBUG 324 | ) 325 | endmacro() 326 | 327 | # Detect changes in used variables. 328 | # Compares the current variable value with the last one. 329 | # In short form: 330 | # v != v_LAST -> CHANGED = 1 331 | # v is defined, v_LAST not -> CHANGED = 1 332 | # v is not defined, but v_LAST is -> CHANGED = 1 333 | # otherwise -> CHANGED = 0 334 | # CHANGED is returned in variable named ${changed_var} 335 | macro(_Boost_CHANGE_DETECT changed_var) 336 | set(${changed_var} 0) 337 | foreach(v ${ARGN}) 338 | if(DEFINED _Boost_COMPONENTS_SEARCHED) 339 | if(${v}) 340 | if(_${v}_LAST) 341 | string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED) 342 | else() 343 | set(_${v}_CHANGED 1) 344 | endif() 345 | elseif(_${v}_LAST) 346 | set(_${v}_CHANGED 1) 347 | endif() 348 | if(_${v}_CHANGED) 349 | set(${changed_var} 1) 350 | endif() 351 | else() 352 | set(_${v}_CHANGED 0) 353 | endif() 354 | endforeach() 355 | endmacro() 356 | 357 | # 358 | # Find the given library (var). 359 | # Use 'build_type' to support different lib paths for RELEASE or DEBUG builds 360 | # 361 | macro(_Boost_FIND_LIBRARY var build_type) 362 | 363 | find_library(${var} ${ARGN}) 364 | 365 | if(${var}) 366 | # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. 367 | if(NOT Boost_LIBRARY_DIR_${build_type}) 368 | get_filename_component(_dir "${${var}}" PATH) 369 | set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE) 370 | endif() 371 | elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) 372 | # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. 373 | find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN}) 374 | endif() 375 | 376 | # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there. 377 | if(Boost_LIBRARY_DIR_${build_type}) 378 | set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) 379 | if(Boost_DEBUG) 380 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 381 | " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}" 382 | " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}") 383 | endif() 384 | endif() 385 | endmacro() 386 | 387 | #------------------------------------------------------------------------------- 388 | 389 | # 390 | # Runs compiler with "-dumpversion" and parses major/minor 391 | # version with a regex. 392 | # 393 | function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) 394 | 395 | exec_program(${CMAKE_CXX_COMPILER} 396 | ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion 397 | OUTPUT_VARIABLE _boost_COMPILER_VERSION 398 | ) 399 | string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" 400 | _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) 401 | 402 | set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) 403 | endfunction() 404 | 405 | # 406 | # Take a list of libraries with "thread" in it 407 | # and prepend duplicates with "thread_${Boost_THREADAPI}" 408 | # at the front of the list 409 | # 410 | function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) 411 | set(_orig_libnames ${ARGN}) 412 | string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}") 413 | set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) 414 | endfunction() 415 | 416 | # 417 | # If a library is found, replace its cache entry with its REALPATH 418 | # 419 | function(_Boost_SWAP_WITH_REALPATH _library _docstring) 420 | if(${_library}) 421 | get_filename_component(_boost_filepathreal ${${_library}} REALPATH) 422 | unset(${_library} CACHE) 423 | set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") 424 | endif() 425 | endfunction() 426 | 427 | function(_Boost_CHECK_SPELLING _var) 428 | if(${_var}) 429 | string(TOUPPER ${_var} _var_UC) 430 | message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.") 431 | endif() 432 | endfunction() 433 | 434 | # Guesses Boost's compiler prefix used in built library names 435 | # Returns the guess by setting the variable pointed to by _ret 436 | function(_Boost_GUESS_COMPILER_PREFIX _ret) 437 | if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" 438 | OR CMAKE_CXX_COMPILER MATCHES "icl" 439 | OR CMAKE_CXX_COMPILER MATCHES "icpc") 440 | if(WIN32) 441 | set (_boost_COMPILER "-iw") 442 | else() 443 | set (_boost_COMPILER "-il") 444 | endif() 445 | elseif (GHSMULTI) 446 | set(_boost_COMPILER "-ghs") 447 | elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") 448 | if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) 449 | set(_boost_COMPILER "-vc141;-vc140") 450 | elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) 451 | set(_boost_COMPILER "-vc140") 452 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) 453 | set(_boost_COMPILER "-vc120") 454 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) 455 | set(_boost_COMPILER "-vc110") 456 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) 457 | set(_boost_COMPILER "-vc100") 458 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) 459 | set(_boost_COMPILER "-vc90") 460 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) 461 | set(_boost_COMPILER "-vc80") 462 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10) 463 | set(_boost_COMPILER "-vc71") 464 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck! 465 | set(_boost_COMPILER "-vc7") # yes, this is correct 466 | else() # VS 6.0 Good luck! 467 | set(_boost_COMPILER "-vc6") # yes, this is correct 468 | endif() 469 | elseif (BORLAND) 470 | set(_boost_COMPILER "-bcb") 471 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") 472 | set(_boost_COMPILER "-sw") 473 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "XL") 474 | set(_boost_COMPILER "-xlc") 475 | elseif (MINGW) 476 | if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) 477 | set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 478 | else() 479 | _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) 480 | set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") 481 | endif() 482 | elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") 483 | string(REPLACE "." "" _clang_VER_STR "${CMAKE_CXX_COMPILER_VERSION}") 484 | string(SUBSTRING "${_clang_VER_STR}" 0 2 _boost_COMPILER_VERSION) 485 | set(_boost_COMPILER "-clang${_boost_COMPILER_VERSION}") 486 | elseif (UNIX) 487 | if (CMAKE_COMPILER_IS_GNUCXX) 488 | if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) 489 | set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 490 | else() 491 | _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) 492 | # Determine which version of GCC we have. 493 | if(APPLE) 494 | if(Boost_MINOR_VERSION) 495 | if(${Boost_MINOR_VERSION} GREATER 35) 496 | # In Boost 1.36.0 and newer, the mangled compiler name used 497 | # on Mac OS X/Darwin is "xgcc". 498 | set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") 499 | else() 500 | # In Boost <= 1.35.0, there is no mangled compiler name for 501 | # the Mac OS X/Darwin version of GCC. 502 | set(_boost_COMPILER "") 503 | endif() 504 | else() 505 | # We don't know the Boost version, so assume it's 506 | # pre-1.36.0. 507 | set(_boost_COMPILER "") 508 | endif() 509 | else() 510 | set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") 511 | endif() 512 | endif() 513 | endif () 514 | else() 515 | # TODO at least Boost_DEBUG here? 516 | set(_boost_COMPILER "") 517 | endif() 518 | set(${_ret} ${_boost_COMPILER} PARENT_SCOPE) 519 | endfunction() 520 | 521 | # 522 | # Get component dependencies. Requires the dependencies to have been 523 | # defined for the Boost release version. 524 | # 525 | # component - the component to check 526 | # _ret - list of library dependencies 527 | # 528 | function(_Boost_COMPONENT_DEPENDENCIES component _ret) 529 | # Note: to add a new Boost release, run 530 | # 531 | # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake 532 | # 533 | # The output may be added in a new block below. If it's the same as 534 | # the previous release, simply update the version range of the block 535 | # for the previous release. Also check if any new components have 536 | # been added, and add any new components to 537 | # _Boost_COMPONENT_HEADERS. 538 | # 539 | # This information was originally generated by running 540 | # BoostScanDeps.cmake against every boost release to date supported 541 | # by FindBoost: 542 | # 543 | # % for version in /path/to/boost/sources/* 544 | # do 545 | # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake 546 | # done 547 | # 548 | # The output was then updated by search and replace with these regexes: 549 | # 550 | # - Strip message(STATUS) prefix dashes 551 | # s;^-- ;; 552 | # - Indent 553 | # s;^set(; set(;; 554 | # - Add conditionals 555 | # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx); 556 | # 557 | # This results in the logic seen below, but will require the xxxx 558 | # replacing with the following Boost release version (or the next 559 | # minor version to be released, e.g. 1.59 was the latest at the time 560 | # of writing, making 1.60 the next, so 106000 is the needed version 561 | # number). Identical consecutive releases were then merged together 562 | # by updating the end range of the first block and removing the 563 | # following redundant blocks. 564 | # 565 | # Running the script against all historical releases should be 566 | # required only if the BoostScanDeps.cmake script logic is changed. 567 | # The addition of a new release should only require it to be run 568 | # against the new release. 569 | set(_Boost_IMPORTED_TARGETS TRUE) 570 | if(Boost_VERSION VERSION_LESS 103300) 571 | message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)") 572 | set(_Boost_IMPORTED_TARGETS FALSE) 573 | elseif(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500) 574 | set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) 575 | set(_Boost_REGEX_DEPENDENCIES thread) 576 | set(_Boost_WAVE_DEPENDENCIES filesystem thread) 577 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 578 | elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600) 579 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 580 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 581 | set(_Boost_MPI_DEPENDENCIES serialization) 582 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 583 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread) 584 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 585 | elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800) 586 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 587 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 588 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) 589 | set(_Boost_MPI_DEPENDENCIES serialization) 590 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 591 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread) 592 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 593 | elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300) 594 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 595 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 596 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) 597 | set(_Boost_MPI_DEPENDENCIES serialization) 598 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 599 | set(_Boost_THREAD_DEPENDENCIES date_time) 600 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) 601 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 602 | elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400) 603 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 604 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 605 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) 606 | set(_Boost_MPI_DEPENDENCIES serialization) 607 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 608 | set(_Boost_THREAD_DEPENDENCIES date_time) 609 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) 610 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 611 | elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500) 612 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 613 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 614 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) 615 | set(_Boost_MPI_DEPENDENCIES serialization) 616 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 617 | set(_Boost_THREAD_DEPENDENCIES date_time) 618 | set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) 619 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 620 | elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700) 621 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 622 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 623 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) 624 | set(_Boost_MPI_DEPENDENCIES serialization) 625 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 626 | set(_Boost_THREAD_DEPENDENCIES date_time) 627 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) 628 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 629 | elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800) 630 | set(_Boost_CHRONO_DEPENDENCIES system) 631 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 632 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 633 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) 634 | set(_Boost_MPI_DEPENDENCIES serialization) 635 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 636 | set(_Boost_THREAD_DEPENDENCIES date_time) 637 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) 638 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 639 | elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000) 640 | set(_Boost_CHRONO_DEPENDENCIES system) 641 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 642 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 643 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) 644 | set(_Boost_MPI_DEPENDENCIES serialization) 645 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 646 | set(_Boost_THREAD_DEPENDENCIES date_time) 647 | set(_Boost_TIMER_DEPENDENCIES chrono system) 648 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) 649 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 650 | elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300) 651 | set(_Boost_CHRONO_DEPENDENCIES system) 652 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 653 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 654 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) 655 | set(_Boost_MPI_DEPENDENCIES serialization) 656 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 657 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time) 658 | set(_Boost_TIMER_DEPENDENCIES chrono system) 659 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) 660 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 661 | elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400) 662 | set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) 663 | set(_Boost_CHRONO_DEPENDENCIES system) 664 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 665 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 666 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) 667 | set(_Boost_MPI_DEPENDENCIES serialization) 668 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 669 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 670 | set(_Boost_TIMER_DEPENDENCIES chrono system) 671 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) 672 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 673 | elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500) 674 | set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) 675 | set(_Boost_CHRONO_DEPENDENCIES system) 676 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 677 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 678 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) 679 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) 680 | set(_Boost_MPI_DEPENDENCIES serialization) 681 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 682 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 683 | set(_Boost_TIMER_DEPENDENCIES chrono system) 684 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 685 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 686 | elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600) 687 | set(_Boost_CHRONO_DEPENDENCIES system) 688 | set(_Boost_COROUTINE_DEPENDENCIES context system) 689 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 690 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 691 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) 692 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) 693 | set(_Boost_MPI_DEPENDENCIES serialization) 694 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 695 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 696 | set(_Boost_TIMER_DEPENDENCIES chrono system) 697 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 698 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 699 | elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900) 700 | set(_Boost_CHRONO_DEPENDENCIES system) 701 | set(_Boost_COROUTINE_DEPENDENCIES context system) 702 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 703 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 704 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) 705 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) 706 | set(_Boost_MPI_DEPENDENCIES serialization) 707 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 708 | set(_Boost_RANDOM_DEPENDENCIES system) 709 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 710 | set(_Boost_TIMER_DEPENDENCIES chrono system) 711 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 712 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 713 | elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000) 714 | set(_Boost_CHRONO_DEPENDENCIES system) 715 | set(_Boost_COROUTINE_DEPENDENCIES context system) 716 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 717 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 718 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) 719 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) 720 | set(_Boost_MPI_DEPENDENCIES serialization) 721 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 722 | set(_Boost_RANDOM_DEPENDENCIES system) 723 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 724 | set(_Boost_TIMER_DEPENDENCIES chrono system) 725 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 726 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 727 | elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100) 728 | set(_Boost_CHRONO_DEPENDENCIES system) 729 | set(_Boost_COROUTINE_DEPENDENCIES context system) 730 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 731 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 732 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) 733 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) 734 | set(_Boost_MPI_DEPENDENCIES serialization) 735 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 736 | set(_Boost_RANDOM_DEPENDENCIES system) 737 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 738 | set(_Boost_TIMER_DEPENDENCIES chrono system) 739 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 740 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 741 | elseif(NOT Boost_VERSION VERSION_LESS 106100 AND Boost_VERSION VERSION_LESS 106200) 742 | set(_Boost_CHRONO_DEPENDENCIES system) 743 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) 744 | set(_Boost_COROUTINE_DEPENDENCIES context system) 745 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 746 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 747 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) 748 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) 749 | set(_Boost_MPI_DEPENDENCIES serialization) 750 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 751 | set(_Boost_RANDOM_DEPENDENCIES system) 752 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 753 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 754 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 755 | elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106300) 756 | set(_Boost_CHRONO_DEPENDENCIES system) 757 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) 758 | set(_Boost_COROUTINE_DEPENDENCIES context system) 759 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) 760 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 761 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 762 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) 763 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) 764 | set(_Boost_MPI_DEPENDENCIES serialization) 765 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 766 | set(_Boost_RANDOM_DEPENDENCIES system) 767 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 768 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 769 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 770 | elseif(NOT Boost_VERSION VERSION_LESS 106300 AND Boost_VERSION VERSION_LESS 106500) 771 | set(_Boost_CHRONO_DEPENDENCIES system) 772 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) 773 | set(_Boost_COROUTINE_DEPENDENCIES context system) 774 | set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time) 775 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) 776 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 777 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 778 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) 779 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) 780 | set(_Boost_MPI_DEPENDENCIES serialization) 781 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 782 | set(_Boost_RANDOM_DEPENDENCIES system) 783 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 784 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 785 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 786 | else() 787 | if(NOT Boost_VERSION VERSION_LESS 106500) 788 | set(_Boost_CHRONO_DEPENDENCIES system) 789 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) 790 | set(_Boost_COROUTINE_DEPENDENCIES context system) 791 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) 792 | set(_Boost_FILESYSTEM_DEPENDENCIES system) 793 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) 794 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) 795 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) 796 | set(_Boost_MPI_DEPENDENCIES serialization) 797 | set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) 798 | set(_Boost_NUMPY_DEPENDENCIES python) 799 | set(_Boost_RANDOM_DEPENDENCIES system) 800 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) 801 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) 802 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) 803 | endif() 804 | if(NOT Boost_VERSION VERSION_LESS 106600) 805 | message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") 806 | set(_Boost_IMPORTED_TARGETS FALSE) 807 | endif() 808 | endif() 809 | 810 | string(TOUPPER ${component} uppercomponent) 811 | set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) 812 | set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) 813 | 814 | string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}") 815 | if (NOT _boost_DEPS_STRING) 816 | set(_boost_DEPS_STRING "(none)") 817 | endif() 818 | # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") 819 | endfunction() 820 | 821 | # 822 | # Get component headers. This is the primary header (or headers) for 823 | # a given component, and is used to check that the headers are present 824 | # as well as the library itself as an extra sanity check of the build 825 | # environment. 826 | # 827 | # component - the component to check 828 | # _hdrs 829 | # 830 | function(_Boost_COMPONENT_HEADERS component _hdrs) 831 | # Note: new boost components will require adding here. The header 832 | # must be present in all versions of Boost providing a library. 833 | set(_Boost_ATOMIC_HEADERS "boost/atomic.hpp") 834 | set(_Boost_CHRONO_HEADERS "boost/chrono.hpp") 835 | set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp") 836 | set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp") 837 | set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") 838 | set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp") 839 | set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") 840 | set(_Boost_FIBER_HEADERS "boost/fiber/all.hpp") 841 | set(_Boost_FILESYSTEM_HEADERS "boost/filesystem/path.hpp") 842 | set(_Boost_GRAPH_HEADERS "boost/graph/adjacency_list.hpp") 843 | set(_Boost_GRAPH_PARALLEL_HEADERS "boost/graph/adjacency_list.hpp") 844 | set(_Boost_IOSTREAMS_HEADERS "boost/iostreams/stream.hpp") 845 | set(_Boost_LOCALE_HEADERS "boost/locale.hpp") 846 | set(_Boost_LOG_HEADERS "boost/log/core.hpp") 847 | set(_Boost_LOG_SETUP_HEADERS "boost/log/detail/setup_config.hpp") 848 | set(_Boost_MATH_HEADERS "boost/math_fwd.hpp") 849 | set(_Boost_MATH_C99_HEADERS "boost/math/tr1.hpp") 850 | set(_Boost_MATH_C99F_HEADERS "boost/math/tr1.hpp") 851 | set(_Boost_MATH_C99L_HEADERS "boost/math/tr1.hpp") 852 | set(_Boost_MATH_TR1_HEADERS "boost/math/tr1.hpp") 853 | set(_Boost_MATH_TR1F_HEADERS "boost/math/tr1.hpp") 854 | set(_Boost_MATH_TR1L_HEADERS "boost/math/tr1.hpp") 855 | set(_Boost_MPI_HEADERS "boost/mpi.hpp") 856 | set(_Boost_MPI_PYTHON_HEADERS "boost/mpi/python/config.hpp") 857 | set(_Boost_NUMPY_HEADERS "boost/python/numpy.hpp") 858 | set(_Boost_PRG_EXEC_MONITOR_HEADERS "boost/test/prg_exec_monitor.hpp") 859 | set(_Boost_PROGRAM_OPTIONS_HEADERS "boost/program_options.hpp") 860 | set(_Boost_PYTHON_HEADERS "boost/python.hpp") 861 | set(_Boost_RANDOM_HEADERS "boost/random.hpp") 862 | set(_Boost_REGEX_HEADERS "boost/regex.hpp") 863 | set(_Boost_SERIALIZATION_HEADERS "boost/serialization/serialization.hpp") 864 | set(_Boost_SIGNALS_HEADERS "boost/signals.hpp") 865 | set(_Boost_SYSTEM_HEADERS "boost/system/config.hpp") 866 | set(_Boost_TEST_EXEC_MONITOR_HEADERS "boost/test/test_exec_monitor.hpp") 867 | set(_Boost_THREAD_HEADERS "boost/thread.hpp") 868 | set(_Boost_TIMER_HEADERS "boost/timer.hpp") 869 | set(_Boost_TYPE_ERASURE_HEADERS "boost/type_erasure/config.hpp") 870 | set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp") 871 | set(_Boost_WAVE_HEADERS "boost/wave.hpp") 872 | set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp") 873 | if(WIN32) 874 | set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") 875 | set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp") 876 | endif() 877 | 878 | string(TOUPPER ${component} uppercomponent) 879 | set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE) 880 | 881 | string(REGEX REPLACE ";" " " _boost_HDRS_STRING "${_Boost_${uppercomponent}_HEADERS}") 882 | if (NOT _boost_HDRS_STRING) 883 | set(_boost_HDRS_STRING "(none)") 884 | endif() 885 | # message(STATUS "Headers for Boost::${component}: ${_boost_HDRS_STRING}") 886 | endfunction() 887 | 888 | # 889 | # Determine if any missing dependencies require adding to the component list. 890 | # 891 | # Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, 892 | # plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be 893 | # defined; FALSE if dependency information is unavailable). 894 | # 895 | # componentvar - the component list variable name 896 | # extravar - the indirect dependency list variable name 897 | # 898 | # 899 | function(_Boost_MISSING_DEPENDENCIES componentvar extravar) 900 | # _boost_unprocessed_components - list of components requiring processing 901 | # _boost_processed_components - components already processed (or currently being processed) 902 | # _boost_new_components - new components discovered for future processing 903 | # 904 | list(APPEND _boost_unprocessed_components ${${componentvar}}) 905 | 906 | while(_boost_unprocessed_components) 907 | list(APPEND _boost_processed_components ${_boost_unprocessed_components}) 908 | foreach(component ${_boost_unprocessed_components}) 909 | string(TOUPPER ${component} uppercomponent) 910 | set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) 911 | _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) 912 | set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) 913 | set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) 914 | foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) 915 | if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components)) 916 | list(APPEND _boost_new_components ${componentdep}) 917 | endif() 918 | endforeach() 919 | endforeach() 920 | set(_boost_unprocessed_components ${_boost_new_components}) 921 | unset(_boost_new_components) 922 | endwhile() 923 | set(_boost_extra_components ${_boost_processed_components}) 924 | if(_boost_extra_components AND ${componentvar}) 925 | list(REMOVE_ITEM _boost_extra_components ${${componentvar}}) 926 | endif() 927 | set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) 928 | set(${extravar} ${_boost_extra_components} PARENT_SCOPE) 929 | endfunction() 930 | 931 | # 932 | # Some boost libraries may require particular set of compler features. 933 | # The very first one was `boost::fiber` introduced in Boost 1.62. 934 | # One can check required compiler features of it in 935 | # `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`. 936 | # 937 | function(_Boost_COMPILER_FEATURES component _ret) 938 | # Boost >= 1.62 and < 1.65 939 | if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106500) 940 | set(_Boost_FIBER_COMPILER_FEATURES 941 | cxx_alias_templates 942 | cxx_auto_type 943 | cxx_constexpr 944 | cxx_defaulted_functions 945 | cxx_final 946 | cxx_lambdas 947 | cxx_noexcept 948 | cxx_nullptr 949 | cxx_rvalue_references 950 | cxx_thread_local 951 | cxx_variadic_templates 952 | ) 953 | endif() 954 | string(TOUPPER ${component} uppercomponent) 955 | set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE) 956 | endfunction() 957 | 958 | # 959 | # Update library search directory hint variable with paths used by prebuilt boost binaries. 960 | # 961 | # Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/) 962 | # have library directories named using MSVC compiler version and architecture. 963 | # This function would append corresponding directories if MSVC is a current compiler, 964 | # so having `BOOST_ROOT` would be enough to specify to find everything. 965 | # 966 | function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir) 967 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") 968 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 969 | set(_arch_suffix 64) 970 | else() 971 | set(_arch_suffix 32) 972 | endif() 973 | if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) 974 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1) 975 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0) 976 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) 977 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0) 978 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) 979 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-12.0) 980 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) 981 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-11.0) 982 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) 983 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-10.0) 984 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) 985 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-9.0) 986 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) 987 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0) 988 | endif() 989 | set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE) 990 | endif() 991 | endfunction() 992 | 993 | # 994 | # End functions/macros 995 | # 996 | #------------------------------------------------------------------------------- 997 | 998 | #------------------------------------------------------------------------------- 999 | # main. 1000 | #------------------------------------------------------------------------------- 1001 | 1002 | 1003 | # If the user sets Boost_LIBRARY_DIR, use it as the default for both 1004 | # configurations. 1005 | if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR) 1006 | set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}") 1007 | endif() 1008 | if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR) 1009 | set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}") 1010 | endif() 1011 | 1012 | if(NOT DEFINED Boost_USE_DEBUG_LIBS) 1013 | set(Boost_USE_DEBUG_LIBS TRUE) 1014 | endif() 1015 | if(NOT DEFINED Boost_USE_RELEASE_LIBS) 1016 | set(Boost_USE_RELEASE_LIBS TRUE) 1017 | endif() 1018 | if(NOT DEFINED Boost_USE_MULTITHREADED) 1019 | set(Boost_USE_MULTITHREADED TRUE) 1020 | endif() 1021 | if(NOT DEFINED Boost_USE_DEBUG_RUNTIME) 1022 | set(Boost_USE_DEBUG_RUNTIME TRUE) 1023 | endif() 1024 | 1025 | # Check the version of Boost against the requested version. 1026 | if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) 1027 | message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34") 1028 | endif() 1029 | 1030 | if(Boost_FIND_VERSION_EXACT) 1031 | # The version may appear in a directory with or without the patch 1032 | # level, even when the patch level is non-zero. 1033 | set(_boost_TEST_VERSIONS 1034 | "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" 1035 | "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") 1036 | else() 1037 | # The user has not requested an exact version. Among known 1038 | # versions, find those that are acceptable to the user request. 1039 | # 1040 | # Note: When adding a new Boost release, also update the dependency 1041 | # information in _Boost_COMPONENT_DEPENDENCIES and 1042 | # _Boost_COMPONENT_HEADERS. See the instructions at the top of 1043 | # _Boost_COMPONENT_DEPENDENCIES. 1044 | set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} 1045 | "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" 1046 | "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" 1047 | "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" 1048 | "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" 1049 | "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" 1050 | "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" 1051 | "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" 1052 | "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" 1053 | "1.34" "1.33.1" "1.33.0" "1.33") 1054 | 1055 | set(_boost_TEST_VERSIONS) 1056 | if(Boost_FIND_VERSION) 1057 | set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") 1058 | # Select acceptable versions. 1059 | foreach(version ${_Boost_KNOWN_VERSIONS}) 1060 | if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") 1061 | # This version is high enough. 1062 | list(APPEND _boost_TEST_VERSIONS "${version}") 1063 | elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") 1064 | # This version is a short-form for the requested version with 1065 | # the patch level dropped. 1066 | list(APPEND _boost_TEST_VERSIONS "${version}") 1067 | endif() 1068 | endforeach() 1069 | else() 1070 | # Any version is acceptable. 1071 | set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") 1072 | endif() 1073 | endif() 1074 | 1075 | # The reason that we failed to find Boost. This will be set to a 1076 | # user-friendly message when we fail to find some necessary piece of 1077 | # Boost. 1078 | set(Boost_ERROR_REASON) 1079 | 1080 | if(Boost_DEBUG) 1081 | # Output some of their choices 1082 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1083 | "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") 1084 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1085 | "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") 1086 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1087 | "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") 1088 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1089 | "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") 1090 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1091 | "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") 1092 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1093 | "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") 1094 | endif() 1095 | 1096 | # Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It 1097 | # will only contain any interface definitions on WIN32, but is created 1098 | # on all platforms to keep end user code free from platform dependent 1099 | # code. Also provide convenience targets to disable autolinking and 1100 | # enable dynamic linking. 1101 | if(NOT TARGET Boost::diagnostic_definitions) 1102 | add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) 1103 | add_library(Boost::disable_autolinking INTERFACE IMPORTED) 1104 | add_library(Boost::dynamic_linking INTERFACE IMPORTED) 1105 | endif() 1106 | if(WIN32) 1107 | # In windows, automatic linking is performed, so you do not have 1108 | # to specify the libraries. If you are linking to a dynamic 1109 | # runtime, then you can choose to link to either a static or a 1110 | # dynamic Boost library, the default is to do a static link. You 1111 | # can alter this for a specific library "whatever" by defining 1112 | # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be 1113 | # linked dynamically. Alternatively you can force all Boost 1114 | # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. 1115 | 1116 | # This feature can be disabled for Boost library "whatever" by 1117 | # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining 1118 | # BOOST_ALL_NO_LIB. 1119 | 1120 | # If you want to observe which libraries are being linked against 1121 | # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking 1122 | # code to emit a #pragma message each time a library is selected 1123 | # for linking. 1124 | set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") 1125 | set_target_properties(Boost::diagnostic_definitions PROPERTIES 1126 | INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") 1127 | set_target_properties(Boost::disable_autolinking PROPERTIES 1128 | INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") 1129 | set_target_properties(Boost::dynamic_linking PROPERTIES 1130 | INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") 1131 | endif() 1132 | 1133 | _Boost_CHECK_SPELLING(Boost_ROOT) 1134 | _Boost_CHECK_SPELLING(Boost_LIBRARYDIR) 1135 | _Boost_CHECK_SPELLING(Boost_INCLUDEDIR) 1136 | 1137 | # Collect environment variable inputs as hints. Do not consider changes. 1138 | foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR) 1139 | set(_env $ENV{${v}}) 1140 | if(_env) 1141 | file(TO_CMAKE_PATH "${_env}" _ENV_${v}) 1142 | else() 1143 | set(_ENV_${v} "") 1144 | endif() 1145 | endforeach() 1146 | if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT) 1147 | set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}") 1148 | endif() 1149 | 1150 | # Collect inputs and cached results. Detect changes since the last run. 1151 | if(NOT BOOST_ROOT AND BOOSTROOT) 1152 | set(BOOST_ROOT "${BOOSTROOT}") 1153 | endif() 1154 | set(_Boost_VARS_DIR 1155 | BOOST_ROOT 1156 | Boost_NO_SYSTEM_PATHS 1157 | ) 1158 | 1159 | if(Boost_DEBUG) 1160 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1161 | "Declared as CMake or Environmental Variables:") 1162 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1163 | " BOOST_ROOT = ${BOOST_ROOT}") 1164 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1165 | " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") 1166 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1167 | " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") 1168 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1169 | "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") 1170 | endif() 1171 | 1172 | # ------------------------------------------------------------------------ 1173 | # Search for Boost include DIR 1174 | # ------------------------------------------------------------------------ 1175 | 1176 | set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS) 1177 | _Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC}) 1178 | # Clear Boost_INCLUDE_DIR if it did not change but other input affecting the 1179 | # location did. We will find a new one based on the new inputs. 1180 | if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED) 1181 | unset(Boost_INCLUDE_DIR CACHE) 1182 | endif() 1183 | 1184 | if(NOT Boost_INCLUDE_DIR) 1185 | set(_boost_INCLUDE_SEARCH_DIRS "") 1186 | if(BOOST_INCLUDEDIR) 1187 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR}) 1188 | elseif(_ENV_BOOST_INCLUDEDIR) 1189 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR}) 1190 | endif() 1191 | 1192 | if( BOOST_ROOT ) 1193 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT}) 1194 | elseif( _ENV_BOOST_ROOT ) 1195 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT}) 1196 | endif() 1197 | 1198 | if( Boost_NO_SYSTEM_PATHS) 1199 | list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) 1200 | else() 1201 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") 1202 | foreach(ver ${_Boost_KNOWN_VERSIONS}) 1203 | string(REPLACE "." "_" ver "${ver}") 1204 | list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}") 1205 | endforeach() 1206 | endif() 1207 | list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS 1208 | C:/boost/include 1209 | C:/boost 1210 | /sw/local/include 1211 | ) 1212 | endif() 1213 | 1214 | # Try to find Boost by stepping backwards through the Boost versions 1215 | # we know about. 1216 | # Build a list of path suffixes for each version. 1217 | set(_boost_PATH_SUFFIXES) 1218 | foreach(_boost_VER ${_boost_TEST_VERSIONS}) 1219 | # Add in a path suffix, based on the required version, ideally 1220 | # we could read this from version.hpp, but for that to work we'd 1221 | # need to know the include dir already 1222 | set(_boost_BOOSTIFIED_VERSION) 1223 | 1224 | # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 1225 | if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") 1226 | set(_boost_BOOSTIFIED_VERSION 1227 | "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}") 1228 | elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)") 1229 | set(_boost_BOOSTIFIED_VERSION 1230 | "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") 1231 | endif() 1232 | 1233 | list(APPEND _boost_PATH_SUFFIXES 1234 | "boost-${_boost_BOOSTIFIED_VERSION}" 1235 | "boost_${_boost_BOOSTIFIED_VERSION}" 1236 | "boost/boost-${_boost_BOOSTIFIED_VERSION}" 1237 | "boost/boost_${_boost_BOOSTIFIED_VERSION}" 1238 | ) 1239 | 1240 | endforeach() 1241 | 1242 | if(Boost_DEBUG) 1243 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1244 | "Include debugging info:") 1245 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1246 | " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") 1247 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1248 | " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") 1249 | endif() 1250 | 1251 | # Look for a standard boost header file. 1252 | find_path(Boost_INCLUDE_DIR 1253 | NAMES boost/config.hpp 1254 | HINTS ${_boost_INCLUDE_SEARCH_DIRS} 1255 | PATH_SUFFIXES ${_boost_PATH_SUFFIXES} 1256 | ) 1257 | endif() 1258 | 1259 | # ------------------------------------------------------------------------ 1260 | # Extract version information from version.hpp 1261 | # ------------------------------------------------------------------------ 1262 | 1263 | # Set Boost_FOUND based only on header location and version. 1264 | # It will be updated below for component libraries. 1265 | if(Boost_INCLUDE_DIR) 1266 | if(Boost_DEBUG) 1267 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1268 | "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") 1269 | endif() 1270 | 1271 | # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp 1272 | set(Boost_VERSION 0) 1273 | set(Boost_LIB_VERSION "") 1274 | file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") 1275 | set(_Boost_VERSION_REGEX "([0-9]+)") 1276 | set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") 1277 | foreach(v VERSION LIB_VERSION) 1278 | if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}") 1279 | set(Boost_${v} "${CMAKE_MATCH_1}") 1280 | endif() 1281 | endforeach() 1282 | unset(_boost_VERSION_HPP_CONTENTS) 1283 | 1284 | math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") 1285 | math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") 1286 | math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") 1287 | 1288 | string(APPEND Boost_ERROR_REASON 1289 | "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") 1290 | if(Boost_DEBUG) 1291 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1292 | "version.hpp reveals boost " 1293 | "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") 1294 | endif() 1295 | 1296 | if(Boost_FIND_VERSION) 1297 | # Set Boost_FOUND based on requested version. 1298 | set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") 1299 | if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}") 1300 | set(Boost_FOUND 0) 1301 | set(_Boost_VERSION_AGE "old") 1302 | elseif(Boost_FIND_VERSION_EXACT AND 1303 | NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}") 1304 | set(Boost_FOUND 0) 1305 | set(_Boost_VERSION_AGE "new") 1306 | else() 1307 | set(Boost_FOUND 1) 1308 | endif() 1309 | if(NOT Boost_FOUND) 1310 | # State that we found a version of Boost that is too new or too old. 1311 | string(APPEND Boost_ERROR_REASON 1312 | "\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") 1313 | if (Boost_FIND_VERSION_PATCH) 1314 | string(APPEND Boost_ERROR_REASON 1315 | ".${Boost_FIND_VERSION_PATCH}") 1316 | endif () 1317 | if (NOT Boost_FIND_VERSION_EXACT) 1318 | string(APPEND Boost_ERROR_REASON " (or newer)") 1319 | endif () 1320 | string(APPEND Boost_ERROR_REASON ".") 1321 | endif () 1322 | else() 1323 | # Caller will accept any Boost version. 1324 | set(Boost_FOUND 1) 1325 | endif() 1326 | else() 1327 | set(Boost_FOUND 0) 1328 | string(APPEND Boost_ERROR_REASON 1329 | "Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") 1330 | endif() 1331 | 1332 | # ------------------------------------------------------------------------ 1333 | # Prefix initialization 1334 | # ------------------------------------------------------------------------ 1335 | 1336 | set(Boost_LIB_PREFIX "") 1337 | if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR 1338 | (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) ) 1339 | set(Boost_LIB_PREFIX "lib") 1340 | endif() 1341 | 1342 | if ( NOT Boost_NAMESPACE ) 1343 | set(Boost_NAMESPACE "boost") 1344 | endif() 1345 | 1346 | # ------------------------------------------------------------------------ 1347 | # Suffix initialization and compiler suffix detection. 1348 | # ------------------------------------------------------------------------ 1349 | 1350 | set(_Boost_VARS_NAME 1351 | Boost_NAMESPACE 1352 | Boost_COMPILER 1353 | Boost_THREADAPI 1354 | Boost_USE_DEBUG_PYTHON 1355 | Boost_USE_MULTITHREADED 1356 | Boost_USE_STATIC_LIBS 1357 | Boost_USE_STATIC_RUNTIME 1358 | Boost_USE_STLPORT 1359 | Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS 1360 | ) 1361 | _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) 1362 | 1363 | # Setting some more suffixes for the library 1364 | if (Boost_COMPILER) 1365 | set(_boost_COMPILER ${Boost_COMPILER}) 1366 | if(Boost_DEBUG) 1367 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1368 | "using user-specified Boost_COMPILER = ${_boost_COMPILER}") 1369 | endif() 1370 | else() 1371 | # Attempt to guess the compiler suffix 1372 | # NOTE: this is not perfect yet, if you experience any issues 1373 | # please report them and use the Boost_COMPILER variable 1374 | # to work around the problems. 1375 | _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) 1376 | if(Boost_DEBUG) 1377 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1378 | "guessed _boost_COMPILER = ${_boost_COMPILER}") 1379 | endif() 1380 | endif() 1381 | 1382 | set(_boost_BITSIZE "") 1383 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 1384 | set(_boost_BITSIZE "-x64") 1385 | endif() 1386 | 1387 | set (_boost_MULTITHREADED "-mt") 1388 | if( NOT Boost_USE_MULTITHREADED ) 1389 | set (_boost_MULTITHREADED "") 1390 | endif() 1391 | 1392 | if(Boost_DEBUG) 1393 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1394 | "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") 1395 | endif() 1396 | 1397 | #====================== 1398 | # Systematically build up the Boost ABI tag 1399 | # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming 1400 | set( _boost_RELEASE_ABI_TAG "-") 1401 | set( _boost_DEBUG_ABI_TAG "-") 1402 | # Key Use this library when: 1403 | # s linking statically to the C++ standard library and 1404 | # compiler runtime support libraries. 1405 | if(Boost_USE_STATIC_RUNTIME) 1406 | set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") 1407 | set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") 1408 | endif() 1409 | # g using debug versions of the standard and runtime 1410 | # support libraries 1411 | if(WIN32 AND Boost_USE_DEBUG_RUNTIME) 1412 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" 1413 | OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" 1414 | OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") 1415 | string(APPEND _boost_DEBUG_ABI_TAG "g") 1416 | endif() 1417 | endif() 1418 | # y using special debug build of python 1419 | if(Boost_USE_DEBUG_PYTHON) 1420 | string(APPEND _boost_DEBUG_ABI_TAG "y") 1421 | endif() 1422 | # d using a debug version of your code 1423 | string(APPEND _boost_DEBUG_ABI_TAG "d") 1424 | # p using the STLport standard library rather than the 1425 | # default one supplied with your compiler 1426 | if(Boost_USE_STLPORT) 1427 | string(APPEND _boost_RELEASE_ABI_TAG "p") 1428 | string(APPEND _boost_DEBUG_ABI_TAG "p") 1429 | endif() 1430 | # n using the STLport deprecated "native iostreams" feature 1431 | if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) 1432 | string(APPEND _boost_RELEASE_ABI_TAG "n") 1433 | string(APPEND _boost_DEBUG_ABI_TAG "n") 1434 | endif() 1435 | 1436 | if(Boost_DEBUG) 1437 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1438 | "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") 1439 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1440 | "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") 1441 | endif() 1442 | 1443 | # ------------------------------------------------------------------------ 1444 | # Begin finding boost libraries 1445 | # ------------------------------------------------------------------------ 1446 | 1447 | set(_Boost_VARS_LIB "") 1448 | foreach(c DEBUG RELEASE) 1449 | set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c}) 1450 | list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}}) 1451 | _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR) 1452 | # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the 1453 | # location did. We will find a new one based on the new inputs. 1454 | if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED) 1455 | unset(Boost_LIBRARY_DIR_${c} CACHE) 1456 | endif() 1457 | 1458 | # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value. 1459 | if(Boost_LIBRARY_DIR_${c}) 1460 | set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) 1461 | else() 1462 | set(_boost_LIBRARY_SEARCH_DIRS_${c} "") 1463 | if(BOOST_LIBRARYDIR) 1464 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR}) 1465 | elseif(_ENV_BOOST_LIBRARYDIR) 1466 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR}) 1467 | endif() 1468 | 1469 | if(BOOST_ROOT) 1470 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) 1471 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}") 1472 | elseif(_ENV_BOOST_ROOT) 1473 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) 1474 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}") 1475 | endif() 1476 | 1477 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} 1478 | ${Boost_INCLUDE_DIR}/lib 1479 | ${Boost_INCLUDE_DIR}/../lib 1480 | ${Boost_INCLUDE_DIR}/stage/lib 1481 | ) 1482 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..") 1483 | if( Boost_NO_SYSTEM_PATHS ) 1484 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) 1485 | else() 1486 | foreach(ver ${_Boost_KNOWN_VERSIONS}) 1487 | string(REPLACE "." "_" ver "${ver}") 1488 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}") 1489 | endforeach() 1490 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost") 1491 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS 1492 | C:/boost/lib 1493 | C:/boost 1494 | /sw/local/lib 1495 | ) 1496 | endif() 1497 | endif() 1498 | endforeach() 1499 | 1500 | if(Boost_DEBUG) 1501 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1502 | "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}" 1503 | "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") 1504 | endif() 1505 | 1506 | # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES 1507 | if( Boost_USE_STATIC_LIBS ) 1508 | set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) 1509 | if(WIN32) 1510 | list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a) 1511 | else() 1512 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a) 1513 | endif() 1514 | endif() 1515 | 1516 | # We want to use the tag inline below without risking double dashes 1517 | if(_boost_RELEASE_ABI_TAG) 1518 | if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") 1519 | set(_boost_RELEASE_ABI_TAG "") 1520 | endif() 1521 | endif() 1522 | if(_boost_DEBUG_ABI_TAG) 1523 | if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") 1524 | set(_boost_DEBUG_ABI_TAG "") 1525 | endif() 1526 | endif() 1527 | 1528 | # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled 1529 | # on WIN32 was to: 1530 | # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) 1531 | # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) 1532 | # We maintain this behavior since changing it could break people's builds. 1533 | # To disable the ambiguous behavior, the user need only 1534 | # set Boost_USE_STATIC_RUNTIME either ON or OFF. 1535 | set(_boost_STATIC_RUNTIME_WORKAROUND false) 1536 | if(WIN32 AND Boost_USE_STATIC_LIBS) 1537 | if(NOT DEFINED Boost_USE_STATIC_RUNTIME) 1538 | set(_boost_STATIC_RUNTIME_WORKAROUND TRUE) 1539 | endif() 1540 | endif() 1541 | 1542 | # On versions < 1.35, remove the System library from the considered list 1543 | # since it wasn't added until 1.35. 1544 | if(Boost_VERSION AND Boost_FIND_COMPONENTS) 1545 | if(Boost_VERSION LESS 103500) 1546 | list(REMOVE_ITEM Boost_FIND_COMPONENTS system) 1547 | endif() 1548 | endif() 1549 | 1550 | # Additional components may be required via component dependencies. 1551 | # Add any missing components to the list. 1552 | _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS) 1553 | 1554 | # If thread is required, get the thread libs as a dependency 1555 | if("thread" IN_LIST Boost_FIND_COMPONENTS) 1556 | if(Boost_FIND_QUIETLY) 1557 | set(_Boost_find_quiet QUIET) 1558 | else() 1559 | set(_Boost_find_quiet "") 1560 | endif() 1561 | find_package(Threads ${_Boost_find_quiet}) 1562 | unset(_Boost_find_quiet) 1563 | endif() 1564 | 1565 | # If the user changed any of our control inputs flush previous results. 1566 | if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME) 1567 | foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) 1568 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) 1569 | foreach(c DEBUG RELEASE) 1570 | set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c}) 1571 | unset(${_var} CACHE) 1572 | set(${_var} "${_var}-NOTFOUND") 1573 | endforeach() 1574 | endforeach() 1575 | set(_Boost_COMPONENTS_SEARCHED "") 1576 | endif() 1577 | 1578 | foreach(COMPONENT ${Boost_FIND_COMPONENTS}) 1579 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) 1580 | 1581 | set( _boost_docstring_release "Boost ${COMPONENT} library (release)") 1582 | set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") 1583 | 1584 | # Compute component-specific hints. 1585 | set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") 1586 | if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR 1587 | ${COMPONENT} STREQUAL "graph_parallel") 1588 | foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) 1589 | if(IS_ABSOLUTE "${lib}") 1590 | get_filename_component(libdir "${lib}" PATH) 1591 | string(REPLACE "\\" "/" libdir "${libdir}") 1592 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir}) 1593 | endif() 1594 | endforeach() 1595 | endif() 1596 | 1597 | # Consolidate and report component-specific hints. 1598 | if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) 1599 | list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) 1600 | if(Boost_DEBUG) 1601 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1602 | "Component-specific library search paths for ${COMPONENT}: " 1603 | "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}") 1604 | endif() 1605 | endif() 1606 | 1607 | # 1608 | # Find headers 1609 | # 1610 | _Boost_COMPONENT_HEADERS("${COMPONENT}" Boost_${UPPERCOMPONENT}_HEADER_NAME) 1611 | # Look for a standard boost header file. 1612 | if(Boost_${UPPERCOMPONENT}_HEADER_NAME) 1613 | if(EXISTS "${Boost_INCLUDE_DIR}/${Boost_${UPPERCOMPONENT}_HEADER_NAME}") 1614 | set(Boost_${UPPERCOMPONENT}_HEADER ON) 1615 | else() 1616 | set(Boost_${UPPERCOMPONENT}_HEADER OFF) 1617 | endif() 1618 | else() 1619 | set(Boost_${UPPERCOMPONENT}_HEADER ON) 1620 | message(WARNING "No header defined for ${COMPONENT}; skipping header check") 1621 | endif() 1622 | 1623 | # 1624 | # Find RELEASE libraries 1625 | # 1626 | unset(_boost_RELEASE_NAMES) 1627 | foreach(compiler IN LISTS _boost_COMPILER) 1628 | list(APPEND _boost_RELEASE_NAMES 1629 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1630 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_BITSIZE}) 1631 | endforeach() 1632 | list(APPEND _boost_RELEASE_NAMES 1633 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1634 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_BITSIZE} 1635 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) 1636 | if(_boost_STATIC_RUNTIME_WORKAROUND) 1637 | set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") 1638 | foreach(compiler IN LISTS _boost_COMPILER) 1639 | list(APPEND _boost_RELEASE_NAMES 1640 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1641 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_BITSIZE} ) 1642 | endforeach() 1643 | list(APPEND _boost_RELEASE_NAMES 1644 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1645 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_BITSIZE} ) 1646 | endif() 1647 | if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") 1648 | _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) 1649 | endif() 1650 | if(Boost_DEBUG) 1651 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1652 | "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") 1653 | endif() 1654 | 1655 | # if Boost_LIBRARY_DIR_RELEASE is not defined, 1656 | # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs 1657 | if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG) 1658 | list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG}) 1659 | endif() 1660 | 1661 | # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. 1662 | string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}") 1663 | 1664 | if(Boost_USE_RELEASE_LIBS) 1665 | _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE 1666 | NAMES ${_boost_RELEASE_NAMES} 1667 | HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} 1668 | NAMES_PER_DIR 1669 | DOC "${_boost_docstring_release}" 1670 | ) 1671 | endif() 1672 | 1673 | # 1674 | # Find DEBUG libraries 1675 | # 1676 | unset(_boost_DEBUG_NAMES) 1677 | foreach(compiler IN LISTS _boost_COMPILER) 1678 | list(APPEND _boost_DEBUG_NAMES 1679 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1680 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_BITSIZE} ) 1681 | endforeach() 1682 | list(APPEND _boost_DEBUG_NAMES 1683 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1684 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_BITSIZE} 1685 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED} 1686 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) 1687 | if(_boost_STATIC_RUNTIME_WORKAROUND) 1688 | set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") 1689 | foreach(compiler IN LISTS _boost_COMPILER) 1690 | list(APPEND _boost_DEBUG_NAMES 1691 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1692 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_BITSIZE} ) 1693 | endforeach() 1694 | list(APPEND _boost_DEBUG_NAMES 1695 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_BITSIZE}-${Boost_LIB_VERSION} 1696 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_BITSIZE} ) 1697 | endif() 1698 | if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") 1699 | _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) 1700 | endif() 1701 | if(Boost_DEBUG) 1702 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 1703 | "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") 1704 | endif() 1705 | 1706 | # if Boost_LIBRARY_DIR_DEBUG is not defined, 1707 | # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs 1708 | if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE) 1709 | list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE}) 1710 | endif() 1711 | 1712 | # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. 1713 | string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") 1714 | 1715 | if(Boost_USE_DEBUG_LIBS) 1716 | _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG 1717 | NAMES ${_boost_DEBUG_NAMES} 1718 | HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} 1719 | NAMES_PER_DIR 1720 | DOC "${_boost_docstring_debug}" 1721 | ) 1722 | endif () 1723 | 1724 | if(Boost_REALPATH) 1725 | _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") 1726 | _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) 1727 | endif() 1728 | 1729 | _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) 1730 | 1731 | # Check if component requires some compiler features 1732 | _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) 1733 | 1734 | endforeach() 1735 | 1736 | # Restore the original find library ordering 1737 | if( Boost_USE_STATIC_LIBS ) 1738 | set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) 1739 | endif() 1740 | 1741 | # ------------------------------------------------------------------------ 1742 | # End finding boost libraries 1743 | # ------------------------------------------------------------------------ 1744 | 1745 | set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) 1746 | set(Boost_LIBRARY_DIRS) 1747 | if(Boost_LIBRARY_DIR_RELEASE) 1748 | list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE}) 1749 | endif() 1750 | if(Boost_LIBRARY_DIR_DEBUG) 1751 | list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG}) 1752 | endif() 1753 | if(Boost_LIBRARY_DIRS) 1754 | list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) 1755 | endif() 1756 | 1757 | # The above setting of Boost_FOUND was based only on the header files. 1758 | # Update it for the requested component libraries. 1759 | if(Boost_FOUND) 1760 | # The headers were found. Check for requested component libs. 1761 | set(_boost_CHECKED_COMPONENT FALSE) 1762 | set(_Boost_MISSING_COMPONENTS "") 1763 | foreach(COMPONENT ${Boost_FIND_COMPONENTS}) 1764 | string(TOUPPER ${COMPONENT} COMPONENT) 1765 | set(_boost_CHECKED_COMPONENT TRUE) 1766 | if(NOT Boost_${COMPONENT}_FOUND) 1767 | string(TOLOWER ${COMPONENT} COMPONENT) 1768 | list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) 1769 | endif() 1770 | endforeach() 1771 | if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS) 1772 | # Optional indirect dependencies are not counted as missing. 1773 | list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS}) 1774 | endif() 1775 | 1776 | if(Boost_DEBUG) 1777 | message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") 1778 | endif() 1779 | 1780 | if (_Boost_MISSING_COMPONENTS) 1781 | set(Boost_FOUND 0) 1782 | # We were unable to find some libraries, so generate a sensible 1783 | # error message that lists the libraries we were unable to find. 1784 | string(APPEND Boost_ERROR_REASON 1785 | "\nCould not find the following") 1786 | if(Boost_USE_STATIC_LIBS) 1787 | string(APPEND Boost_ERROR_REASON " static") 1788 | endif() 1789 | string(APPEND Boost_ERROR_REASON 1790 | " Boost libraries:\n") 1791 | foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) 1792 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) 1793 | string(APPEND Boost_ERROR_REASON 1794 | " ${Boost_NAMESPACE}_${COMPONENT}${Boost_ERROR_REASON_${UPPERCOMPONENT}}\n") 1795 | endforeach() 1796 | 1797 | list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) 1798 | list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) 1799 | if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) 1800 | string(APPEND Boost_ERROR_REASON 1801 | "No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") 1802 | else () 1803 | string(APPEND Boost_ERROR_REASON 1804 | "Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") 1805 | endif () 1806 | endif () 1807 | 1808 | if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) 1809 | # Compatibility Code for backwards compatibility with CMake 1810 | # 2.4's FindBoost module. 1811 | 1812 | # Look for the boost library path. 1813 | # Note that the user may not have installed any libraries 1814 | # so it is quite possible the Boost_LIBRARY_DIRS may not exist. 1815 | set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) 1816 | 1817 | if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") 1818 | get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) 1819 | endif() 1820 | 1821 | if("${_boost_LIB_DIR}" MATCHES "/include$") 1822 | # Strip off the trailing "/include" in the path. 1823 | get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) 1824 | endif() 1825 | 1826 | if(EXISTS "${_boost_LIB_DIR}/lib") 1827 | string(APPEND _boost_LIB_DIR /lib) 1828 | elseif(EXISTS "${_boost_LIB_DIR}/stage/lib") 1829 | string(APPEND _boost_LIB_DIR "/stage/lib") 1830 | else() 1831 | set(_boost_LIB_DIR "") 1832 | endif() 1833 | 1834 | if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") 1835 | set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR}) 1836 | endif() 1837 | 1838 | endif() 1839 | else() 1840 | # Boost headers were not found so no components were found. 1841 | foreach(COMPONENT ${Boost_FIND_COMPONENTS}) 1842 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) 1843 | set(Boost_${UPPERCOMPONENT}_FOUND 0) 1844 | endforeach() 1845 | endif() 1846 | 1847 | # ------------------------------------------------------------------------ 1848 | # Add imported targets 1849 | # ------------------------------------------------------------------------ 1850 | 1851 | if(Boost_FOUND) 1852 | # For header-only libraries 1853 | if(NOT TARGET Boost::boost) 1854 | add_library(Boost::boost INTERFACE IMPORTED) 1855 | if(Boost_INCLUDE_DIRS) 1856 | set_target_properties(Boost::boost PROPERTIES 1857 | INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") 1858 | endif() 1859 | endif() 1860 | 1861 | foreach(COMPONENT ${Boost_FIND_COMPONENTS}) 1862 | if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT}) 1863 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) 1864 | if(Boost_${UPPERCOMPONENT}_FOUND) 1865 | if(Boost_USE_STATIC_LIBS) 1866 | add_library(Boost::${COMPONENT} STATIC IMPORTED) 1867 | else() 1868 | # Even if Boost_USE_STATIC_LIBS is OFF, we might have static 1869 | # libraries as a result. 1870 | add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) 1871 | endif() 1872 | if(Boost_INCLUDE_DIRS) 1873 | set_target_properties(Boost::${COMPONENT} PROPERTIES 1874 | INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") 1875 | endif() 1876 | if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") 1877 | set_target_properties(Boost::${COMPONENT} PROPERTIES 1878 | IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" 1879 | IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") 1880 | endif() 1881 | if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") 1882 | set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY 1883 | IMPORTED_CONFIGURATIONS RELEASE) 1884 | set_target_properties(Boost::${COMPONENT} PROPERTIES 1885 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 1886 | IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") 1887 | endif() 1888 | if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") 1889 | set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY 1890 | IMPORTED_CONFIGURATIONS DEBUG) 1891 | set_target_properties(Boost::${COMPONENT} PROPERTIES 1892 | IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" 1893 | IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") 1894 | endif() 1895 | if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) 1896 | unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) 1897 | foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) 1898 | list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) 1899 | endforeach() 1900 | if(COMPONENT STREQUAL "thread") 1901 | list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) 1902 | endif() 1903 | set_target_properties(Boost::${COMPONENT} PROPERTIES 1904 | INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") 1905 | endif() 1906 | if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) 1907 | set_target_properties(Boost::${COMPONENT} PROPERTIES 1908 | INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}") 1909 | endif() 1910 | endif() 1911 | endif() 1912 | endforeach() 1913 | endif() 1914 | 1915 | # ------------------------------------------------------------------------ 1916 | # Notification to end user about what was found 1917 | # ------------------------------------------------------------------------ 1918 | 1919 | set(Boost_LIBRARIES "") 1920 | if(Boost_FOUND) 1921 | if(NOT Boost_FIND_QUIETLY) 1922 | message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") 1923 | if(Boost_FIND_COMPONENTS) 1924 | message(STATUS "Found the following Boost libraries:") 1925 | endif() 1926 | endif() 1927 | foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) 1928 | string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) 1929 | if( Boost_${UPPERCOMPONENT}_FOUND ) 1930 | if(NOT Boost_FIND_QUIETLY) 1931 | message (STATUS " ${COMPONENT}") 1932 | endif() 1933 | list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY}) 1934 | endif() 1935 | endforeach() 1936 | else() 1937 | if(Boost_FIND_REQUIRED) 1938 | message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") 1939 | else() 1940 | if(NOT Boost_FIND_QUIETLY) 1941 | # we opt not to automatically output Boost_ERROR_REASON here as 1942 | # it could be quite lengthy and somewhat imposing in its requests 1943 | # Since Boost is not always a required dependency we'll leave this 1944 | # up to the end-user. 1945 | if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) 1946 | message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") 1947 | else() 1948 | message(STATUS "Could NOT find Boost") 1949 | endif() 1950 | endif() 1951 | endif() 1952 | endif() 1953 | 1954 | # Configure display of cache entries in GUI. 1955 | foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB}) 1956 | get_property(_type CACHE ${v} PROPERTY TYPE) 1957 | if(_type) 1958 | set_property(CACHE ${v} PROPERTY ADVANCED 1) 1959 | if("x${_type}" STREQUAL "xUNINITIALIZED") 1960 | if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS") 1961 | set_property(CACHE ${v} PROPERTY TYPE STRING) 1962 | else() 1963 | set_property(CACHE ${v} PROPERTY TYPE PATH) 1964 | endif() 1965 | endif() 1966 | endif() 1967 | endforeach() 1968 | 1969 | # Record last used values of input variables so we can 1970 | # detect on the next run if the user changed them. 1971 | foreach(v 1972 | ${_Boost_VARS_INC} ${_Boost_VARS_LIB} 1973 | ${_Boost_VARS_DIR} ${_Boost_VARS_NAME} 1974 | ) 1975 | if(DEFINED ${v}) 1976 | set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.") 1977 | else() 1978 | unset(_${v}_LAST CACHE) 1979 | endif() 1980 | endforeach() 1981 | 1982 | # Maintain a persistent list of components requested anywhere since 1983 | # the last flush. 1984 | set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}") 1985 | list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS}) 1986 | list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) 1987 | list(SORT _Boost_COMPONENTS_SEARCHED) 1988 | set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" 1989 | CACHE INTERNAL "Components requested for this build tree.") 1990 | 1991 | # Restore project's policies 1992 | cmake_policy(POP) 1993 | --------------------------------------------------------------------------------