Commit 7c7c8a01 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'FindBoost-component'

830b332f FindBoost: Add tests for legacy variables
0dd6772a FindBoost: Add legacy variables and targets for compatibility
e4181eea FindBoost: Don't overwrite Boost_${_comp}_FOUND
4cb652e1 Tests.RunCMake.FindBoost: Fix example BoostConfig
7251d54b Tests.FindBoost: Don't use BoostConfig in MODULE test
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3438
parents c9f284c7 830b332f
Pipeline #139455 passed with stage
in 0 seconds
......@@ -249,6 +249,155 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
function(_boost_get_existing_target component target_var)
set(names "${component}")
if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$")
# handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc.
list(APPEND names
"${CMAKE_MATCH_1}${CMAKE_MATCH_2}" # python
"${CMAKE_MATCH_1}${CMAKE_MATCH_2}${CMAKE_MATCH_3}" # pythonX
"${CMAKE_MATCH_1}${CMAKE_MATCH_2}${CMAKE_MATCH_3}${CMAKE_MATCH_4}" #pythonXY
)
endif()
# https://github.com/boost-cmake/boost-cmake uses boost::file_system etc.
# So handle similar constructions of target names
string(TOLOWER "${component}" lower_component)
list(APPEND names "${lower_component}")
foreach(prefix Boost boost)
foreach(name IN LISTS names)
if(TARGET "${prefix}::${name}")
set(${target_var} "${prefix}::${name}" PARENT_SCOPE)
return()
endif()
endforeach()
endforeach()
set(${target_var} "" PARENT_SCOPE)
endfunction()
function(_boost_get_canonical_target_name component target_var)
string(TOLOWER "${component}" component)
if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$")
# handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc.
set(${target_var} "Boost::${CMAKE_MATCH_1}${CMAKE_MATCH_2}" PARENT_SCOPE)
else()
set(${target_var} "Boost::${component}" PARENT_SCOPE)
endif()
endfunction()
macro(_boost_set_in_parent_scope name value)
# Set a variable in parent scope and make it visibile in current scope
set(${name} "${value}" PARENT_SCOPE)
set(${name} "${value}")
endmacro()
macro(_boost_set_if_unset name value)
if(NOT ${name})
_boost_set_in_parent_scope(${name} "${value}")
endif()
endmacro()
macro(_boost_set_cache_if_unset name value)
if(NOT ${name})
set(${name} "${value}" CACHE STRING "" FORCE)
endif()
endmacro()
macro(_boost_append_include_dir target)
get_target_property(inc "${target}" INTERFACE_INCLUDE_DIRECTORIES)
if(inc)
list(APPEND include_dirs "${inc}")
endif()
endmacro()
function(_boost_set_legacy_variables_from_config)
# Set legacy variables for compatibility if not set
set(include_dirs "")
set(library_dirs "")
set(libraries "")
# Header targets Boost::headers or Boost::boost
foreach(comp headers boost)
_boost_get_existing_target(${comp} target)
if(target)
_boost_append_include_dir("${target}")
endif()
endforeach()
# Library targets
foreach(comp IN LISTS Boost_FIND_COMPONENTS)
string(TOUPPER ${comp} uppercomp)
# Overwrite if set
_boost_set_in_parent_scope(Boost_${uppercomp}_FOUND "${Boost_${comp}_FOUND}")
if(Boost_${comp}_FOUND)
_boost_get_existing_target(${comp} target)
if(NOT target)
if(Boost_DEBUG OR Boost_VERBOSE)
message(WARNING "Could not find imported target for required component '${comp}'. Standard variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use.")
endif()
continue()
endif()
_boost_append_include_dir("${target}")
_boost_set_if_unset(Boost_${uppercomp}_LIBRARY "${target}")
_boost_set_if_unset(Boost_${uppercomp}_LIBRARIES "${target}") # Very old legacy variable
list(APPEND libraries "${target}")
foreach(cfg RELEASE DEBUG)
get_target_property(lib ${target} IMPORTED_LOCATION_${cfg})
if(lib)
get_filename_component(lib_dir "${lib}" DIRECTORY)
list(APPEND library_dirs ${lib_dir})
_boost_set_cache_if_unset(Boost_${uppercomp}_LIBRARY_${cfg} "${lib}")
endif()
endforeach()
_boost_get_canonical_target_name("${comp}" canonical_target)
if(NOT TARGET "${canonical_target}")
add_library("${canonical_target}" INTERFACE IMPORTED)
target_link_libraries("${canonical_target}" INTERFACE "${target}")
endif()
endif()
endforeach()
list(REMOVE_DUPLICATES include_dirs)
list(REMOVE_DUPLICATES library_dirs)
_boost_set_if_unset(Boost_INCLUDE_DIRS "${include_dirs}")
_boost_set_if_unset(Boost_LIBRARY_DIRS "${library_dirs}")
_boost_set_if_unset(Boost_LIBRARIES "${libraries}")
_boost_set_if_unset(Boost_VERSION_STRING "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}")
find_path(Boost_INCLUDE_DIR
NAMES boost/version.hpp boost/config.hpp
HINTS ${Boost_INCLUDE_DIRS}
NO_DEFAULT_PATH
)
if(NOT Boost_VERSION_MACRO OR NOT Boost_LIB_VERSION)
set(version_file ${Boost_INCLUDE_DIR}/boost/version.hpp)
if(EXISTS "${version_file}")
file(STRINGS "${version_file}" contents REGEX "#define BOOST_(LIB_)?VERSION ")
if(contents MATCHES "#define BOOST_VERSION ([0-9]+)")
_boost_set_if_unset(Boost_VERSION_MACRO "${CMAKE_MATCH_1}")
endif()
if(contents MATCHES "#define BOOST_LIB_VERSION \"([0-9_]+)\"")
_boost_set_if_unset(Boost_LIB_VERSION "${CMAKE_MATCH_1}")
endif()
endif()
endif()
_boost_set_if_unset(Boost_MAJOR_VERSION ${Boost_VERSION_MAJOR})
_boost_set_if_unset(Boost_MINOR_VERSION ${Boost_VERSION_MINOR})
_boost_set_if_unset(Boost_SUBMINOR_VERSION ${Boost_VERSION_PATCH})
if(WIN32)
_boost_set_if_unset(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
endif()
if(NOT TARGET Boost::headers)
add_library(Boost::headers INTERFACE IMPORTED)
target_include_directories(Boost::headers INTERFACE ${Boost_INCLUDE_DIRS})
endif()
# Legacy targets w/o functionality as all handled by defined targets
foreach(lib diagnostic_definitions disable_autolinking dynamic_linking)
if(NOT TARGET Boost::${lib})
add_library(Boost::${lib} INTERFACE IMPORTED)
endif()
endforeach()
if(NOT TARGET Boost::boost)
add_library(Boost::boost INTERFACE IMPORTED)
target_link_libraries(Boost::boost INTERFACE Boost::headers)
endif()
endfunction()
#-------------------------------------------------------------------------------
# Before we go searching, check whether a boost cmake package is available, unless
# the user specifically asked NOT to search for one.
......@@ -276,21 +425,24 @@ if (NOT Boost_NO_BOOST_CMAKE)
# If we found a boost cmake package, then we're done. Print out what we found.
# Otherwise let the rest of the module try to find it.
if(Boost_FOUND)
# Neither the legacy boost-cmake nor the new builtin BoostConfig (as in 1.70)
# report the found components in the standard variables, so we need to convert
# them here
# Convert component found variables to standard variables if required
# Necessary for legacy boost-cmake and 1.70 builtin BoostConfig
if(Boost_FIND_COMPONENTS)
foreach(_comp IN LISTS Boost_FIND_COMPONENTS)
if(DEFINED Boost_${_comp}_FOUND)
continue()
endif()
string(TOUPPER ${_comp} _uppercomp)
if(DEFINED Boost${_comp}_FOUND)
if(DEFINED Boost${_comp}_FOUND) # legacy boost-cmake project
set(Boost_${_comp}_FOUND ${Boost${_comp}_FOUND})
elseif(DEFINED Boost_${_uppercomp}_FOUND)
elseif(DEFINED Boost_${_uppercomp}_FOUND) # Boost 1.70
set(Boost_${_comp}_FOUND ${Boost_${_uppercomp}_FOUND})
endif()
endforeach()
endif()
find_package_handle_standard_args(Boost HANDLE_COMPONENTS CONFIG_MODE)
_boost_set_legacy_variables_from_config()
# Restore project's policies
cmake_policy(POP)
......
......@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindBoost CXX)
include(CTest)
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost REQUIRED COMPONENTS filesystem thread
OPTIONAL_COMPONENTS program_options foobar)
......
set(Boost_DATE_TIME_FOUND 1)
add_library(Boost::boost INTERFACE IMPORTED)
add_library(Boost::headers INTERFACE IMPORTED)
add_library(Boost::date_time UNKNOWN IMPORTED)
# No boost::boost target and all targets start with lowercase letters
# Similar to https://github.com/boost-cmake/boost-cmake
add_library(boost::headers INTERFACE IMPORTED)
target_include_directories(boost::headers INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include")
set(Boost_date_time_FOUND 1)
add_library(boost::date_time UNKNOWN IMPORTED)
set_target_properties(boost::date_time PROPERTIES
IMPORTED_CONFIGURATIONS RELEASE
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_date_time.a"
)
set(Boost_python37_FOUND 1)
add_library(boost::python UNKNOWN IMPORTED)
set_target_properties(boost::python PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python_release.a"
IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python.a"
)
set(Boost_mpi_python2_FOUND 1)
add_library(boost::mpi_python UNKNOWN IMPORTED)
set_target_properties(boost::mpi_python PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_mpi_python.a"
IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_mpi_python.a"
)
set(PACKAGE_VERSION 1.70.42)
if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1)
set(PACKAGE_VERSION_COMPATIBLE 1)
if(PACKAGE_FIND_VERSION_MINOR EQUAL 70 AND PACKAGE_FIND_VERSION_PATCH EQUAL 42)
set(PACKAGE_VERSION_EXACT 1)
endif()
endif()
// Boost version.hpp configuration header file
// ------------------------------//
// (C) Copyright John maddock 1999. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for documentation
#ifndef BOOST_VERSION_HPP
#define BOOST_VERSION_HPP
//
// Caution: this is the only Boost header that is guaranteed
// to change with every Boost release. Including this header
// will cause a recompile every time a new Boost version is
// used.
//
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 1070042
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// but as a *string* in the form "x_y[_z]" where x is the major version
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to
// link to.
#define BOOST_LIB_VERSION "1_70_42"
#endif
# Don't have targets
set(Boost_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include")
set(Boost_DATE_TIME_FOUND 1)
set(Boost_DATE_TIME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_date_time.a")
set(Boost_LIBRARIES ${Boost_DATE_TIME_LIBRARY})
set(PACKAGE_VERSION 1.70.42)
if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1)
set(PACKAGE_VERSION_COMPATIBLE 1)
if(PACKAGE_FIND_VERSION_MINOR EQUAL 70 AND PACKAGE_FIND_VERSION_PATCH EQUAL 42)
set(PACKAGE_VERSION_EXACT 1)
endif()
endif()
// Boost version.hpp configuration header file
// ------------------------------//
// (C) Copyright John maddock 1999. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for documentation
#ifndef BOOST_VERSION_HPP
#define BOOST_VERSION_HPP
//
// Caution: this is the only Boost header that is guaranteed
// to change with every Boost release. Including this header
// will cause a recompile every time a new Boost version is
// used.
//
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 1070042
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// but as a *string* in the form "x_y[_z]" where x is the major version
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to
// link to.
#define BOOST_LIB_VERSION "1_70_42"
#endif
add_library(Boost::boost INTERFACE IMPORTED)
add_library(Boost::headers INTERFACE IMPORTED)
target_include_directories(Boost::headers INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include")
set(Boost_date_time_FOUND 1)
add_library(Boost::date_time UNKNOWN IMPORTED)
set_target_properties(Boost::date_time PROPERTIES
IMPORTED_CONFIGURATIONS RELEASE
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_date_time.a"
)
set(Boost_python37_FOUND 1)
add_library(Boost::python UNKNOWN IMPORTED)
set_target_properties(Boost::python PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python_release.a"
IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python.a"
)
set(Boost_mpi_python2_FOUND 1)
add_library(Boost::mpi_python UNKNOWN IMPORTED)
set_target_properties(Boost::mpi_python PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_mpi_python.a"
IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_mpi_python.a"
)
set(PACKAGE_VERSION 1.70.42)
if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1)
set(PACKAGE_VERSION_COMPATIBLE 1)
if(PACKAGE_FIND_VERSION_MINOR EQUAL 70 AND PACKAGE_FIND_VERSION_PATCH EQUAL 42)
set(PACKAGE_VERSION_EXACT 1)
endif()
endif()
// Boost version.hpp configuration header file
// ------------------------------//
// (C) Copyright John maddock 1999. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for documentation
#ifndef BOOST_VERSION_HPP
#define BOOST_VERSION_HPP
//
// Caution: this is the only Boost header that is guaranteed
// to change with every Boost release. Including this header
// will cause a recompile every time a new Boost version is
// used.
//
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 1070042
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// but as a *string* in the form "x_y[_z]" where x is the major version
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to
// link to.
#define BOOST_LIB_VERSION "1_70_42"
#endif
# UPPER_CASE FOUND vars and no header targets
set(Boost_DATE_TIME_FOUND 1)
add_library(Boost::date_time UNKNOWN IMPORTED)
set_target_properties(Boost::date_time PROPERTIES
IMPORTED_CONFIGURATIONS RELEASE
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_date_time.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/include"
)
set(Boost_PYTHON37_FOUND 1)
add_library(Boost::python UNKNOWN IMPORTED)
set_target_properties(Boost::python PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python_release.a"
IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/include"
)
set(Boost_MPI_PYTHON2_FOUND 1)
add_library(Boost::mpi_python UNKNOWN IMPORTED)
set_target_properties(Boost::mpi_python PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_mpi_python.a"
IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_mpi_python.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/include"
)
set(PACKAGE_VERSION 1.70.42)
if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1)
set(PACKAGE_VERSION_COMPATIBLE 1)
if(PACKAGE_FIND_VERSION_MINOR EQUAL 70 AND PACKAGE_FIND_VERSION_PATCH EQUAL 42)
set(PACKAGE_VERSION_EXACT 1)
endif()
endif()
// Boost version.hpp configuration header file
// ------------------------------//
// (C) Copyright John maddock 1999. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for documentation
#ifndef BOOST_VERSION_HPP
#define BOOST_VERSION_HPP
//
// Caution: this is the only Boost header that is guaranteed
// to change with every Boost release. Including this header
// will cause a recompile every time a new Boost version is
// used.
//
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 1070042
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// but as a *string* in the form "x_y[_z]" where x is the major version
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to
// link to.
#define BOOST_LIB_VERSION "1_70_42"
#endif
-- Found Boost: [^
]* \(found suitable version "1\.70\.42", minimum required is "1\.70"\) found components: date_time python37 mpi_python2 *
-- Boost_FOUND: TRUE
-- Boost_INCLUDE_DIRS: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/include
-- Boost_LIBRARY_DIRS: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib
-- Boost_LIBRARIES: boost::date_time;boost::python;boost::mpi_python
-- Boost_DATE_TIME_FOUND: 1
-- Boost_DATE_TIME_LIBRARY: boost::date_time
-- Boost_PYTHON37_FOUND: 1
-- Boost_PYTHON37_LIBRARY: boost::python
-- Boost_MPI_PYTHON2_FOUND: 1
-- Boost_MPI_PYTHON2_LIBRARY: boost::mpi_python
-- Boost_VERSION_MACRO: 1070042
-- Boost_VERSION_STRING: 1.70.42
-- Boost_VERSION: 1.70.42
-- Boost_LIB_VERSION: 1_70_42
-- Boost_MAJOR_VERSION: 1
-- Boost_MINOR_VERSION: 70
-- Boost_SUBMINOR_VERSION: 42
-- Boost_INCLUDE_DIR: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/include
-- Boost_DATE_TIME_LIBRARY_DEBUG: *
-- Boost_DATE_TIME_LIBRARY_RELEASE: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_date_time.a
-- Boost_PYTHON37_LIBRARY_DEBUG: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_python.a
-- Boost_PYTHON37_LIBRARY_RELEASE: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_python_release.a
-- Boost_MPI_PYTHON2_LIBRARY_DEBUG: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_mpi_python.a
-- Boost_MPI_PYTHON2_LIBRARY_RELEASE: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_mpi_python.a
# Use a (made up) modern style BoostConfig that defines all targets
# as boost::<component> with appropriate properties set
# No legacy variables defined in the BoostConfig
set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage_LowerCaseTargetPrefix)
include(${CMAKE_CURRENT_SOURCE_DIR}/LegacyVars.cmake)
# Use a (made up?) BoostConfig that defines all targets
# as Boost::<component> with appropriate properties set
# But no Boost::headers or Boost::boost target is defined
set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage_NoHeaderTarget)
include(${CMAKE_CURRENT_SOURCE_DIR}/LegacyVars.cmake)
-- Found Boost: [^
]* \(found suitable version "1\.70\.42", minimum required is "1\.70"\) found components: date_time python37 mpi_python2 *
-- Boost_FOUND: TRUE
-- Boost_INCLUDE_DIRS: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/include
-- Boost_LIBRARY_DIRS: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib
-- Boost_LIBRARIES: Boost::date_time;Boost::python;Boost::mpi_python
-- Boost_DATE_TIME_FOUND: 1
-- Boost_DATE_TIME_LIBRARY: Boost::date_time
-- Boost_PYTHON37_FOUND: 1
-- Boost_PYTHON37_LIBRARY: Boost::python
-- Boost_MPI_PYTHON2_FOUND: 1
-- Boost_MPI_PYTHON2_LIBRARY: Boost::mpi_python
-- Boost_VERSION_MACRO: 1070042
-- Boost_VERSION_STRING: 1.70.42
-- Boost_VERSION: 1.70.42
-- Boost_LIB_VERSION: 1_70_42
-- Boost_MAJOR_VERSION: 1
-- Boost_MINOR_VERSION: 70
-- Boost_SUBMINOR_VERSION: 42
-- Boost_INCLUDE_DIR: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/include
-- Boost_DATE_TIME_LIBRARY_DEBUG: *
-- Boost_DATE_TIME_LIBRARY_RELEASE: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_date_time.a
-- Boost_PYTHON37_LIBRARY_DEBUG: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_python.a
-- Boost_PYTHON37_LIBRARY_RELEASE: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_python_release.a
-- Boost_MPI_PYTHON2_LIBRARY_DEBUG: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_mpi_python.a
-- Boost_MPI_PYTHON2_LIBRARY_RELEASE: [^
]*/Tests/RunCMake/FindBoost/CMakePackage[^/]*/lib/libboost_mpi_python.a
# Use a modern style BoostConfig that defines all targets
# as Boost::<component> with appropriate properties set
# No legacy variables defined in the BoostConfig
set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage_New)
include(${CMAKE_CURRENT_SOURCE_DIR}/LegacyVars.cmake)
find_package(Boost 1.70 COMPONENTS date_time python37 mpi_python2)
foreach(var Boost_FOUND Boost_INCLUDE_DIRS Boost_LIBRARY_DIRS Boost_LIBRARIES
Boost_DATE_TIME_FOUND Boost_DATE_TIME_LIBRARY
Boost_PYTHON37_FOUND Boost_PYTHON37_LIBRARY
Boost_MPI_PYTHON2_FOUND Boost_MPI_PYTHON2_LIBRARY
Boost_VERSION_MACRO Boost_VERSION_STRING Boost_VERSION Boost_LIB_VERSION
Boost_MAJOR_VERSION Boost_MINOR_VERSION Boost_SUBMINOR_VERSION
)
message(STATUS "${var}: ${${var}}")
endforeach()
foreach(cachevar Boost_INCLUDE_DIR
Boost_DATE_TIME_LIBRARY_DEBUG Boost_DATE_TIME_LIBRARY_RELEASE
Boost_PYTHON37_LIBRARY_DEBUG Boost_PYTHON37_LIBRARY_RELEASE
Boost_MPI_PYTHON2_LIBRARY_DEBUG Boost_MPI_PYTHON2_LIBRARY_RELEASE
)
unset(${cachevar})
message(STATUS "${cachevar}: ${${cachevar}}")
endforeach()
foreach(lib Boost::headers Boost::date_time Boost::python Boost::mpi_python
Boost::boost Boost::diagnostic_definitions Boost::disable_autolinking Boost::dynamic_linking
)
if(NOT TARGET ${lib})
message(FATAL_ERROR "Missing target ${lib}")
endif()
endforeach()
-- Found Boost: [^
]* \(found suitable version "1\.70\.42", minimum required is "1\.70"\) found components: date_time *
-- Boost_FOUND: TRUE
-- Boost_INCLUDE_DIRS: [^
]*/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/include
-- Boost_LIBRARY_DIRS: *
-- Boost_LIBRARIES: [^
]*/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/lib/libboost_date_time.a
-- Boost_DATE_TIME_FOUND: 1
-- Boost_DATE_TIME_LIBRARY: [^
]*/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/lib/libboost_date_time.a
-- Boost_VERSION_MACRO: 1070042
-- Boost_VERSION_STRING: 1.70.42
-- Boost_VERSION: 1.70.42
-- Boost_LIB_VERSION: 1_70_42
-- Boost_MAJOR_VERSION: 1
-- Boost_MINOR_VERSION: 70
-- Boost_SUBMINOR_VERSION: 42
-- Boost_INCLUDE_DIR: [^
]*/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/include
-- Boost_DATE_TIME_LIBRARY_DEBUG: *
-- Boost_DATE_TIME_LIBRARY_RELEASE: *
set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage_MissingTarget)
find_package(Boost 1.70 COMPONENTS date_time)
foreach(var Boost_FOUND Boost_INCLUDE_DIRS Boost_LIBRARY_DIRS Boost_LIBRARIES
Boost_DATE_TIME_FOUND Boost_DATE_TIME_LIBRARY
Boost_VERSION_MACRO Boost_VERSION_STRING Boost_VERSION Boost_LIB_VERSION
Boost_MAJOR_VERSION Boost_MINOR_VERSION Boost_SUBMINOR_VERSION
)
message(STATUS "${var}: ${${var}}")
endforeach()
foreach(cachevar Boost_INCLUDE_DIR
Boost_DATE_TIME_LIBRARY_DEBUG Boost_DATE_TIME_LIBRARY_RELEASE
)
unset(${cachevar})
message(STATUS "${cachevar}: ${${cachevar}}")
endforeach()
foreach(lib Boost::headers
Boost::boost Boost::diagnostic_definitions Boost::disable_autolinking Boost::dynamic_linking
)
if(NOT TARGET ${lib})
message(FATAL_ERROR "Missing target ${lib}")
endif()
endforeach()
......@@ -4,6 +4,14 @@ unset(ENV{Boost_ROOT})
run_cmake(CMakePackage)
run_cmake(NoCXX)
run_cmake(LegacyVars-TargetsDefined) # "Good" BoostConfig
run_cmake(LegacyVars-LowercaseTargetPrefix)
set(RunCMake-stdout-file LegacyVars-TargetsDefined-stdout.txt)
run_cmake(LegacyVars-NoHeaderTarget)
unset(RunCMake-stdout-file)
run_cmake(MissingTarget)
set(RunCMake-stdout-file CommonResults-stdout.txt)
run_cmake(ConfigMode)
run_cmake(ModuleMode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment