Skip to content

Commit

Permalink
Fix: Find Qt5 (if enabled) in ElementalConfig.cmake
Browse files Browse the repository at this point in the history
If Qt5 has been enabled during build, then e.g. target Qt5::Widgets is exported
as a install dependency via ElementalTargets.cmake. Thus ElementalConfig.cmake
must find Qt5 and import these Qt5 targets or else the user will get errors like:

CMake Error at CMakeLists.txt:... (add_executable):
  Target "..." links to target "Qt5::Widgets" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
  • Loading branch information
JM1 committed Apr 10, 2019
1 parent de7b5be commit 2459ef5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmake/configure_files/ElementalConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ IF(@MPC_FOUND@)
set(Elemental_INCLUDE_DIRS "${Elemental_INCLUDE_DIRS};@MPFR_INCLUDES@")
set(Elemental_INCLUDE_DIRS "${Elemental_INCLUDE_DIRS};@GMP_INCLUDES@")
ENDIF()
set(Elemental_INCLUDE_DIRS
"${Elemental_INCLUDE_DIRS};@Qt5Widgets_INCLUDE_DIRS@")

IF(@EL_HAVE_QT5@)
include(CMakeFindDependencyMacro)
set(QT_USE_IMPORTED_TARGETS TRUE)
find_dependency(Qt5Widgets)
set(Elemental_INCLUDE_DIRS
"${Elemental_INCLUDE_DIRS};@Qt5Widgets_INCLUDE_DIRS@")
ENDIF()

set(Elemental_COMPILE_FLAGS "@CXX_FLAGS@")
set(Elemental_LINK_FLAGS "@EL_LINK_FLAGS@")

set(Elemental_DEFINITIONS "@Qt5Widgets_DEFINITIONS@")
IF(@EL_HAVE_QT5@)
set(Elemental_DEFINITIONS "@Qt5Widgets_DEFINITIONS@")
ENDIF()

# Our library dependencies (contains definitions for IMPORTED targets)
include("${CMAKE_CURRENT_LIST_DIR}/ElementalTargets.cmake")
Expand Down

0 comments on commit 2459ef5

Please sign in to comment.