From 8a3f2eb74c45d545dabba23ffedd5701d82fab72 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 21 Feb 2019 13:21:52 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCommonLibraryTarget.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CMLibCommonLibraryTarget.cmake b/CMLibCommonLibraryTarget.cmake index 7109a5e..aff675f 100644 --- a/CMLibCommonLibraryTarget.cmake +++ b/CMLibCommonLibraryTarget.cmake @@ -10,16 +10,17 @@ function(add_common_library LIBNAME SOURCES) add_library(${LIBNAME}_shared SHARED $) set_target_properties(${LIBNAME}_shared - PROPERTIES VERSION ${PROJECT_VERSION} + PROPERTIES + VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} OUTPUT_NAME ${LIBNAME} LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) add_library(${LIBNAME}_static STATIC $) set_target_properties(${LIBNAME}_static - PROPERTIES OUTPUT_NAME ${LIBNAME} - ARCHIVE_OUTPUT_DIRECTORY - ${CMAKE_INSTALL_LIBDIR}) + PROPERTIES + OUTPUT_NAME ${LIBNAME} + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${LIBNAME}.pc) endfunction() From e51ab028e8f75923da206c4bdee4bd0e04dd4da4 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 21 Feb 2019 13:22:14 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=20=D0=B3?= =?UTF-8?q?=D0=BB=D0=BE=D0=B1=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=84?= =?UTF-8?q?=D0=BB=D0=B0=D0=B3=20=D0=B4=D0=BB=D1=8F=20=D0=B3=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D1=80=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B7=D0=B8=D1=86=D0=B8=D0=BE=D0=BD=D0=BD=D0=BE-?= =?UTF-8?q?=D0=BD=D0=B5=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCommon.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMLibCommon.cmake b/CMLibCommon.cmake index 61941ed..4b578c4 100644 --- a/CMLibCommon.cmake +++ b/CMLibCommon.cmake @@ -9,7 +9,6 @@ include(CMLibDisableInSourceBuild) include(CMakeParseArguments) include(GNUInstallDirs) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -24,9 +23,9 @@ include(CMLibLSBInfo) include(CMLibCompiler) include(CMLibCompilerFlags) include(CMLibCompilerFeaturesHPPGenerate) +include(CMLibFlagRemove) include(CMLibCommonTargetProperties) include(CMLibCommonLibraryTarget) -include(CMLibFlagRemove) include(CMLibBuildTypes) include(CMLibCodeAnalysisPvsStudio) include(cotire) From 489f0cce7228c4b2217ae0dc48fc878971447eae Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 21 Feb 2019 13:41:03 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B2=20lib.pc.in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc/lib.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc/lib.pc.in b/pc/lib.pc.in index 681db44..8af23dc 100644 --- a/pc/lib.pc.in +++ b/pc/lib.pc.in @@ -5,7 +5,7 @@ includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ Name: @current_target@ Description: @current_target@ library -Version: @_ver@ +Version: @PROJECT_VERSION@ Requires: Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -l@current_target@ From 428dc84cfd3eda09bf615539f5f2b84e71bb5cb2 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 21 Feb 2019 13:42:38 +0300 Subject: [PATCH 4/4] =?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)