From e060ee3832353fd0eee81806a5803146134b685f Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 30 Jun 2014 01:47:42 +0100 Subject: [PATCH] Fix add_definitions --- CMakeLists.txt | 16 ++++++++++++---- TomahawkAddLibrary.cmake | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0609d4774..cfd99adf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,10 +38,18 @@ SET( TOMAHAWK_VERSION_PATCH 100 ) SET( TOMAHAWK_TRANSLATION_LANGUAGES ar bg bn_IN ca cs de en el es fi fr hi_IN hu gl it ja lt pl pt_BR ro ru sv tr zh_CN zh_TW ) +# add_definitions is only in the scope of this directory and all directories +# below it. Tomahawk Libraries and plugins that are built with Tomahawk are +# not included in out-of-source build so we need to re-add_definitions there. +macro(tomahawk_add_definitions DEFINITION) + add_definitions( ${DEFINITION} ) + list(APPEND TOMAHAWK_DEFINITIONS ${DEFINITION}) +endmacro() + # enforce proper symbol exporting on all platforms -add_definitions( "-fvisibility=hidden" ) +tomahawk_add_definitions( "-fvisibility=hidden" ) # enforce using constBegin, constEnd for const-iterators -add_definitions( "-DQT_STRICT_ITERATORS" ) +tomahawk_add_definitions( "-DQT_STRICT_ITERATORS" ) # build options option(BUILD_GUI "Build Tomahawk with GUI" ON) @@ -217,8 +225,8 @@ if( NOT Qt5Core_DIR ) # Qt5 C++11 Macros not defined within Qt4 # TODO: Add C++11 support - add_definitions( "-DQ_DECL_FINAL" ) - add_definitions( "-DQ_DECL_OVERRIDE" ) + tomahawk_add_definitions( "-DQ_DECL_FINAL=" ) + tomahawk_add_definitions( "-DQ_DECL_OVERRIDE=" ) endif() if( Qt5Core_DIR ) diff --git a/TomahawkAddLibrary.cmake b/TomahawkAddLibrary.cmake index 274f82059..09a033199 100644 --- a/TomahawkAddLibrary.cmake +++ b/TomahawkAddLibrary.cmake @@ -52,6 +52,7 @@ function(tomahawk_add_library) add_definitions(${QT_DEFINITIONS}) set_target_properties(${target} PROPERTIES AUTOMOC TRUE) + add_definitions(${TOMAHAWK_DEFINITIONS}) if(LIBRARY_EXPORT_MACRO) set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS ${LIBRARY_EXPORT_MACRO}) endif()