diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,14 +17,10 @@ option(BUILD_SHARED_LIBS "Build a shared module" ON) option(DESKTOP_ENABLED "Build and install The Desktop style" ON) -option(STATIC_LIBRARY "Build as a static library (deprecated, use BUILD_SHARED_LIBS instead)" OFF) option(BUILD_EXAMPLES "Build and install examples" OFF) option(DISABLE_DBUS "Build without D-Bus support" OFF) - -if(NOT BUILD_SHARED_LIBS) - set(STATIC_LIBRARY 1) -elseif(STATIC_LIBRARY) - set(BUILD_SHARED_LIBS 0) +if(DEFINED STATIC_LIBRARY) + message(FATAL_ERROR "Use the BUILD_SHARED_LIBS=OFF option to build a static library, STATIC_LIBRARY is no longer a supported option") endif() # Make CPack available to easy generate binary packages @@ -40,11 +36,11 @@ set(AUTOMOC_MOC_OPTIONS -Muri=org.kde.kirigami) set(CMAKE_INCLUDE_CURRENT_DIR ON) -if(STATIC_LIBRARY) +if(NOT BUILD_SHARED_LIBS) add_definitions(-DKIRIGAMI_BUILD_TYPE_STATIC) add_definitions(-DQT_PLUGIN) add_definitions(-DQT_STATICPLUGIN=1) -endif(STATIC_LIBRARY) +endif() ################# set KDE specific information ################# @@ -120,11 +116,11 @@ add_subdirectory(templates) endif() -if (BUILD_EXAMPLES AND NOT STATIC_LIBRARY) +if (BUILD_EXAMPLES AND BUILD_SHARED_LIBS) add_subdirectory(examples) endif() -if (BUILD_TESTING AND NOT STATIC_LIBRARY) +if (BUILD_TESTING AND BUILD_SHARED_LIBS) add_subdirectory(autotests) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ project(kirigami) -if (NOT STATIC_LIBRARY) +if (BUILD_SHARED_LIBS) ecm_create_qm_loader(kirigami_QM_LOADER libkirigami2plugin_qt) else() set(KIRIGAMI_STATIC_FILES @@ -41,7 +41,7 @@ add_subdirectory(libkirigami) -if(STATIC_LIBRARY) +if(NOT BUILD_SHARED_LIBS) # `rcc` is a bit dumb and isn't designed to use auto generated files, to # avoid poluting the source directory, use absolute paths set(kirigami_QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../) @@ -63,22 +63,22 @@ if (UNIX AND NOT ANDROID AND NOT(APPLE) AND NOT(DISABLE_DBUS)) qt5_add_dbus_interface(kirigami_SRCS libkirigami/org.kde.KWin.TabletModeManager.xml tabletmodemanager_interface) endif() -endif(STATIC_LIBRARY) +endif() add_library(kirigamiplugin ${kirigami_SRCS} ${RESOURCES} ${SHADERS}) -if(STATIC_LIBRARY) +if(NOT BUILD_SHARED_LIBS) SET_TARGET_PROPERTIES(kirigamiplugin PROPERTIES AUTOMOC_MOC_OPTIONS -Muri=org.kde.kirigami) if (UNIX AND NOT ANDROID AND NOT(APPLE) AND NOT(DISABLE_DBUS)) set(Kirigami_EXTRA_LIBS Qt5::DBus) else() set(Kirigami_EXTRA_LIBS "") endif() -else(STATIC_LIBRARY) +else() set(Kirigami_EXTRA_LIBS KF5::Kirigami2) -endif(STATIC_LIBRARY) +endif() target_link_libraries(kirigamiplugin @@ -88,7 +88,7 @@ ${Kirigami_EXTRA_LIBS} Qt5::Qml Qt5::Quick Qt5::QuickControls2 ) -if (NOT STATIC_LIBRARY) +if (BUILD_SHARED_LIBS) add_custom_target(copy_to_bin ALL COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/org/kde/kirigami.2/ @@ -114,6 +114,6 @@ install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) -endif(NOT STATIC_LIBRARY) +endif() install(TARGETS kirigamiplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2)