cmake: Set -DHAVE_UMASK only where it's needed
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 6 Aug 2018 21:19:52 +0000 (23:19 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 18 Nov 2018 10:06:43 +0000 (11:06 +0100)
Avoid setting this define globally when it's only used in two
files.

CMakeLists.txt
src/core/CMakeLists.txt
src/core/oidentdconfiggenerator.cpp
src/core/oidentdconfiggenerator.h
src/main/CMakeLists.txt
src/qtui/CMakeLists.txt

index 508456e..fb70414 100644 (file)
@@ -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
 #####################################################################
 
index d898277..b7858f9 100644 (file)
@@ -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})
index 76a2c06..ecb69b4 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
+#ifdef HAVE_UMASK
+#  include <sys/types.h>
+#  include <sys/stat.h>
+#endif /* HAVE_UMASK */
+
 #include <QString>
 
 #include "corenetwork.h"
index 790d85b..7e13d58 100644 (file)
 #include <QMutex>
 #include <QByteArray>
 
-#ifdef HAVE_UMASK
-#  include <sys/types.h>
-#  include <sys/stat.h>
-#endif /* HAVE_UMASK */
-
 #include "quassel.h"
 #include "coreidentity.h"
 
index 60efe51..df3d765 100644 (file)
@@ -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)
index 1c0f072..d47a4cc 100644 (file)
@@ -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()