find/FindQwt.cmake

42 lines
1.1 KiB
CMake
Raw Normal View History

2023-10-12 08:05:27 +00:00
set(QWT_PREFIX "" CACHE PATH "The path to the prefix of an Qwt installation")
find_path(QWT_INCLUDE_DIR NAMES qwt.h
PATHS
${QWT_PREFIX}/include
/opt/local/include
/usr/include
/usr/local/include
PATH_SUFFIXES qwt-qt5 qwt qwt6
)
find_library(QWT_LIBRARIES NAMES qwt-qt5 qwt6-qt5 qwt qwt6
PATHS
${QWT_PREFIX}/lib
/opt/local/lib
/usr/lib
/usr/local/lib
)
if(QWT_INCLUDE_DIR AND QWT_LIBRARIES AND NOT TARGET Qwt::Qwt)
get_filename_component(QWT_LIBRARY_DIR ${QWT_LIBRARIES} PATH)
set(QWT_FOUND TRUE)
add_library(Qwt::Qwt INTERFACE IMPORTED)
set_target_properties(Qwt::Qwt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${QWT_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${QWT_LIBRARIES}"
)
endif()
if(QWT_FOUND)
file(READ ${QWT_INCLUDE_DIR}/qwt_global.h qwt_header)
string(REGEX REPLACE "^.*QWT_VERSION_STR +\"([^\"]+)\".*$" "\\1" QWT_VERSION_STR "${qwt_header}")
if(NOT QWT_FIND_QUIETLY)
message(STATUS "Found Qwt: ${QWT_LIBRARY} (${QWT_VERSION_STR})")
endif(NOT QWT_FIND_QUIETLY)
else(QWT_FOUND)
if(QWT_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Qwt")
endif(QWT_FIND_REQUIRED)
endif(QWT_FOUND)