################################################################################ ## ## Copyright (c) 2007-2009 Illumina, Inc. ## ## This software is covered by the "Illumina Genome Analyzer Software ## License Agreement" and the "Illumina Source Code License Agreement", ## and certain third party copyright/licenses, and any user of this ## source file is bound by the terms therein (see accompanying files ## Illumina_Genome_Analyzer_Software_License_Agreement.pdf and ## Illumina_Source_Code_License_Agreement.pdf and third party ## copyright/license notices). ## ## This file is part of the Consensus Assessment of Sequence And VAriation ## (CASAVA) software package. ## ## file macros.cmake ## ## CMake configuration file for common installation macros ## ## authors: Roman Petrovski, Mauricio Varea ## ################################################################################ macro(configure_files srcDir destDir pattern) file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/${pattern}) foreach(templateFile ${templateFiles}) message(STATUS "Configuring file ${srcDir}/${templateFile}") configure_file(${srcDir}/${templateFile} ${destDir}/${templateFile} @ONLY IMMEDIATE) endforeach(templateFile) endmacro(configure_files) macro(install_files srcDir destDir pattern perm) file(GLOB templateFiles ${srcDir}/${pattern}) file(INSTALL DESTINATION ${destDir} TYPE FILE FILES ${templateFiles} PERMISSIONS ${perm}) endmacro(install_files) macro(configure_files_recursively srcDir destDir pattern) file(GLOB_RECURSE templateFiles RELATIVE ${srcDir} ${srcDir}/${pattern}) foreach(templateFile ${templateFiles}) message(STATUS "Configuring file ${srcDir}/${templateFile}") configure_file(${srcDir}/${templateFile} ${destDir}/${templateFile} @ONLY IMMEDIATE) endforeach(templateFile) endmacro(configure_files_recursively) macro(install_files_recursively srcDir destDir pattern perm) file(GLOB_RECURSE templateFiles RELATIVE ${srcDir} ${srcDir}/${pattern}) foreach(templateFile ${templateFiles}) get_filename_component(DIRNAME "${templateFile}" PATH) file(INSTALL DESTINATION ${destDir}/${DIRNAME} TYPE FILE FILES ${srcDir}/${templateFile} PERMISSIONS ${perm}) endforeach(templateFile) endmacro(install_files_recursively) # # Macro to find libraries, with support for static-only search # macro(casava_find_library name header library) if (NOT ${name}_INCLUDE_DIR) find_path(${name}_INCLUDE_DIR ${header} HINTS ENV C_INCLUDE_PATH ENV CPATH ENV CPLUS_INCLUDE_PATH) endif (NOT ${name}_INCLUDE_DIR) if (${name}_INCLUDE_DIR AND NOT ${name}_LIBRARY) find_library(${name}_LIBRARY NAMES "${CASAVA_LIBRARY_PREFIX}${library}${CASAVA_LIBRARY_SUFFIX}" HINTS ENV LIBRARY_PATH) endif (${name}_INCLUDE_DIR AND NOT ${name}_LIBRARY) if(${name}_INCLUDE_DIR AND ${name}_LIBRARY) set (HAVE_${name} ${${name}_LIBRARY}) message (STATUS "Found ${name} header: ${${name}_INCLUDE_DIR}/${header}") message (STATUS "Found ${name} library: ${${name}_LIBRARY}") endif(${name}_INCLUDE_DIR AND ${name}_LIBRARY) endmacro(casava_find_library) # # Not only finds boost but also sets the variables so that # it is being used for include and linking # Also makes sure pthread is available for boost # macro(casava_find_boost boost_version boost_components) # pthread library required by boost casava_find_library(PTHREAD "pthread.h" pthread) if (HAVE_PTHREAD) set (CASAVA_ADDITIONAL_LIB ${CASAVA_ADDITIONAL_LIB} pthread) message(STATUS "pthread supported") else (HAVE_PTHREAD) message(STATUS "pthread headers: ${PTHREAD_INCLUDE_DIR}") message(STATUS "pthread library: ${PTHREAD_LIBRARY}") message(FATAL_ERROR "pthread library is required to build the CASAVA") endif (HAVE_PTHREAD) find_package(Boost ${boost_version} REQUIRED ${boost_components}) include_directories(BEFORE SYSTEM ${Boost_INCLUDE_DIRS}) set (HAVE_LIBBOOST_DATE_TIME ${Boost_DATE_TIME_FOUND}) set (HAVE_LIBBOOST_FILESYSTEM ${Boost_FILESYSTEM_FOUND}) set (HAVE_LIBBOOST_IOSTREAMS ${Boost_IOSTREAMS_FOUND}) set (HAVE_LIBBOOST_PROGRAM_OPTIONS ${Boost_PROGRAM_OPTIONS_FOUND}) set (HAVE_LIBBOOST_PYTHON ${Boost_PYTHON_FOUND}) set (HAVE_LIBBOOST_REGEX ${Boost_REGEX_FOUND}) set (HAVE_LIBBOOST_SERIALIZATION ${Boost_SERIALIZATION_FOUND}) set (HAVE_LIBBOOST_SYSTEM ${Boost_SYSTEM_FOUND}) endmacro(casava_find_boost)