# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2015-05-04 18:14:28 # Node ID 8af772ace5565f2e789990ad0d375bd463b6a922 # Parent 70f83253cf6c882f6fa003eb445bcb83cb839b8b add option for static linking of qwt diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,18 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PAT # Find the QtWidgets library find_package(Qt5Widgets) -find_package(Qwt 6.1 REQUIRED) + +# Find QWT or use static +set(QWT_USE_STATIC false CACHE BOOL "Use a static version of Qwt provided by user.") +set(QWT_STATIC_LIBRARY "" CACHE FILEPATH "Path to the static Qwt library, libqwt.a.") +set(QWT_STATIC_INCLUDE "" CACHE PATH "Path to the Qwt include directory when building Qwt static.") + +if (QWT_USE_STATIC) + set(QWT_LIBRARY ${QWT_STATIC_LIBRARY}) + set(QWT_INCLUDE_DIR ${QWT_STATIC_INCLUDE}) +else (QWT_USE_STATIC) + find_package(Qwt 6.1 REQUIRED) +endif (QWT_USE_STATIC) # includes include_directories(${QWT_INCLUDE_DIR}) @@ -44,8 +55,8 @@ qt5_wrap_ui(UI_FILES mainwindow.ui about add_executable(serialplot main.cpp mainwindow.cpp customcheckablebutton.cpp ${UI_FILES}) # Use the Widgets module from Qt 5. -qt5_use_modules(serialplot Widgets SerialPort) target_link_libraries(serialplot ${QWT_LIBRARY}) +qt5_use_modules(serialplot Widgets SerialPort Svg) # Enable C++11 support, fail if not supported include(CheckCXXCompilerFlag) @@ -64,4 +75,4 @@ add_custom_target(run COMMAND serialplot DEPENDS serialplot WORKING_DIRECTORY ${CMAKE_PROJECT_DIR} -) \ No newline at end of file +)