Deal with Qt5 and Boost imported targets, when CGAL is imported

When CGAL_Qt5 or CGAL_Core targets are imported, then we need to call
`find_package(Qt5)` and `find_package(Boost)` to re-import the
targets of Qt5 or `Boost::thread`.

Otherwise, there is that CMake warning:

    CMake Warning (dev) at /mnt/testsuite/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake:49 (add_executable):
      Policy CMP0028 is not set: Double colon in target name means ALIAS or
      IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
      Use the cmake_policy command to set the policy and suppress this warning.

      Target "test_Min_circle" links to target "Boost::thread" but the target was
      not found.  Perhaps a find_package() call is missing for an IMPORTED
      target, or an ALIAS target is missing?
    Call Stack (most recent call first):
      CMakeLists.txt:22 (create_single_source_cgal_program)
    This warning is for project developers.  Use -Wno-dev to suppress it.

and then that link error:

    /usr/bin/ld: cannot find -lBoost::thread

Ref:
  https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-4.12-Ic-200/Bounding_volumes/TestReport_lrineau_Fedora-Release.gz
This commit is contained in:
Laurent Rineau 2018-03-16 11:41:56 +01:00
parent 9708c41ad1
commit 471e7a93be
1 changed files with 15 additions and 0 deletions

View File

@ -287,6 +287,21 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
add_to_list( CGAL_3RD_PARTY_DEFINITIONS ${CGAL_${component}_3RD_PARTY_DEFINITIONS} )
add_to_list( CGAL_3RD_PARTY_LIBRARIES_DIRS ${CGAL_${component}_3RD_PARTY_LIBRARIES_DIRS} )
# To deal with imported targets of Qt5 and Boost, when CGAL
# targets are themselves imported by another project.
if(NOT CGAL_BUILDING_LIBS)
if (NOT MSVC AND "${component}" STREQUAL "Core")
# See the release notes of CGAL-4.10: CGAL_Core now requires
# Boost.Thread, with all compilers but MSVC.
find_package( Boost 1.48 REQUIRED thread system )
add_to_list( CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES} )
endif()
if (${component} STREQUAL "Qt5")
find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
endif()
endif()
else(WITH_CGAL_${component})
# now we are talking about 3rd party libs