diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(QtCurve) include(FeatureSummary) +include(CMakeDependentOption) ## Temporary function(translate_add_sources) @@ -31,47 +32,28 @@ "${GIT_EXECUTABLE}" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/version.cpp") -## Options -function(qtc_option name doc def_val) - if(DEFINED "${name}") - set("${name}_DEFINED" On PARENT_SCOPE) - option("${name}" "${doc}" On) - else() - set("${name}_DEFINED" Off PARENT_SCOPE) - option("${name}" "${doc}" "${def_val}") - endif() -endfunction() function(qtc_variable name doc def_val) if(DEFINED "${name}") set("${name}_DEFINED" On PARENT_SCOPE) else() set("${name}_DEFINED" Off PARENT_SCOPE) set("${name}" "${def_val}" PARENT_SCOPE) endif() endfunction() -qtc_option(ENABLE_QT4 "Building Qt4 theme." On) -qtc_option(ENABLE_QT5 "Building Qt5 theme." On) -qtc_option(ENABLE_GTK2 "Building Gtk2 theme." On) +option(ENABLE_QT4 "Building Qt4 theme." ON) +option(ENABLE_QT5 "Building Qt5 theme." ON) +option(ENABLE_GTK2 "Building Gtk2 theme." ON) # option(ENABLE_GTK3 "Building Gtk3 theme." On) option(ENABLE_TEST "Enable testing." On) option(QTC_ENABLE_X11 "Enable X11" On) option(QTC_INSTALL_PO "Install translation files." On) -if(ENABLE_QT4) - qtc_option(QTC_QT4_ENABLE_KDE "Building Qt4 style with KDE4 support." On) -else() - qtc_option(QTC_QT4_ENABLE_KDE "Building Qt4 style with KDE4 support." Off) -endif() -if(ENABLE_QT5) - qtc_option(QTC_QT5_ENABLE_KDE - "Building Qt5 style with KDE Frameworks 5 support." On) -else() - qtc_option(QTC_QT5_ENABLE_KDE - "Building Qt5 style with KDE Frameworks 5 support." Off) -endif() +cmake_dependent_option(QTC_QT4_ENABLE_KDE "Building Qt4 style with KDE4 support." ON + "ENABLE_QT4" OFF) +cmake_dependent_option(QTC_QT5_ENABLE_KDE "Building Qt4 style with KDE Frameworks 5 support." ON + "ENABLE_QT5" OFF) -option(QTC_QT4_STYLE_SUPPORT - "Qt4 support for creating a style for each QtCurve theme." Off) +cmake_dependent_option(QTC_QT4_STYLE_SUPPORT "Qt4 support for creating a style for each QtCurve theme." OFF "ENABLE_QT4" OFF) ## Common settings. # support an infix argument to have different qtcurve-utils libraries, e.g. for diff --git a/qt4/CMakeLists.txt b/qt4/CMakeLists.txt --- a/qt4/CMakeLists.txt +++ b/qt4/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ENABLE_QT4 AND NOT ENABLE_QT4_DEFINED) +if(ENABLE_QT4) # ENABLE_QT4 is not defined on the command line find_package(Qt4 4.6.0) if(NOT Qt4_FOUND AND NOT QT4_FOUND) diff --git a/qt5/CMakeLists.txt b/qt5/CMakeLists.txt --- a/qt5/CMakeLists.txt +++ b/qt5/CMakeLists.txt @@ -7,9 +7,8 @@ set(QTC_QT5_MODULES ${QTC_QT5_MODULES} Qt5PrintSupport) endif() -if(ENABLE_QT5 AND NOT ENABLE_QT5_DEFINED) +if(ENABLE_QT5) set(QT_MIN_VERSION "5.3.2") - # ENABLE_QT5 is not defined on the command line foreach(QtModule ${QTC_QT5_MODULES}) find_package(${QtModule} ${QT_MIN_VERSION} CONFIG) if(NOT ${QtModule}_FOUND)