diff options
author | Brad King <brad.king@kitware.com> | 2019-06-18 12:37:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-18 12:37:52 (GMT) |
commit | 65fc109dc62ef4853c010e06a938069e0bfc8c50 (patch) | |
tree | 8ff2b87c449b11647f3d3e7b2cfe4d6cee8549a4 /Tests | |
parent | e2b4fa114184a0a8eeec9c8005e09f70a8ae6832 (diff) | |
parent | 830b332f32ac0782fe3380eb7b0b55fa8f81f456 (diff) | |
download | CMake-65fc109dc62ef4853c010e06a938069e0bfc8c50.zip CMake-65fc109dc62ef4853c010e06a938069e0bfc8c50.tar.gz CMake-65fc109dc62ef4853c010e06a938069e0bfc8c50.tar.bz2 |
Merge branch 'FindBoost-component' into release-3.15
Merge-request: !3438
Diffstat (limited to 'Tests')
27 files changed, 419 insertions, 0 deletions
diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt index 39e92c1..f60ccfa 100644 --- a/Tests/FindBoost/Test/CMakeLists.txt +++ b/Tests/FindBoost/Test/CMakeLists.txt @@ -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) diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake index d13bbf3..36a9abd 100644 --- a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake +++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake @@ -1 +1,4 @@ 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) diff --git a/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/BoostConfig.cmake new file mode 100644 index 0000000..cf13b4a --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/BoostConfig.cmake @@ -0,0 +1,26 @@ +# 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" + ) diff --git a/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/BoostConfigVersion.cmake new file mode 100644 index 0000000..b4b6060 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/BoostConfigVersion.cmake @@ -0,0 +1,7 @@ +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() diff --git a/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/include/boost/version.hpp b/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/include/boost/version.hpp new file mode 100644 index 0000000..fe8e72c --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_LowerCaseTargetPrefix/include/boost/version.hpp @@ -0,0 +1,34 @@ +// 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 diff --git a/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/BoostConfig.cmake new file mode 100644 index 0000000..97d4c79 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/BoostConfig.cmake @@ -0,0 +1,7 @@ +# 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}) diff --git a/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/BoostConfigVersion.cmake new file mode 100644 index 0000000..b4b6060 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/BoostConfigVersion.cmake @@ -0,0 +1,7 @@ +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() diff --git a/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/include/boost/version.hpp b/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/include/boost/version.hpp new file mode 100644 index 0000000..fe8e72c --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_MissingTarget/include/boost/version.hpp @@ -0,0 +1,34 @@ +// 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 diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake new file mode 100644 index 0000000..3a88f26 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake @@ -0,0 +1,24 @@ +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" + ) diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfigVersion.cmake new file mode 100644 index 0000000..b4b6060 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfigVersion.cmake @@ -0,0 +1,7 @@ +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() diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/include/boost/version.hpp b/Tests/RunCMake/FindBoost/CMakePackage_New/include/boost/version.hpp new file mode 100644 index 0000000..fe8e72c --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/include/boost/version.hpp @@ -0,0 +1,34 @@ +// 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 diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_date_time.a b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_date_time.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_date_time.a diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_mpi_python.a b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_mpi_python.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_mpi_python.a diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_python.a b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_python.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_python.a diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_python_release.a b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_python_release.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/lib/libboost_python_release.a diff --git a/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/BoostConfig.cmake new file mode 100644 index 0000000..ba2269a --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/BoostConfig.cmake @@ -0,0 +1,25 @@ +# 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" + ) diff --git a/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/BoostConfigVersion.cmake new file mode 100644 index 0000000..b4b6060 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/BoostConfigVersion.cmake @@ -0,0 +1,7 @@ +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() diff --git a/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/include/boost/version.hpp b/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/include/boost/version.hpp new file mode 100644 index 0000000..fe8e72c --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage_NoHeaderTarget/include/boost/version.hpp @@ -0,0 +1,34 @@ +// 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 diff --git a/Tests/RunCMake/FindBoost/LegacyVars-LowercaseTargetPrefix-stdout.txt b/Tests/RunCMake/FindBoost/LegacyVars-LowercaseTargetPrefix-stdout.txt new file mode 100644 index 0000000..a781dce --- /dev/null +++ b/Tests/RunCMake/FindBoost/LegacyVars-LowercaseTargetPrefix-stdout.txt @@ -0,0 +1,34 @@ +-- 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 diff --git a/Tests/RunCMake/FindBoost/LegacyVars-LowercaseTargetPrefix.cmake b/Tests/RunCMake/FindBoost/LegacyVars-LowercaseTargetPrefix.cmake new file mode 100644 index 0000000..a398c2d --- /dev/null +++ b/Tests/RunCMake/FindBoost/LegacyVars-LowercaseTargetPrefix.cmake @@ -0,0 +1,6 @@ +# 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) diff --git a/Tests/RunCMake/FindBoost/LegacyVars-NoHeaderTarget.cmake b/Tests/RunCMake/FindBoost/LegacyVars-NoHeaderTarget.cmake new file mode 100644 index 0000000..edb6dda --- /dev/null +++ b/Tests/RunCMake/FindBoost/LegacyVars-NoHeaderTarget.cmake @@ -0,0 +1,6 @@ +# 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) diff --git a/Tests/RunCMake/FindBoost/LegacyVars-TargetsDefined-stdout.txt b/Tests/RunCMake/FindBoost/LegacyVars-TargetsDefined-stdout.txt new file mode 100644 index 0000000..a4e9c6a --- /dev/null +++ b/Tests/RunCMake/FindBoost/LegacyVars-TargetsDefined-stdout.txt @@ -0,0 +1,34 @@ +-- 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 diff --git a/Tests/RunCMake/FindBoost/LegacyVars-TargetsDefined.cmake b/Tests/RunCMake/FindBoost/LegacyVars-TargetsDefined.cmake new file mode 100644 index 0000000..19ad49f --- /dev/null +++ b/Tests/RunCMake/FindBoost/LegacyVars-TargetsDefined.cmake @@ -0,0 +1,6 @@ +# 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) diff --git a/Tests/RunCMake/FindBoost/LegacyVars.cmake b/Tests/RunCMake/FindBoost/LegacyVars.cmake new file mode 100644 index 0000000..d0d5ee0 --- /dev/null +++ b/Tests/RunCMake/FindBoost/LegacyVars.cmake @@ -0,0 +1,28 @@ +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() diff --git a/Tests/RunCMake/FindBoost/MissingTarget-stdout.txt b/Tests/RunCMake/FindBoost/MissingTarget-stdout.txt new file mode 100644 index 0000000..8e9d684 --- /dev/null +++ b/Tests/RunCMake/FindBoost/MissingTarget-stdout.txt @@ -0,0 +1,22 @@ +-- 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: * diff --git a/Tests/RunCMake/FindBoost/MissingTarget.cmake b/Tests/RunCMake/FindBoost/MissingTarget.cmake new file mode 100644 index 0000000..581e006 --- /dev/null +++ b/Tests/RunCMake/FindBoost/MissingTarget.cmake @@ -0,0 +1,25 @@ +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() diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake index 3916890..851a996 100644 --- a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake @@ -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) |