forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: support find_package(QtAV) wang-bin#795
Currently only FindQtAV.cmake works, i.e. "Module" mode. In "Config" mode, QTAV_INCLUDE_DIRS and QTAV_LIBRARIES are empty. To use FindQtAV.cmake, you have to append it's dir to CMAKE_MODULE_PATH try simpleplayer example after qtav make install TODO: module mode. auto insert dependencies
- Loading branch information
Showing
5 changed files
with
143 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,49 @@ | ||
|
||
find_package(Qt5 QUIET REQUIRED NO_MODULE COMPONENTS Core) | ||
|
||
get_target_property(qmake Qt5::qmake LOCATION) | ||
execute_process( | ||
COMMAND ${qmake} -query QT_INSTALL_HEADERS | ||
OUTPUT_VARIABLE QT_INSTALL_HEADERS | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
execute_process( | ||
COMMAND ${qmake} -query QT_INSTALL_LIBS | ||
OUTPUT_VARIABLE QT_INSTALL_LIBS | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
find_path(QTAV_INCLUDE_DIR NAMES QtAV.h | ||
HINTS ${QT_INSTALL_HEADERS} | ||
PATH_SUFFIXES QtAV | ||
) | ||
find_library(QTAV_LIBRARY NAMES QtAV QtAV1 | ||
HINTS ${QT_INSTALL_LIBS} | ||
) | ||
|
||
find_path(QTAVWIDGETS_INCLUDE_DIR NAMES QtAVWidgets.h | ||
HINTS ${QT_INSTALL_HEADERS} | ||
PATH_SUFFIXES QtAVWidgets | ||
) | ||
find_library(QTAVWIDGETS_LIBRARY NAMES QtAVWidgets QtAVWidgets1 | ||
HINTS ${QT_INSTALL_LIBS} | ||
) | ||
|
||
set(QTAV_INCLUDE_DIRS ${QTAV_INCLUDE_DIR} ${QTAV_INCLUDE_DIR}/..) | ||
set(QTAV_LIBRARIES ${QTAV_LIBRARY}) | ||
if(NOT QTAVWIDGETS_INCLUDE_DIR MATCHES "QTAVWIDGETS_INCLUDE_DIR-NOTFOUND") | ||
set(QTAVWIDGETS_INCLUDE_DIRS ${QTAVWIDGETS_INCLUDE_DIR} ${QTAVWIDGETS_INCLUDE_DIR}/.. ${QTAV_INCLUDE_DIRS}) | ||
endif() | ||
if(NOT QTAV_LIBRARIES MATCHES "QTAV_LIBRARIES-NOTFOUND") | ||
set(QTAVWIDGETS_LIBRARIES ${QTAVWIDGETS_LIBRARY} ${QTAV_LIBRARY}) | ||
endif() | ||
|
||
find_package(PackageHandleStandardArgs REQUIRED) | ||
find_package_handle_standard_args(QtAV REQUIRED_VARS QTAV_LIBRARIES QTAV_INCLUDE_DIRS) | ||
mark_as_advanced(QTAV_INCLUDE_DIRS QTAV_LIBRARIES QTAVWIDGETS_INCLUDE_DIRS QTAVWIDGETS_LIBRARIES) | ||
|
||
message("QtAV_FOUND = ${QTAV_FOUND}") | ||
message("QTAV_INCLUDE_DIRS = ${QTAV_INCLUDE_DIRS}") | ||
message("QTAV_LIBRARIES = ${QTAV_LIBRARIES}") | ||
message("QTAVWIDGETS_INCLUDE_DIRS = ${QTAVWIDGETS_INCLUDE_DIRS}") | ||
message("QTAVWIDGETS_LIBRARIES = ${QTAVWIDGETS_LIBRARIES}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,8 @@ | ||
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR) | ||
find_package(QtAV REQUIRED) | ||
find_package(Qt5Widgets REQUIRED) | ||
set(CMAKE_AUTOMOC ON) | ||
|
||
add_executable(simpleplayer main.cpp playerwindow.cpp playerwindow.h) | ||
target_include_directories(simpleplayer PRIVATE ${QTAVWIDGETS_INCLUDE_DIRS}) | ||
target_link_libraries(simpleplayer ${QTAVWIDGETS_LIBRARIES} Qt5::Widgets) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters