Merge branch 'master' of gitlab.2:f1x1t/cmlib

This commit is contained in:
Andrei Astafev 2019-03-05 12:11:35 +03:00
commit 6ba37293b4
4 changed files with 14 additions and 9 deletions

View File

@ -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)

View File

@ -10,16 +10,17 @@ function(add_common_library LIBNAME SOURCES)
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
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 $<TARGET_OBJECTS:${LIBNAME}>)
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()

View File

@ -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 $<INSTALL_INTERFACE:include>
@ -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)

View File

@ -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@