40 lines
1.2 KiB
CMake
40 lines
1.2 KiB
CMake
include(CMLibLargeFiles)
|
|
|
|
set(COMMON_CXX_FEATURES
|
|
cxx_alias_templates cxx_nullptr cxx_override)
|
|
|
|
function(common_target_properties Name)
|
|
get_target_property(__type ${Name} TYPE)
|
|
set(__visibility PUBLIC)
|
|
if(__type STREQUAL INTERFACE_LIBRARY)
|
|
set(__interface 1)
|
|
set(__visibility INTERFACE)
|
|
endif()
|
|
set(_FILE_OFFSET_BITS ON)
|
|
set(_LARGEFILE_SOURCE ON)
|
|
set(_LARGEFILE64_SOURCE ON)
|
|
use_large_files(${Name} ON)
|
|
target_compile_features(${Name} ${__visibility} ${COMMON_CXX_FEATURES})
|
|
target_include_directories(${current_target} PUBLIC
|
|
$<INSTALL_INTERFACE:include>
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
|
if(APPLE)
|
|
target_compile_definitions(${Name} ${__visibility} Darwin)
|
|
endif()
|
|
if(NOT __interface)
|
|
if(TARGET Qt5::Core)
|
|
target_compile_options(${Name} PUBLIC "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
|
|
set_target_properties(${Name} PROPERTIES AUTOMOC TRUE AUTORCC TRUE)
|
|
endif()
|
|
if(TARGET Qt5::Widgets)
|
|
set_target_properties(${Name} PROPERTIES AUTOUIC TRUE)
|
|
endif()
|
|
if(CMAKE_CXX_COMPILER_IS_GCC AND NOT APPLE)
|
|
set_target_properties(${Name} PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
|
|
endif()
|
|
endif()
|
|
|
|
endfunction()
|
|
|