From 428dc84cfd3eda09bf615539f5f2b84e71bb5cb2 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 21 Feb 2019 13:42:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B7=D0=B8=D1=86=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=BD=D0=BE-=D0=BD=D0=B5=D0=B7=D0=B0=D0=B2=D0=B8=D1=81?= =?UTF-8?q?=D0=B8=D0=BC=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCommonTargetProperties.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMLibCommonTargetProperties.cmake b/CMLibCommonTargetProperties.cmake index 592476a..f52d18c 100644 --- a/CMLibCommonTargetProperties.cmake +++ b/CMLibCommonTargetProperties.cmake @@ -8,6 +8,10 @@ function(common_target_properties Name) set(__visibility INTERFACE) endif() target_compile_features(${Name} ${__visibility} ${COMMON_CXX_FEATURES}) + get_target_property(_targetType ${Name} TYPE) + if (_targetType STREQUAL "EXECUTABLE" AND CMAKE_CXX_COMPILE_OPTIONS_PIE) + target_compile_options(${Name} PUBLIC "${CMAKE_CXX_COMPILE_OPTIONS_PIE}") + endif() target_include_directories( ${Name} PUBLIC $ @@ -19,8 +23,9 @@ function(common_target_properties Name) endif() if(NOT __interface) if(TARGET Qt5::Core) - target_compile_options(${Name} - PUBLIC "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + if (_targetType STREQUAL "EXECUTABLE") + target_compile_options(${Name} PUBLIC "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + endif() set_target_properties(${Name} PROPERTIES AUTOMOC TRUE AUTORCC TRUE) endif() if(TARGET Qt5::Widgets)