Skip to content

cmake package autogeneration enabled & little findQwt.cmake fix #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
########################################################################
# Project setup
########################################################################
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
CMAKE_MINIMUM_REQUIRED (VERSION 3.15)
PROJECT (srsGUI)
ENABLE_TESTING()
LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
Expand Down Expand Up @@ -113,3 +113,18 @@ ENDMACRO(SG_SET_PIC)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)


########################################################################
# Add the exports
########################################################################
include("CMakePackageConfigHelpers")
install(EXPORT "srsguiTargets" FILE "srsguiTargets.cmake" NAMESPACE "srsgui::" DESTINATION "${LIBRARY_DIR}/cmake/srsgui")

target_include_directories("srsgui" PUBLIC "$<INSTALL_INTERFACE:include>")

write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/srsguiConfigVersion.cmake" VERSION "2.0" COMPATIBILITY AnyNewerVersion)
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/srsguiConfig.cmake" INSTALL_DESTINATION "${LIBRARY_DIR}/cmake/srsgui")

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/srsguiConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/srsguiConfigVersion.cmake" DESTINATION "${LIBRARY_DIR}/cmake/srsgui")
export(EXPORT "srsguiTargets" FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/srsguiTargets.cmake" NAMESPACE "srsgui::")
7 changes: 7 additions & 0 deletions Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@PACKAGE_INIT@

find_package(Qt5 COMPONENTS Widgets REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/srsguiTargets.cmake")

check_required_components(srsgui)
2 changes: 1 addition & 1 deletion cmake/modules/FindQwt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ IF (QWT_LIBRARY)

ELSE(WIN32 AND NOT CYGWIN)

SET(QWT_LIBRARIES ${QWT_LIBRARY} CACHE DOC "QWT library files")
SET(QWT_LIBRARIES ${QWT_LIBRARY} CACHE STRING "QWT library files")

ENDIF(WIN32 AND NOT CYGWIN)

Expand Down
1 change: 1 addition & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Install headers
########################################################################
INSTALL(DIRECTORY srsgui
EXPORT "srsguiTargets"
DESTINATION "${INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
Expand Down
20 changes: 8 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
find_package(Qt5 COMPONENTS Widgets REQUIRED)

FIND_PACKAGE(Qwt)
IF(Qt5_FOUND AND QWT_FOUND)
INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIRS})
ENDIF(Qt5_FOUND AND QWT_FOUND)


########################################################################
# Build the graphics library
########################################################################
Expand Down Expand Up @@ -40,11 +37,14 @@ IF(Qt5_FOUND AND QWT_FOUND AND QWT_MAJOR_VERSION EQUAL 6)
QT5_WRAP_CPP(textedit textedit/TextEditWidget.h textedit/TextEditWrapper.h)
QT5_WRAP_CPP(keyvalue keyvalue/KeyValueWidget.h keyvalue/KeyValueWrapper.h)

INCLUDE_DIRECTORIES(common complexplot realplot scatterplot waterfallplot textedit keyvalue ${Boost_INCLUDE_DIRS})

ADD_LIBRARY(srsgui SHARED ${eventwraps} ${lineplotwraps} ${pointplotwraps} ${spectrogramplotwraps} ${complex} ${real} ${scatter} ${waterfall} ${textedit} ${keyvalue} ${SOURCES_ALL} )
TARGET_LINK_LIBRARIES(srsgui pthread Qt5::Widgets ${QWT_LIBRARIES})
INSTALL(TARGETS srsgui DESTINATION ${LIBRARY_DIR})
INSTALL(TARGETS srsgui EXPORT "srsguiTargets" DESTINATION ${LIBRARY_DIR})

TARGET_LINK_LIBRARIES(srsgui PRIVATE pthread)
TARGET_LINK_LIBRARIES(srsgui PUBLIC Qt5::Widgets ${QWT_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES("srsgui" PUBLIC ${QWT_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES("srsgui" PRIVATE common complexplot realplot scatterplot waterfallplot textedit keyvalue ${Boost_INCLUDE_DIRS})

SG_SET_PIC(srsgui)

MESSAGE(STATUS " srsGUI library will be installed.")
Expand All @@ -54,7 +54,3 @@ ELSE(Qt5_FOUND AND QWT_FOUND AND AND QWT_MAJOR_VERSION EQUAL 6)
MESSAGE(STATUS " QT5 or Qwt6 not found. srsGUI library is not generated")

ENDIF(Qt5_FOUND AND QWT_FOUND AND QWT_MAJOR_VERSION EQUAL 6)