mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 19:30:21 +02:00
Properly export definitions, c and cxx flags and make use of them in external consumers of libtomahawk
This commit is contained in:
@@ -48,7 +48,17 @@ SET( TOMAHAWK_TRANSLATION_LANGUAGES ar bg bn_IN ca cs de en el es fi fr hi_IN hu
|
||||
# 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})
|
||||
set( TOMAHAWK_DEFINITIONS "${TOMAHAWK_DEFINITIONS} ${DEFINITION}")
|
||||
endmacro()
|
||||
|
||||
macro(tomahawk_add_cxx_flags FLAGS)
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
|
||||
set( TOMAHAWK_CXX_FLAGS "${TOMAHAWK_CXX_FLAGS} ${FLAGS}")
|
||||
endmacro()
|
||||
|
||||
macro(tomahawk_add_c_flags FLAGS)
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
|
||||
set( TOMAHAWK_C_FLAGS "${TOMAHAWK_C_FLAGS} ${FLAGS}")
|
||||
endmacro()
|
||||
|
||||
# enforce proper symbol exporting on all platforms
|
||||
@@ -264,17 +274,18 @@ check_cxx_compiler_flag( "-std=c++11" CXX11_FOUND )
|
||||
check_cxx_compiler_flag( "-std=c++0x" CXX0X_FOUND )
|
||||
check_cxx_compiler_flag( "-stdlib=libc++" LIBCPP_FOUND )
|
||||
if(CXX11_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
tomahawk_add_cxx_flags( "-std=c++11" )
|
||||
elseif(CXX0X_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
tomahawk_add_cxx_flags( "-std=c++0x" )
|
||||
else()
|
||||
message(STATUS "${CMAKE_CXX_COMPILER} does not support C++11, please use a
|
||||
different compiler")
|
||||
endif()
|
||||
if(LIBCPP_FOUND AND APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
tomahawk_add_cxx_flags( "-stdlib=libc++" )
|
||||
endif()
|
||||
|
||||
|
||||
macro_optional_find_package(Echonest 2.2.0)
|
||||
macro_log_feature(ECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest 2.2.0 is needed for dynamic playlists and the infosystem")
|
||||
|
||||
|
@@ -52,7 +52,6 @@ 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()
|
||||
|
@@ -18,4 +18,7 @@ include("${TOMAHAWK_CMAKE_DIR}/TomahawkLibraryDepends.cmake")
|
||||
|
||||
# These are IMPORTED targets created by TomahawkLibraryDepends.cmake
|
||||
set(TOMAHAWK_LIBRARIES tomahawklib)
|
||||
set(TOMAHAWK_USE_FILE "${TOMAHAWK_CMAKE_DIR}/TomahawkUse.cmake")
|
||||
set(TOMAHAWK_USE_FILE "${TOMAHAWK_CMAKE_DIR}/TomahawkUse.cmake")
|
||||
set(TOMAHAWK_DEFINITIONS "@TOMAHAWK_DEFINITIONS@")
|
||||
set(TOMAHAWK_CXX_FLAGS "@TOMAHAWK_CXX_FLAGS@")
|
||||
set(TOMAHAWK_C_FLAGS "@TOMAHAWK_C_FLAGS@")
|
||||
|
@@ -61,3 +61,7 @@ endif()
|
||||
|
||||
include( "${TOMAHAWK_CMAKE_DIR}/TomahawkAddLibrary.cmake" )
|
||||
include( "${TOMAHAWK_CMAKE_DIR}/TomahawkAddPlugin.cmake" )
|
||||
|
||||
add_definitions( ${TOMAHAWK_DEFINITIONS} )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TOMAHAWK_CXX_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TOMAHAWK_C_FLAGS}")
|
||||
|
Reference in New Issue
Block a user