cmake_minimum_required(VERSION 3.15) include(FetchContent) FetchContent_Declare( libQGLViewer URL http://www.libqglviewer.com/src/libQGLViewer-2.7.2.tar.gz URL_HASH MD5=a9d965d1ce41f7db6b34f440bb74f061 CONFIGURE_COMMAND "qmake ${CMAKE_CURRENT_SOURCE_DIR}/QGLViewer/QGLViewer.pro" STEP_TARGETS build # BUILD_BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/QGLViewer/libQGLViewer-qt5.so LOG_DOWNLOAD true LOG_CONFIGURE true LOG_BUILD true LOG_INSTALL true) ExternalProject_Get_property(libQGLViewer_ep SOURCE_DIR) message("libqglviewer_ep src dir: ${SOURCE_DIR}") ExternalProject_Get_property(libQGLViewer_ep CONFIGURE_COMMAND) message("libqglviewer_ep configure command: ${CONFIGURE_COMMAND}") # ExternalProject_Get_property(libQGLViewer_ep BUILD_BYPRODUCTS) # message("libqglviewer_ep build byproducts: ${BUILD_BYPRODUCTS}") set(QGLVIEWER_INCLUDE_DIR $ $ CACHE PATH "") # # Can't use find_library as the library isn't there at config time # find_library(QGLVIEWER_LIBRARIES # NAMES qglviewer-qt4 qglviewer QGLViewer QGLViewer2 QGLViewer-qt5 # PATHS ${SOURCE_DIR} # PATH_SUFFIXES QGLViewer QGLViewer/release) set(QGLVIEWER_LIBRARIES $ $ CACHE FILEPATH "") add_library(libQGLViewer INTERFACE) target_link_libraries(libQGLViewer INTERFACE ${QGLVIEWER_LIBRARIES}) add_dependencies(libQGLViewer libQGLViewer_ep-build) target_include_directories(libQGLViewer INTERFACE ${QGLVIEWER_INCLUDE_DIR})