From: Manuel Nickschas Date: Mon, 13 Aug 2018 21:50:24 +0000 (+0200) Subject: cmake: Fix source-specific compile definitions X-Git-Tag: test-travis-01~166 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=1e40fc6bc04df8f658f677ca5be4c970f150dc10 cmake: Fix source-specific compile definitions set_source_files_properties() overwrites previously specified properties and does not have a way to append, which is bad when e.g. conditionally adding multiple compile definitions to a file. In this particular case, for main.cpp -DHAVE_UMASK would overwrite -DEMBED_DATA, and thus resources would not be loaded. Use set_property(SOURCE... APPEND PROPERTY...) instead. --- diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e571708c..ef0f7c0a 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -52,13 +52,13 @@ if (HAVE_SSL) endif() if (HAVE_UMASK) - set_source_files_properties(oidentdconfiggenerator.cpp PROPERTIES COMPILE_DEFINITIONS HAVE_UMASK) + set_property(SOURCE oidentdconfiggenerator.cpp APPEND PROPERTY COMPILE_DEFINITIONS HAVE_UMASK) endif() if (Ldap_FOUND) target_sources(${TARGET} PRIVATE ldapauthenticator.cpp) target_link_libraries(${TARGET} PRIVATE Ldap::Ldap) - set_source_files_properties(core.cpp PROPERTIES COMPILE_DEFINITIONS HAVE_LDAP) + set_property(SOURCE core.cpp APPEND PROPERTY COMPILE_DEFINITIONS HAVE_LDAP) endif() if (Qca-qt5_FOUND) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index df3d765a..03674672 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -10,11 +10,11 @@ endfunction() # We need to initialize the appropriate resources, so let's give our main.cpp some hints if (EMBED_DATA) - set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS EMBED_DATA) + set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS EMBED_DATA) endif() if (HAVE_UMASK) - set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS HAVE_UMASK) + set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS HAVE_UMASK) endif() if (WITH_BUNDLED_ICONS)