From b5c64cce8e7813090809a3e4de8f88e148f84392 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Mon, 6 Aug 2018 23:19:52 +0200 Subject: [PATCH] cmake: Set -DHAVE_UMASK only where it's needed Avoid setting this define globally when it's only used in two files. --- CMakeLists.txt | 19 ++++--------------- src/core/CMakeLists.txt | 4 ++++ src/core/oidentdconfiggenerator.cpp | 5 +++++ src/core/oidentdconfiggenerator.h | 5 ----- src/main/CMakeLists.txt | 8 ++++++++ src/qtui/CMakeLists.txt | 4 ++++ 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 508456e4..fb704145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,13 +84,6 @@ add_feature_info(WITH_BUNDLED_ICONS WITH_BUNDLED_ICONS "Install required icons f option(WITH_OXYGEN_ICONS "Support the Oxygen icon theme (KDE4)" OFF) add_feature_info(WITH_OXYGEN_ICONS WITH_OXYGEN_ICONS "Support the Oxygen icon theme (KDE4)") -if (WITH_BUNDLED_ICONS) - add_definitions(-DWITH_BUNDLED_ICONS) -endif() -if (WITH_OXYGEN_ICONS) - add_definitions(-DWITH_OXYGEN_ICONS) -endif() - # For this, the feature info is added after we know if QtWebkit is installed option(WITH_WEBKIT "WebKit support (for link previews) (legacy)" OFF) @@ -434,20 +427,16 @@ if (NOT WIN32) add_feature_info("syslog.h" HAVE_SYSLOG "Provide support for logging to the syslog") endif() +if (NOT WIN32) + check_function_exists(umask HAVE_UMASK) +endif() + if (EMBED_DATA) message(STATUS "Embedding data files into the binary") else() message(STATUS "Installing data files separately") endif() -if (NOT WIN32) - check_function_exists(umask HAVE_UMASK) - if(HAVE_UMASK) - add_definitions(-DHAVE_UMASK) - endif() -endif() - - # Windows-specific stuff ##################################################################### diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d8982776..b7858f93 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -51,6 +51,10 @@ if (HAVE_SSL) target_sources(${TARGET} PRIVATE sslserver.cpp) endif() +if (HAVE_UMASK) + set_source_files_properties(oidentdconfiggenerator.cpp PROPERTIES COMPILE_DEFINITIONS HAVE_UMASK) +endif() + if (LDAP_FOUND) target_sources(${TARGET} PRIVATE ldapauthenticator.cpp) target_link_libraries(${TARGET} PRIVATE ${LDAP_LIBRARIES}) diff --git a/src/core/oidentdconfiggenerator.cpp b/src/core/oidentdconfiggenerator.cpp index 76a2c064..ecb69b49 100644 --- a/src/core/oidentdconfiggenerator.cpp +++ b/src/core/oidentdconfiggenerator.cpp @@ -18,6 +18,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#ifdef HAVE_UMASK +# include +# include +#endif /* HAVE_UMASK */ + #include #include "corenetwork.h" diff --git a/src/core/oidentdconfiggenerator.h b/src/core/oidentdconfiggenerator.h index 790d85be..7e13d585 100644 --- a/src/core/oidentdconfiggenerator.h +++ b/src/core/oidentdconfiggenerator.h @@ -30,11 +30,6 @@ #include #include -#ifdef HAVE_UMASK -# include -# include -#endif /* HAVE_UMASK */ - #include "quassel.h" #include "coreidentity.h" diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 60efe515..df3d765a 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -13,6 +13,14 @@ if (EMBED_DATA) set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS EMBED_DATA) endif() +if (HAVE_UMASK) + set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS HAVE_UMASK) +endif() + +if (WITH_BUNDLED_ICONS) + set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS WITH_BUNDLED_ICONS) +endif() + # Build the executables if (WANT_CORE) add_executable(quasselcore main.cpp) diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt index 1c0f072d..d47a4ccf 100644 --- a/src/qtui/CMakeLists.txt +++ b/src/qtui/CMakeLists.txt @@ -193,3 +193,7 @@ if (WITH_NOTIFICATION_CENTER) target_sources(${TARGET} PRIVATE osxnotificationbackend.mm) target_link_libraries(${TARGET} PRIVATE "/System/Library/Frameworks/Foundation.framework") endif() + +if (WITH_OXYGEN_ICONS) + set_property(SOURCE qtui.cpp APPEND PROPERTY COMPILE_DEFINITIONS WITH_OXYGEN_ICONS) +endif() -- 2.20.1