diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 9e6083db2..38ccf78ec 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1573,7 +1573,7 @@ endif() # Add imported targets # ------------------------------------------------------------------------ -if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) +if(Boost_FOUND) # For header-only libraries if(NOT TARGET Boost::boost) add_library(Boost::boost INTERFACE IMPORTED) @@ -1584,7 +1584,7 @@ if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) endif() foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - if(NOT TARGET Boost::${COMPONENT}) + if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) if(Boost_${UPPERCOMPONENT}_FOUND) if(Boost_USE_STATIC_LIBS) diff --git a/Tests/CFBundleTest/Localized.rsrc b/Tests/CFBundleTest/Localized.rsrc index cbf35235b..7973c1fbf 100644 Binary files a/Tests/CFBundleTest/Localized.rsrc and b/Tests/CFBundleTest/Localized.rsrc differ diff --git a/Tests/FindBoost/CMakeLists.txt b/Tests/FindBoost/CMakeLists.txt index 259ee266f..0e9527de0 100644 --- a/Tests/FindBoost/CMakeLists.txt +++ b/Tests/FindBoost/CMakeLists.txt @@ -8,3 +8,14 @@ add_test(NAME FindBoost.Test COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + +add_test(NAME FindBoost.TestHeaders COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBoost/TestHeaders" + "${CMake_BINARY_DIR}/Tests/FindBoost/TestHeaders" + ${build_generator_args} + --build-project TestFindBoostHeaders + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindBoost/TestHeaders/CMakeLists.txt b/Tests/FindBoost/TestHeaders/CMakeLists.txt new file mode 100644 index 000000000..d7be32703 --- /dev/null +++ b/Tests/FindBoost/TestHeaders/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindBoostHeaders CXX) +include(CTest) + +find_package(Boost REQUIRED) + +add_executable(test_boost_headers_tgt main.cxx) +target_link_libraries(test_boost_headers_tgt + Boost::boost) +add_test(NAME test_boost_headers_tgt COMMAND test_boost_headers_tgt) diff --git a/Tests/FindBoost/TestHeaders/main.cxx b/Tests/FindBoost/TestHeaders/main.cxx new file mode 100644 index 000000000..0400d6dc9 --- /dev/null +++ b/Tests/FindBoost/TestHeaders/main.cxx @@ -0,0 +1,9 @@ +#include + +int main() { + boost::any a; + a = 5; + a = std::string("A string"); + + return 0; +}